frm 0.0.3 → 0.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/.gitignore CHANGED
@@ -2,3 +2,6 @@
2
2
  .bundle
3
3
  Gemfile.lock
4
4
  pkg/*
5
+ *~
6
+ *.swp
7
+ tmp/*
data/Rakefile CHANGED
@@ -1,13 +1,16 @@
1
1
  require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
- frm_base = File.dirname __FILE__
4
+ @frm_base = File.dirname __FILE__
5
+
6
+ require File.join @frm_base, 'test', 'rake'
7
+
5
8
 
6
9
  namespace :bump do
7
10
 
8
11
  desc "bump the patch version number"
9
12
  task :patch do
10
- version_file_path = File.join frm_base, 'lib', 'frm', 'version.rb'
13
+ version_file_path = File.join @frm_base, 'lib', 'frm', 'version.rb'
11
14
  current_version_file = File.read version_file_path
12
15
  current_version_file =~ /VERSION[^\d]+(\d+)\.(\d+)\.(\d+)(\.([^'"]*))?/
13
16
  major,minor,patch = $1, $2, $3
data/bin/frm CHANGED
@@ -19,7 +19,10 @@ def print_and_exit(message)
19
19
  end
20
20
 
21
21
  optparse = OptionParser.new do|opts|
22
- opts.banner = "Usage: frm.rb [options] package1 [package2]B ..."
22
+ opts.banner = "Welcome to Effin Repo Manager
23
+ FRM allows you to easily create debian repos on S3
24
+
25
+ Usage: frm [options] package1 [package2] ..."
23
26
 
24
27
  options[:access_key] = nil
25
28
  opts.on( '-a', '--access-key ACCESS_KEY', 'S3 public access key' ) do |key|
@@ -80,7 +83,7 @@ end
80
83
  Dir.chdir(File.dirname(File.dirname(__FILE__)))
81
84
 
82
85
  # require the necessary FRM libs
83
- require File.join Dir.pwd, 'lib', 'deb'
86
+ require File.join Dir.pwd, 'lib', 'frm'
84
87
 
85
88
  puts "creating release..."
86
89
  package_release = FRM::PackageRelease.new(packages)
data/frm.gemspec CHANGED
@@ -19,4 +19,9 @@ Gem::Specification.new do |s|
19
19
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
20
20
  s.require_paths = ["bin"]
21
21
  s.require_paths = ["lib"]
22
+
23
+ s.add_dependency('aws-s3')
24
+
25
+ s.add_development_dependency('mock-aws-s3')
22
26
  end
27
+
data/lib/frm/base.rb ADDED
@@ -0,0 +1,81 @@
1
+ module FRM
2
+ class Base
3
+ # my_dir = File.dirname __FILE__
4
+ # require File.join my_dir, 's3'
5
+ require 'zlib'
6
+ require 'tempfile'
7
+ require 'digest/md5'
8
+ require 'digest/sha1'
9
+ require 'digest/sha2'
10
+
11
+ def compute_md5(string)
12
+ Digest::MD5.hexdigest(string)
13
+ end
14
+
15
+ def compute_sha1(string)
16
+ Digest::SHA1.hexdigest(string)
17
+ end
18
+
19
+ def compute_sha2(string)
20
+ Digest::SHA2.hexdigest(string)
21
+ end
22
+
23
+ # TODO:
24
+ # there has to be a better way to use gpg withen ruby. found many
25
+ # broken solutions :\
26
+ def gpg_clearsign(message)
27
+ `echo "#{message}" | gpg --clearsign`
28
+ end
29
+
30
+ # TODO: same as above
31
+ def gpg_detached(message)
32
+ `echo "#{message}" | gpg -abs`
33
+ end
34
+
35
+
36
+ def generate_gzip_pipe(contents)
37
+ read_buffer, write_buffer = IO.pipe
38
+ gzip_writer = Zlib::GzipWriter.new write_buffer
39
+ gzip_writer.mtime = 1 # ensure that the header is determinstic
40
+ gzip_writer.write contents
41
+ gzip_writer.close
42
+ read_buffer
43
+ end
44
+
45
+ def gunzip_pipe(gziped_pipe)
46
+ gzip_reader = Zlib::GzipReader.new gziped_pipe
47
+ unzipped_string = gzip_reader.read
48
+ gzip_reader.close
49
+ return unzipped_string
50
+ end
51
+
52
+ def parse_package_stub(read_buffer)
53
+ package = {}
54
+ stub = ""
55
+ while line = read_buffer.gets
56
+ return nil if line.strip.empty?
57
+ raise "bad input" unless (match = line.match /^\w+\-?\w+?: /)
58
+ stub << line
59
+ key = match[0].delete ': ' # if match
60
+ value = match.post_match.strip
61
+ package[key] = value
62
+ if key == 'Description'
63
+ while (line = read_buffer.gets).strip != ""
64
+ package['Description'] << line
65
+ stub << line
66
+ end
67
+ package['Description'].rstrip!
68
+ return package, stub
69
+ end
70
+ end
71
+ nil
72
+ end
73
+
74
+ def merge_package_file(in_pipe,out_pipe,package_list)
75
+ sorted_list = package_list.sort { |a,b| a['Package'] <=> b['Package'] }
76
+ # while (next_stub = parse_package_stub in_pipe)
77
+ # STDERR.puts "next_stub[0] = #{next_stub[0]}"
78
+ # end
79
+ end
80
+ end
81
+ end
data/lib/frm/deb.rb CHANGED
@@ -2,93 +2,12 @@ DEFAULT_HOST = 's3-us-west-1.amazonaws.com' # stupid hack to point to
2
2
  # the right region
3
3
 
4
4
  module FRM
5
-
6
-
7
- class Base
8
- my_dir = File.dirname __FILE__
9
- require File.join my_dir, 's3'
10
- require 'zlib'
11
- require 'tempfile'
12
- require 'digest/md5'
13
- require 'digest/sha1'
14
- require 'digest/sha2'
15
-
16
- def compute_md5(string)
17
- Digest::MD5.hexdigest(string)
18
- end
19
-
20
- def compute_sha1(string)
21
- Digest::SHA1.hexdigest(string)
22
- end
23
-
24
- def compute_sha2(string)
25
- Digest::SHA2.hexdigest(string)
26
- end
27
-
28
- # TODO:
29
- # there has to be a better way to use gpg withen ruby. found many
30
- # broken solutions :\
31
- def gpg_clearsign(message)
32
- `echo "#{message}" | gpg --clearsign`
33
- end
34
-
35
- # TODO: same as above
36
- def gpg_detached(message)
37
- `echo "#{message}" | gpg -abs`
38
- end
39
-
40
-
41
- def generate_gzip_pipe(contents)
42
- read_buffer, write_buffer = IO.pipe
43
- gzip_writer = Zlib::GzipWriter.new write_buffer
44
- gzip_writer.mtime = 1 # ensure that the header is determinstic
45
- gzip_writer.write contents
46
- gzip_writer.close
47
- read_buffer
48
- end
49
-
50
- def gunzip_pipe(gziped_pipe)
51
- gzip_reader = Zlib::GzipReader.new gziped_pipe
52
- unzipped_string = gzip_reader.read
53
- gzip_reader.close
54
- return unzipped_string
55
- end
56
-
57
- def parse_package_stub(read_buffer)
58
- package = {}
59
- stub = ""
60
- while line = read_buffer.gets
61
- return nil if line.strip.empty?
62
- raise "bad input" unless (match = line.match /^\w+\-?\w+?: /)
63
- stub << line
64
- key = match[0].delete ': ' # if match
65
- value = match.post_match.strip
66
- package[key] = value
67
- if key == 'Description'
68
- while (line = read_buffer.gets).strip != ""
69
- package['Description'] << line
70
- stub << line
71
- end
72
- package['Description'].rstrip!
73
- return package, stub
74
- end
75
- end
76
- nil
77
- end
78
-
79
- def merge_package_file(in_pipe,out_pipe,package_list)
80
- sorted_list = package_list.sort { |a,b| a['Package'] <=> b['Package'] }
81
- while (next_stub = parse_package_stub in_pipe)
82
- STDERR.puts "next_stub[0] = #{next_stub[0]}"
83
- end
84
- end
85
- end
86
-
87
5
 
88
6
  class Package < Base
89
7
  attr_accessor :repo_filename
90
8
  attr_reader :path, :content, :md5, :sha1, :sha2 , :size
91
9
  def initialize(path)
10
+ raise "you need to specify a path!!!" if path.nil?
92
11
  @path = path
93
12
  raise "Can not find file '#{path}'" unless File.exists?(path)
94
13
  begin
@@ -267,47 +186,6 @@ Description: Cloudscaling APT repository
267
186
  end
268
187
 
269
188
 
270
- def generate_release
271
- return "Origin: apt.cloudscaling.com
272
- Label: apt repository natty
273
- Codename: natty
274
- Date: Thu, 22 Dec 2011 00:29:55 UTC
275
- Architectures: amd64
276
- Components: main universe multiverse
277
- Description: Cloudscaling APT repository
278
- MD5Sum:
279
- a4b943ff89790ccdc186875dad67827b 5813 main/binary-amd64/Packages
280
- 004fd3f868ebbe7501fb2e1c0c54e2a7 2148 main/binary-amd64/Packages.gz
281
- 79dd2fee35fba7255dcd40e1f6529591 134 main/binary-amd64/Release
282
- d41d8cd98f00b204e9800998ecf8427e 0 universe/binary-amd64/Packages
283
- 7029066c27ac6f5ef18d660d5741979a 20 universe/binary-amd64/Packages.gz
284
- 018c8e37146b908a6bde46012a83d4ba 138 universe/binary-amd64/Release
285
- d41d8cd98f00b204e9800998ecf8427e 0 multiverse/binary-amd64/Packages
286
- 7029066c27ac6f5ef18d660d5741979a 20 multiverse/binary-amd64/Packages.gz
287
- 4680f88c741bad22529909db5be4f608 140 multiverse/binary-amd64/Release
288
- SHA1:
289
- 6e03924030eab56cb9735a52ec710537e682bcfc 5813 main/binary-amd64/Packages
290
- 5f2989bae96e148cb5f18accc4357305926ab1e1 2148 main/binary-amd64/Packages.gz
291
- 6d932af9af761f418e5374f73dcd09badb4fe57e 134 main/binary-amd64/Release
292
- da39a3ee5e6b4b0d3255bfef95601890afd80709 0 universe/binary-amd64/Packages
293
- 46c6643f07aa7f6bfe7118de926b86defc5087c4 20 universe/binary-amd64/Packages.gz
294
- 4d428e7ad434df47cffc40cabf8e238ee76ea434 138 universe/binary-amd64/Release
295
- da39a3ee5e6b4b0d3255bfef95601890afd80709 0 multiverse/binary-amd64/Packages
296
- 46c6643f07aa7f6bfe7118de926b86defc5087c4 20 multiverse/binary-amd64/Packages.gz
297
- c8a7d2eb24ece57d460106506fcff99cb2ada015 140 multiverse/binary-amd64/Release
298
- SHA256:
299
- dd8283f06beb4a5fc06ac62d3ae098e5ba2717daef2a15b5f3e9233eb64e0227 5813 main/binary-amd64/Packages
300
- b197c5a3c1fe6a6d286e9f066a0cade289e3a2fc485c90407179951634788aa8 2148 main/binary-amd64/Packages.gz
301
- 690b44df6fe65f40f260b73394e87804df78c9ccf13999889259faeed3eec40d 134 main/binary-amd64/Release
302
- e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 universe/binary-amd64/Packages
303
- 59869db34853933b239f1e2219cf7d431da006aa919635478511fabbfc8849d2 20 universe/binary-amd64/Packages.gz
304
- 32f35b1fc2bdc5a11b53abeadaaa77771b15acb5305777484bf4390d697ae5bd 138 universe/binary-amd64/Release
305
- e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 multiverse/binary-amd64/Packages
306
- 59869db34853933b239f1e2219cf7d431da006aa919635478511fabbfc8849d2 20 multiverse/binary-amd64/Packages.gz
307
- f29816e3a4f90a8b4c688fdb2ac3056d5fb7349857c9ea8da2fbccf8e931baca 140 multiverse/binary-amd64/Release"
308
- end
309
-
310
-
311
189
  def generate_package_line(key='',value='')
312
190
  valid_options = %w{Package Version Architecture Maintainer Standards-Version Homepage Priority Depends Filename Size SHA256 SHA1 MD5sum Description}
313
191
  raise "Bogus option passed: #{key}" unless valid_options.include?(key)
data/lib/frm/s3.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  my_dir = File.dirname __FILE__
2
2
  STDERR.puts "#{File.join my_dir, 's3'}"
3
- require File.join my_dir, 'base'
3
+ #require File.join my_dir, 'base'
4
4
 
5
5
 
6
6
  module FRM
data/lib/frm/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Frm
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
data/lib/frm.rb CHANGED
@@ -1,3 +1,3 @@
1
- module Frm
2
- # Your code goes here...
3
- end
1
+ require File.join @frm_base, 'lib', 'frm', 'base'
2
+ require File.join @frm_base, 'lib', 'frm', 's3'
3
+ require File.join @frm_base, 'lib', 'frm', 'deb'
data/test/Packages.txt ADDED
@@ -0,0 +1,155 @@
1
+ Package: kyotocabinet
2
+ Version: 1.2.68
3
+ Architecture: amd64
4
+ Maintainer: <jenkins@ci>
5
+ Standards-Version: 3.9.1
6
+ Homepage: http://nourlgiven.example.com/no/url/given
7
+ Priority: extra
8
+ Section: default
9
+ Filename: pool/main/k/kyotocabinet/kyotocabinet_1.2.68_amd64.deb
10
+ Size: 3718964
11
+ SHA256: 0646abf6c54a00afd213272386fb58ca777357bee99a53464b6f9a6e79344fde
12
+ SHA1: 6d2fb30095bb6ca876ca2ffc22523911aede9dfa
13
+ MD5sum: f1fc7e4c0bc8e3874d37c8df668c6fb3
14
+ Description: no description given
15
+
16
+ Package: pod-services
17
+ Version: 0.0.4
18
+ Architecture: amd64
19
+ Maintainer: <jenkins@ci>
20
+ Depends: zeromq, kyotocabinet, ruby1.9.2-full, libavahi-compat-libdnssd1, rubygem-bundler
21
+ Standards-Version: 3.9.1
22
+ Homepage: http://nourlgiven.example.com/no/url/given
23
+ Priority: extra
24
+ Section: default
25
+ Filename: pool/main/p/pod-services/pod-services_0.0.4_amd64.deb
26
+ Size: 59230358
27
+ SHA256: 6c5e8044d13dfb1c337767474a8094416c0913650aff71a2fe4aaec4d0f8ee9d
28
+ SHA1: 467fcc65ed729c845bad981743b5774e359a40df
29
+ MD5sum: 4b6ed193ca6d4d8002e39413b8966cca
30
+ Description: no description given
31
+
32
+ Package: python-kyotocabinet
33
+ Version: 1.1
34
+ Architecture: amd64
35
+ Maintainer: <jenkins@ci>
36
+ Depends: kyotocabinet
37
+ Standards-Version: 3.9.1
38
+ Homepage: http://fallabs.com/kyotocabinet/
39
+ Priority: extra
40
+ Section: default
41
+ Filename: pool/main/p/python-kyotocabinet/python-kyotocabinet_1.1_amd64.deb
42
+ Size: 1309704
43
+ SHA256: f71dcafe4074bbbe68105d9dcd4700313f2543147a88e10392761736719b83a1
44
+ SHA1: b0772977ec9c1d4b8313b76f20188b24646ea8fb
45
+ MD5sum: cf02d0adc90e110893165834a0993c0d
46
+ Description: a straightforward implementation of DBM
47
+
48
+ Package: python-netifaces
49
+ Version: 0.5
50
+ Architecture: amd64
51
+ Maintainer: <jenkins@ci>
52
+ Standards-Version: 3.9.1
53
+ Homepage: http://alastairs-place.net/netifaces
54
+ Priority: extra
55
+ Section: default
56
+ Filename: pool/main/p/python-netifaces/python-netifaces_0.5_amd64.deb
57
+ Size: 14126
58
+ SHA256: 433969c5ff6e56a5c5ca9925c01ecc1df591080e95544d4f0ee61fa9d263abf4
59
+ SHA1: 512bc3b46bbc8d7b45fda8ff496c6cee6208bf03
60
+ MD5sum: 66e6739aadb3c6e3def550b36ac10eeb
61
+ Description: Portable network interface information.
62
+
63
+ Package: python-pybonjour
64
+ Version: 1.1.1
65
+ Architecture: all
66
+ Maintainer: <jenkins@ci>
67
+ Depends: libavahi-compat-libdnssd1
68
+ Standards-Version: 3.9.1
69
+ Homepage: http://o2s.csail.mit.edu/o2s-wiki/pybonjour
70
+ Priority: extra
71
+ Section: default
72
+ Filename: pool/main/p/python-pybonjour/python-pybonjour_1.1.1_all.deb
73
+ Size: 30490
74
+ SHA256: 7e23aeb59599f60da61acd3275038d5603515e00b215a2dd94a222c648c2bc8a
75
+ SHA1: ae97584f4471165306fea16d9cd0628f1b7f797f
76
+ MD5sum: efa7004bbffc372abeb99070997e295b
77
+ Description: Pure-Python interface to Apple Bonjour and compatible DNS-SD libraries
78
+
79
+ Package: python-pyzmq
80
+ Version: 2.1.7.1
81
+ Architecture: amd64
82
+ Maintainer: <jenkins@ci>
83
+ Depends: zeromq
84
+ Standards-Version: 3.9.1
85
+ Homepage: http://github.com/zeromq/pyzmq
86
+ Priority: extra
87
+ Section: default
88
+ Filename: pool/main/p/python-pyzmq/python-pyzmq_2.1.7.1_amd64.deb
89
+ Size: 1198458
90
+ SHA256: 039fac7f7dbf0c5c8da6179a13756a216cf8c7d192c8c451631a005a10e6085d
91
+ SHA1: 6f34087234c6c64d5563249bcbe0ae789807cf50
92
+ MD5sum: bd0364643376bce244b87f6cc4824896
93
+ Description: Python bindings for 0MQ.
94
+
95
+ Package: python-thlayli
96
+ Version: 0.3
97
+ Architecture: all
98
+ Maintainer: <jenkins@ci>
99
+ Depends: python-netifaces (>= 0), python-kyotocabinet (>= 0), python-pybonjour (>= 0), python-pyzmq (>= 0)
100
+ Standards-Version: 3.9.1
101
+ Homepage: http://clouldscaling.com/
102
+ Priority: extra
103
+ Section: default
104
+ Filename: pool/main/p/python-thlayli/python-thlayli_0.3_all.deb
105
+ Size: 13426
106
+ SHA256: f860439b4db71b5bd85d103b4460dce8464c468d00a8632e3ae1a0a32cc35c57
107
+ SHA1: a457cfbc4737acbe1def6c49c0ca56ff5d425479
108
+ MD5sum: 3dd096d608ad55b04754bc1ad4ac3457
109
+ Description: Thlayli is a simple tuplespace for coordinating distributed work.
110
+
111
+ Package: ruby1.9.2-full
112
+ Version: 1.9.2
113
+ Architecture: amd64
114
+ Maintainer: <jenkins@ci>
115
+ Standards-Version: 3.9.1
116
+ Homepage: http://nourlgiven.example.com/no/url/given
117
+ Priority: extra
118
+ Section: default
119
+ Filename: pool/main/r/ruby1.9.2-full/ruby1.9.2-full_1.9.2_amd64.deb
120
+ Size: 10923378
121
+ SHA256: 1640650ad27b765681d9148f0e23f40b5d86ba6e60370f63bf6402fb0fec4f6f
122
+ SHA1: d9748b34ca4d2a284bac86ec3040f685adc4964c
123
+ MD5sum: 2baa87f011d61b8a884ded2a0ccf43d8
124
+ Description: no description given
125
+
126
+ Package: rubygem-bundler
127
+ Version: 1.0.18
128
+ Architecture: all
129
+ Maintainer: André Arko
130
+ Standards-Version: 3.9.1
131
+ Homepage: http://gembundler.com
132
+ Priority: extra
133
+ Section: Languages/Development/Ruby
134
+ Filename: pool/main/r/rubygem-bundler/rubygem-bundler_1.0.18_all.deb
135
+ Size: 341144
136
+ SHA256: b2e51a45a90707261ed36648847409783542fc092bc18a11a63a1db0b76ca4b3
137
+ SHA1: ca3d01e1e0e3608b785562bc5d31d413e74e0d77
138
+ MD5sum: 13d7db51446b5bbed40f8db407597733
139
+ Description: Bundler manages an application's dependencies through its entire life, across many machines, systematically and repeatably
140
+
141
+ Package: zeromq
142
+ Version: 2.1.7
143
+ Architecture: amd64
144
+ Maintainer: <jenkins@ci>
145
+ Standards-Version: 3.9.1
146
+ Homepage: http://nourlgiven.example.com/no/url/given
147
+ Priority: extra
148
+ Section: default
149
+ Filename: pool/main/z/zeromq/zeromq_2.1.7_amd64.deb
150
+ Size: 1899468
151
+ SHA256: e41fcb46155591beb120a95f11a574e39e7a4e60e61f373ba1843d5fea63f280
152
+ SHA1: d25801f69462a1b9d1a91c396de98d9a7b4c2e95
153
+ MD5sum: 48b46e195bd4ea7d6140e1ca1520a199
154
+ Description: no description given
155
+
@@ -1,9 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'minitest/autorun'
4
-
5
- my_dir = File.dirname __FILE__
6
- require File.join my_dir, 'deb'
4
+ require 'mock-aws-s3'
7
5
 
8
6
  class TestReleasePusher < MiniTest::Unit::TestCase
9
7
  def setup
@@ -11,12 +9,9 @@ class TestReleasePusher < MiniTest::Unit::TestCase
11
9
  @tempfile2 = File.open('/tmp/bar_1.2.3.4_amd64.deb','w+') { |f| f.write 'bar' }
12
10
  @tempfile3 = File.open('/tmp/martin_1.2.3.4_amd64.deb','w+') { |f| f.write 'martin' }
13
11
 
14
- hashes = %w{
15
- /home/martin/sheep/modules/substratum/debs/pod-services-0.5.0-967-amd64.deb
16
- /home/martin/sheep/modules/substratum/debs/cs-chef-0.9.1-1782-all.deb
17
- /home/martin/sheep/modules/substratum/debs/ruby1.9.2-1-amd64.deb
18
- }
19
-
12
+ hashes = []
13
+ hashes << File.join(@@frm_test_base, 'debs', 'frm_foo-1.0.0.deb')
14
+ hashes << File.join(@@frm_test_base, 'debs', 'frm_bar-1.0.0.deb')
20
15
 
21
16
  @package_release = FRM::PackageRelease.new(hashes)
22
17
  @release_pusher = FRM::ReleasePusher.new(@package_release,'1234','abcd',\
data/test/deb_test.rb CHANGED
@@ -11,52 +11,9 @@ class TestReleasePusher < MiniTest::Unit::TestCase
11
11
  @tempfile2 = File.open('/tmp/bar_1.2.3.4_amd64.deb','w+') { |f| f.write 'bar' }
12
12
  @tempfile3 = File.open('/tmp/martin_1.2.3.4_amd64.deb','w+') { |f| f.write 'martin' }
13
13
 
14
- hashes = [{
15
- "Package" => "foo",
16
- "Version" => "1.2.68",
17
- "Architecture" => "amd64",
18
- "Maintainer" => "support@cloudscaling.com",
19
- "Homepage" => "http://www.cloudscaling.com",
20
- "Priority" => "extra",
21
- "Depends" => %w{one two three},
22
- "section" => "main",
23
- "path_to_deb" => '/tmp/foo_1.2.68_amd64.deb',
24
- "Description" => 'some
25
- multiline
26
- description'
27
- },
28
- {
29
- "Package" => "bar",
30
- "Version" => "1.2.3.4",
31
- "Architecture" => "amd64",
32
- "Maintainer" => "support@cloudscaling.com",
33
- "Homepage" => "http://www.cloudscaling.com",
34
- "Priority" => "extra",
35
- "Depends" => %w{one two three},
36
- "section" => "main",
37
- "path_to_deb" => '/tmp/bar_1.2.3.4_amd64.deb'
38
- },
39
- {
40
- "Package" => "martin",
41
- "Version" => "1.2.3.4",
42
- "Architecture" => "amd64",
43
- "Maintainer" => "support@cloudscaling.com",
44
- "Homepage" => "http://www.cloudscaling.com",
45
- "Priority" => "extra",
46
- "section" => "main",
47
- "path_to_deb" => '/tmp/martin_1.2.3.4_amd64.deb'
48
- },
49
- {
50
- "Package" => "cs-chef",
51
- "Version" => "1.2.3.4",
52
- "Architecture" => "amd64",
53
- "Maintainer" => "support@cloudscaling.com",
54
- "Homepage" => "http://www.cloudscaling.com",
55
- "Priority" => "extra",
56
- "section" => "main",
57
- "path_to_deb" => '/tmp/debs/cs-chef-0.9.1-1782-all.deb'
58
- }
59
- ]
14
+ hashes = []
15
+ hashes << File.join(@@frm_test_base, 'debs', 'frm_foo-1.0.0.deb')
16
+ hashes << File.join(@@frm_test_base, 'debs', 'frm_bar-1.0.0.deb')
60
17
 
61
18
  @package_release = FRM::PackageRelease.new(hashes)
62
19
  @release_pusher = FRM::ReleasePusher.new(@package_release,'abcd','1234',\
@@ -64,7 +21,7 @@ class TestReleasePusher < MiniTest::Unit::TestCase
64
21
  end
65
22
 
66
23
  def test
67
- puts "@release_pusher.inspect = #{@release_pusher.inspect}"
24
+ # puts "@release_pusher.inspect = #{@release_pusher.inspect}"
68
25
  end
69
26
 
70
27
  end
@@ -74,68 +31,49 @@ end
74
31
  @tempfile1 = File.open('/tmp/foo_1.2.68_amd64.deb','w+') { |f| f.write 'foo' }
75
32
  @tempfile2 = File.open('/tmp/bar_1.2.3.4_amd64.deb','w+') { |f| f.write 'bar' }
76
33
 
77
- hashes = [{
78
- "Package" => "foo",
79
- "Version" => "1.2.68",
80
- "Architecture" => "amd64",
81
- "Maintainer" => "support@cloudscaling.com",
82
- "Homepage" => "http://www.cloudscaling.com",
83
- "Priority" => "extra",
84
- "Depends" => %w{one two three},
85
- "section" => "main",
86
- "path_to_deb" => '/tmp/foo_1.2.68_amd64.deb',
87
- "Description" => 'some
88
- multiline
89
- description'
90
- },
91
- {
92
- "Package" => "bar",
93
- "Version" => "1.2.3.4",
94
- "Architecture" => "amd64",
95
- "Maintainer" => "support@cloudscaling.com",
96
- "Homepage" => "http://www.cloudscaling.com",
97
- "Priority" => "extra",
98
- "Depends" => %w{one two three},
99
- "section" => "main",
100
- "path_to_deb" => '/tmp/bar_1.2.3.4_amd64.deb'
101
- }
102
- ]
34
+ hashes = []
35
+ hashes << File.join(@@frm_test_base, 'debs', 'frm_foo-1.0.0.deb')
36
+ hashes << File.join(@@frm_test_base, 'debs', 'frm_bar-1.0.0.deb')
103
37
 
104
38
  @package_release = FRM::PackageRelease.new(hashes)
105
39
  end
106
40
 
107
41
  def test()
108
- correct_output = "Package: foo
109
- Version: 1.2.68
42
+ correct_output = "Package: frm-foo
43
+ Version: 1.0
44
+ License: unknown
45
+ Vendor: martin@host-c1e5ea34
110
46
  Architecture: amd64
111
- Maintainer: <support@cloudscaling.com>
112
- Standards-Version: 3.9.1
113
- Homepage: http://www.cloudscaling.com
47
+ Maintainer: <martin@host-c1e5ea34>
48
+ Installed-Size: 0
49
+ #Pre-Depends:
50
+ Section: default
114
51
  Priority: extra
115
- Depends: one, two, three
116
- Filename: pool/main/f/foo/foo_1.2.68_amd64.deb
117
- Size: 3
118
- MD5sum: acbd18db4cc2f85cedef654fccc4a4d8
119
- SHA1: 0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33
120
- SHA256: 2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae
121
- Description: some
122
- multiline
123
- description
124
-
125
- Package: bar
126
- Version: 1.2.3.4
52
+ Homepage: http://example.com/no-uri-given
53
+ Description: no description given
54
+ Filename: pool/main/f/frm-foo/frm_foo-1.0.0.deb
55
+ Size: 716
56
+ MD5sum: 0faf8cabf49a615adacbe6d80c4aee3b
57
+ SHA1: 78c6be70488c78d63b6eb233f891e80d3af0b779
58
+ SHA256: 5f0de3c65226c13e9c215478ba784afe54b0592aa46766ff19b1140644bbda71
59
+
60
+ Package: frm-bar
61
+ Version: 1.0
62
+ License: unknown
63
+ Vendor: martin@host-c1e5ea34
127
64
  Architecture: amd64
128
- Maintainer: <support@cloudscaling.com>
129
- Standards-Version: 3.9.1
130
- Homepage: http://www.cloudscaling.com
65
+ Maintainer: <martin@host-c1e5ea34>
66
+ Installed-Size: 0
67
+ #Pre-Depends:
68
+ Section: default
131
69
  Priority: extra
132
- Depends: one, two, three
133
- Filename: pool/main/b/bar/bar_1.2.3.4_amd64.deb
134
- Size: 3
135
- MD5sum: 37b51d194a7513e45b56f6524f2d51f2
136
- SHA1: 62cdb7020ff920e5aa642c3d4066950dd1f01f4d
137
- SHA256: fcde2b2edba56bf408601fb721fe9b5c338d10ee429ea04fae5511b68fbf8fb9
70
+ Homepage: http://example.com/no-uri-given
138
71
  Description: no description given
72
+ Filename: pool/main/f/frm-bar/frm_bar-1.0.0.deb
73
+ Size: 716
74
+ MD5sum: b21df912829a23f9846ddd022fc74c74
75
+ SHA1: 0592c2eb2f3f5a830109d63b83ab438c7c258d14
76
+ SHA256: 131f5d16fdd7ddf8bf9c4983d77022b268c02b2864ce9a9f841704631417515d
139
77
 
140
78
  "
141
79
  assert @package_release.package_file == correct_output
@@ -152,7 +90,6 @@ Description: Cloudscaling APT repository
152
90
  end
153
91
 
154
92
  def test_generate_release
155
- # skip 'need to finish generate_release function'
156
93
  correct_release_file = "Origin: apt.cloudscaling.com
157
94
  Label: apt repository natty
158
95
  Codename: natty
@@ -161,16 +98,16 @@ Architectures: amd64
161
98
  Components: main universe multiverse
162
99
  Description: Cloudscaling APT repository
163
100
  MD5Sum:
164
- 32aed966f2f629d6229d14cd37da740e 896 main/binary-amd64/Packages
165
- a2ea734a1d863873d0acd98845bd0573 438 main/binary-amd64/Packages.gz
101
+ c0ff97432f4ac04c99b2ddee0a1d5fed 986 main/binary-amd64/Packages
102
+ 5bfa5912649f52c32d2e740fc727ebd5 462 main/binary-amd64/Packages.gz
166
103
  79dd2fee35fba7255dcd40e1f6529591 134 main/binary-amd64/Release
167
104
  SHA1:
168
- b2f872140a4e651609c1ce7538dba871a4ad49de 896 main/binary-amd64/Packages
169
- 86b1fc7c8905cf35a9ff2544bb277c332e93b7d1 438 main/binary-amd64/Packages.gz
105
+ 2ecb580a151f0cf625016352b2a474b787cc0ac3 986 main/binary-amd64/Packages
106
+ 80a6c1f004fb7b6bcb1ce3f86d16e53b5735ac84 462 main/binary-amd64/Packages.gz
170
107
  6d932af9af761f418e5374f73dcd09badb4fe57e 134 main/binary-amd64/Release
171
108
  SHA256:
172
- 14139ad7300259e51e2c0d75891966d10f9382adbda61c7348990ccf125e4d4f 896 main/binary-amd64/Packages
173
- 67014ee7cc96108af726aae5636d26225c2cd833301765e44cf6cb6ea7719698 438 main/binary-amd64/Packages.gz
109
+ ae8b50085f2405febff78f86fe7d89d93d9ff94ceccfbfa975c0bd79e63ce385 986 main/binary-amd64/Packages
110
+ cb8501ace11b9bdbfd0d65006a116313f5c6fda625d6383a549e80b982fc6eac 462 main/binary-amd64/Packages.gz
174
111
  690b44df6fe65f40f260b73394e87804df78c9ccf13999889259faeed3eec40d 134 main/binary-amd64/Release
175
112
  "
176
113
  assert @package_release.release_file == correct_release_file
@@ -184,55 +121,24 @@ class TestPackage < MiniTest::Unit::TestCase
184
121
  @tempfile1 = File.open('/tmp/foo','w+') { |f| f.write 'foo' }
185
122
  @tempfile2 = File.open('/tmp/bar','w+') { |f| f.write 'bar' }
186
123
 
187
- @hash = {
188
- "Package" => "foo",
189
- "Version" => "1.2.68",
190
- "Architecture" => "amd64",
191
- "Maintainer" => "support@cloudscaling.com",
192
- "Homepage" => "http://www.cloudscaling.com",
193
- "Priority" => "extra",
194
- "Depends" => %w{one two three},
195
- "section" => "main",
196
- "path_to_deb" => '/tmp/foo',
197
- "Description" => 'some
198
- multiline
199
- description'
200
- }
124
+ package = File.join(@@frm_test_base, 'debs', 'frm_foo-1.0.0.deb')
201
125
 
202
- @package1 = FRM::Package.new(@hash)
126
+ @package1 = FRM::Package.new(package)
203
127
  end
204
128
 
205
- def test()
206
- assert @package1.name == 'foo'
207
- assert @package1.content == 'foo'
208
- end
209
-
210
129
  def test_bad_file()
211
- bad_hash = {
212
- "Package" => "foo",
213
- "Version" => "1.2.68",
214
- "Architecture" => "amd64",
215
- "Maintainer" => "support@cloudscaling.com",
216
- "Homepage" => "http://www.cloudscaling.com",
217
- "Priority" => "extra",
218
- "Depends" => %w{one two three},
219
- "section" => "main",
220
- "path_to_deb" => '/some/bad/path',
221
- "Description" => 'some
222
- multiline
223
- description'
224
- }
225
- assert_raises(RuntimeError) { FRM::Package.new(bad_hash) }
130
+ bad_package = "/some/bad/path"
131
+ assert_raises(RuntimeError) { FRM::Package.new(bad_package) }
226
132
  end
227
133
 
228
134
  def test_good_file()
229
- assert @package1.content == 'foo'
135
+ assert Digest::MD5.hexdigest(@package1.content) == '0faf8cabf49a615adacbe6d80c4aee3b'
230
136
  end
231
137
 
232
138
  def test_hashes()
233
- assert @package1.md5 == 'acbd18db4cc2f85cedef654fccc4a4d8'
234
- assert @package1.sha1 == '0beec7b5ea3f0fdbc95d0dd47f3c5bc275da8a33'
235
- assert @package1.sha2 == '2c26b46b68ffc68ff99b453c1d30413413422d706483bfa0f98a5e886266e7ae'
139
+ assert @package1.md5 == '0faf8cabf49a615adacbe6d80c4aee3b'
140
+ assert @package1.sha1 == '78c6be70488c78d63b6eb233f891e80d3af0b779'
141
+ assert @package1.sha2 == '5f0de3c65226c13e9c215478ba784afe54b0592aa46766ff19b1140644bbda71'
236
142
 
237
143
  end
238
144
 
@@ -374,32 +280,7 @@ Description: Cloudscaling APT repository
374
280
  "
375
281
  assert @deb.generate_package_release == package_release_file
376
282
  end
377
-
378
- def test_generate_release
379
- skip 'need to finish generate_release function'
380
- release_file = "Origin: apt.cloudscaling.com
381
- Label: apt repository natty
382
- Codename: natty
383
- Date: Thu, 22 Dec 2011 00:29:55 UTC
384
- Architectures: amd64
385
- ;Components: main universe multiverse
386
- Description: Cloudscaling APT repository
387
- MD5Sum:
388
- a4b943ff89790ccdc186875dad67827b 5813 main/binary-amd64/Packages
389
- 004fd3f868ebbe7501fb2e1c0c54e2a7 2148 main/binary-amd64/Packages.gz
390
- 79dd2fee35fba7255dcd40e1f6529591 134 main/binary-amd64/Release
391
- SHA1:
392
- 6e03924030eab56cb9735a52ec710537e682bcfc 5813 main/binary-amd64/Packages
393
- 5f2989bae96e148cb5f18accc4357305926ab1e1 2148 main/binary-amd64/Packages.gz
394
- 6d932af9af761f418e5374f73dcd09badb4fe57e 134 main/binary-amd64/Release
395
- SHA256:
396
- dd8283f06beb4a5fc06ac62d3ae098e5ba2717daef2a15b5f3e9233eb64e0227 5813 main/binary-amd64/Packages
397
- b197c5a3c1fe6a6d286e9f066a0cade289e3a2fc485c90407179951634788aa8 2148 main/binary-amd64/Packages.gz
398
- 690b44df6fe65f40f260b73394e87804df78c9ccf13999889259faeed3eec40d 134 main/binary-amd64/Release
399
- "
400
- assert @deb.generate_release == release_file
401
- end
402
-
283
+
403
284
  def generate_random_string
404
285
  rand(36**rand(50)).to_s(36)
405
286
  end
@@ -446,7 +327,7 @@ Description: no description given
446
327
 
447
328
 
448
329
  def test_merge_package_file
449
- package_file = File.open 'Packages.txt'
330
+ package_file = File.open File.join @@frm_test_base, 'Packages.txt'
450
331
  read_buffer, write_buffer = IO.pipe
451
332
 
452
333
  @deb.merge_package_file(package_file,write_buffer,@hash)
Binary file
Binary file
data/test/lib/test.rb ADDED
@@ -0,0 +1,13 @@
1
+ # this is the place to put common testing code
2
+
3
+ def compare_line_by_line(chunk1,chunk2)
4
+ arr1=chunk1.split("\n")
5
+ arr2=chunk2.split("\n")
6
+ arr1.each_with_index do |line,i|
7
+ unless line == arr2[i]
8
+ puts "line number #{i} is different:"
9
+ puts " #{line}"
10
+ puts " #{arr2[i]}"
11
+ end
12
+ end
13
+ end
data/test/rake.rb ADDED
@@ -0,0 +1,27 @@
1
+ @@frm_test_base = File.join @frm_base, 'test'
2
+
3
+ require File.join @@frm_test_base, 'lib', 'test'
4
+
5
+ namespace :test do
6
+
7
+ desc "run the s3 test"
8
+ task :s3 do
9
+ require File.join @frm_base, 'lib', 'frm'
10
+ require File.join @@frm_test_base, 's3'
11
+ end
12
+
13
+ desc "run the deb test"
14
+ task :deb do
15
+ require File.join @frm_base, 'lib', 'frm'
16
+ require File.join @@frm_test_base, 'deb'
17
+ end
18
+
19
+
20
+ desc "run the old deb test"
21
+ task :old_deb do
22
+ require File.join @frm_base, 'lib', 'frm'
23
+ require File.join @@frm_test_base, 'deb_test'
24
+ end
25
+
26
+ end
27
+
data/test/s3.rb CHANGED
@@ -1,9 +1,7 @@
1
1
  #!/usr/bin/env ruby
2
2
 
3
3
  require 'minitest/autorun'
4
- my_dir = File.dirname __FILE__
5
- require File.join my_dir, 's3'
6
-
4
+ require 'mock-aws-s3'
7
5
 
8
6
  # this is a stupid hack to get the @@bucket region set properly
9
7
  DEFAULT_HOST = 's3-us-west-1.amazonaws.com'
@@ -14,7 +12,7 @@ class TestFRM < MiniTest::Unit::TestCase
14
12
  @@access_key_id = 'abcd'
15
13
  @@secret_key_id = '1234'
16
14
  @@bucket = 'some-bucket'
17
- @@prefix = 'testing/tmp/' + Time.now.strftime("%Y/%m/%d/%H:%M:%S ")
15
+ @@prefix = 'testing/'
18
16
  @@server = 's3-us-west-1.amazonaws.com'
19
17
  @@timestamp = rand(9999).to_s
20
18
 
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 3
9
- version: 0.0.3
8
+ - 4
9
+ version: 0.0.4
10
10
  platform: ruby
11
11
  authors:
12
12
  - Martin Rhoads
@@ -16,8 +16,33 @@ cert_chain: []
16
16
 
17
17
  date: 2012-03-31 00:00:00 -07:00
18
18
  default_executable:
19
- dependencies: []
20
-
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: aws-s3
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - ">="
27
+ - !ruby/object:Gem::Version
28
+ segments:
29
+ - 0
30
+ version: "0"
31
+ type: :runtime
32
+ version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: mock-aws-s3
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :development
45
+ version_requirements: *id002
21
46
  description: FRM makes it easy to build package repositories on S3
22
47
  email:
23
48
  - ermal14@gmail.com
@@ -35,11 +60,17 @@ files:
35
60
  - bin/frm
36
61
  - frm.gemspec
37
62
  - lib/frm.rb
63
+ - lib/frm/base.rb
38
64
  - lib/frm/deb.rb
39
65
  - lib/frm/s3.rb
40
66
  - lib/frm/version.rb
67
+ - test/Packages.txt
68
+ - test/deb.rb
41
69
  - test/deb_test.rb
42
- - test/deb_test2.rb
70
+ - test/debs/frm_bar-1.0.0.deb
71
+ - test/debs/frm_foo-1.0.0.deb
72
+ - test/lib/test.rb
73
+ - test/rake.rb
43
74
  - test/s3.rb
44
75
  has_rdoc: true
45
76
  homepage: https://github.com/ermal14/frm
@@ -73,7 +104,5 @@ rubygems_version: 1.3.7
73
104
  signing_key:
74
105
  specification_version: 3
75
106
  summary: Effin Repo Manager
76
- test_files:
77
- - test/deb_test.rb
78
- - test/deb_test2.rb
79
- - test/s3.rb
107
+ test_files: []
108
+