deb-s3 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +2 -0
- data/lib/deb/s3.rb +1 -1
- data/lib/deb/s3/cli.rb +1 -1
- data/lib/deb/s3/manifest.rb +10 -10
- data/lib/deb/s3/package.rb +20 -2
- data/lib/deb/s3/release.rb +2 -2
- data/lib/deb/s3/utils.rb +5 -3
- metadata +40 -18
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 83e22542e348437549fe9d78648659ce10f64dd4
|
4
|
+
data.tar.gz: 1e0ca1bb8dc6c822b122c4e3d71199fa9e71398c
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 448a9252b80774397270906a81b49bb6be58d87bc5d89056a0ea2b468d8fe3bf8132d997d47fbf017b3ca24a8dc79f9c78486214dc7e3e0cc9db249675bf723d
|
7
|
+
data.tar.gz: 35f0553c9830f502bae6c587af1006096d1fb168fae984d580da4408d1500cb6d2bbc75d7e29bd8f98e3e3e0f0aa2e34d32b241aab52cfa9e079b0f18ca90c4f
|
data/README.md
CHANGED
data/lib/deb/s3.rb
CHANGED
data/lib/deb/s3/cli.rb
CHANGED
@@ -95,7 +95,7 @@ class Deb::S3::CLI < Thor
|
|
95
95
|
end
|
96
96
|
|
97
97
|
# make sure all the files exists
|
98
|
-
if missing_file = files.
|
98
|
+
if missing_file = files.find { |pattern| Dir.glob(pattern).empty? }
|
99
99
|
error("File '#{missing_file}' doesn't exist")
|
100
100
|
end
|
101
101
|
|
data/lib/deb/s3/manifest.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
require "tempfile"
|
2
2
|
require "zlib"
|
3
|
+
require 'deb/s3/utils'
|
4
|
+
require 'deb/s3/package'
|
3
5
|
|
4
6
|
class Deb::S3::Manifest
|
5
7
|
include Deb::S3::Utils
|
@@ -10,6 +12,8 @@ class Deb::S3::Manifest
|
|
10
12
|
|
11
13
|
attr_accessor :files
|
12
14
|
|
15
|
+
attr_reader :packages
|
16
|
+
|
13
17
|
def initialize
|
14
18
|
@packages = []
|
15
19
|
@component = nil
|
@@ -41,17 +45,13 @@ class Deb::S3::Manifest
|
|
41
45
|
end
|
42
46
|
end
|
43
47
|
|
44
|
-
def packages
|
45
|
-
@packages
|
46
|
-
end
|
47
|
-
|
48
48
|
def add(pkg, preserve_versions)
|
49
49
|
if preserve_versions
|
50
|
-
|
50
|
+
packages.delete_if { |p| p.name == pkg.name && p.full_version == pkg.full_version }
|
51
51
|
else
|
52
|
-
|
52
|
+
packages.delete_if { |p| p.name == pkg.name }
|
53
53
|
end
|
54
|
-
|
54
|
+
packages << pkg
|
55
55
|
pkg
|
56
56
|
end
|
57
57
|
|
@@ -82,7 +82,7 @@ class Deb::S3::Manifest
|
|
82
82
|
@packages.each do |pkg|
|
83
83
|
if pkg.needs_uploading?
|
84
84
|
yield pkg.url_filename if block_given?
|
85
|
-
s3_store(pkg.filename, pkg.
|
85
|
+
s3_store(pkg.filename, pkg.url_filename, 'application/octet-stream; charset=binary')
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
@@ -92,7 +92,7 @@ class Deb::S3::Manifest
|
|
92
92
|
pkgs_temp.close
|
93
93
|
f = "dists/#{@codename}/#{@component}/binary-#{@architecture}/Packages"
|
94
94
|
yield f if block_given?
|
95
|
-
s3_store(pkgs_temp.path, f)
|
95
|
+
s3_store(pkgs_temp.path, f, 'text/plain; charset=us-ascii')
|
96
96
|
@files["#{@component}/binary-#{@architecture}/Packages"] = hashfile(pkgs_temp.path)
|
97
97
|
pkgs_temp.unlink
|
98
98
|
|
@@ -102,7 +102,7 @@ class Deb::S3::Manifest
|
|
102
102
|
Zlib::GzipWriter.open(gztemp.path) { |gz| gz.write manifest }
|
103
103
|
f = "dists/#{@codename}/#{@component}/binary-#{@architecture}/Packages.gz"
|
104
104
|
yield f if block_given?
|
105
|
-
s3_store(gztemp.path, f)
|
105
|
+
s3_store(gztemp.path, f, 'application/x-gzip; charset=binary')
|
106
106
|
@files["#{@component}/binary-#{@architecture}/Packages.gz"] = hashfile(gztemp.path)
|
107
107
|
gztemp.unlink
|
108
108
|
|
data/lib/deb/s3/package.rb
CHANGED
@@ -3,6 +3,7 @@ require "digest/sha2"
|
|
3
3
|
require "digest/md5"
|
4
4
|
require "socket"
|
5
5
|
require "tmpdir"
|
6
|
+
require 'deb/s3/utils'
|
6
7
|
|
7
8
|
class Deb::S3::Package
|
8
9
|
include Deb::S3::Utils
|
@@ -57,11 +58,23 @@ class Deb::S3::Package
|
|
57
58
|
end
|
58
59
|
|
59
60
|
def extract_control(package)
|
60
|
-
if system("which dpkg
|
61
|
+
if system("which dpkg &> /dev/null")
|
61
62
|
`dpkg -f #{package}`
|
62
63
|
else
|
64
|
+
# ar fails to find the control.tar.gz tarball within the .deb
|
65
|
+
# on Mac OS. Try using ar to list the control file, if found,
|
66
|
+
# use ar to extract, otherwise attempt with tar which works on OS X.
|
67
|
+
extract_control_tarball_cmd = "ar p #{package} control.tar.gz"
|
68
|
+
|
69
|
+
begin
|
70
|
+
safesystem("ar t #{package} control.tar.gz &> /dev/null")
|
71
|
+
rescue SafeSystemError
|
72
|
+
warn "Failed to find control data in .deb with ar, trying tar."
|
73
|
+
extract_control_tarball_cmd = "tar zxf #{package} --to-stdout control.tar.gz"
|
74
|
+
end
|
75
|
+
|
63
76
|
Dir.mktmpdir do |path|
|
64
|
-
safesystem("
|
77
|
+
safesystem("#{extract_control_tarball_cmd} | tar -zxf - -C #{path}")
|
65
78
|
File.read(File.join(path, "control"))
|
66
79
|
end
|
67
80
|
end
|
@@ -111,6 +124,11 @@ class Deb::S3::Package
|
|
111
124
|
@needs_uploading = false
|
112
125
|
end
|
113
126
|
|
127
|
+
def full_version
|
128
|
+
return nil if [epoch, version, iteration].all?(&:nil?)
|
129
|
+
[[epoch, version].compact.join(":"), iteration].compact.join("-")
|
130
|
+
end
|
131
|
+
|
114
132
|
def filename=(f)
|
115
133
|
@filename = f
|
116
134
|
@needs_uploading = true
|
data/lib/deb/s3/release.rb
CHANGED
@@ -86,7 +86,7 @@ class Deb::S3::Release
|
|
86
86
|
release_tmp.puts self.generate
|
87
87
|
release_tmp.close
|
88
88
|
yield self.filename if block_given?
|
89
|
-
s3_store(release_tmp.path, self.filename)
|
89
|
+
s3_store(release_tmp.path, self.filename, 'text/plain; charset=us-ascii')
|
90
90
|
|
91
91
|
# sign the file, if necessary
|
92
92
|
if Deb::S3::Utils.signing_key
|
@@ -96,7 +96,7 @@ class Deb::S3::Release
|
|
96
96
|
remote_file = self.filename+".gpg"
|
97
97
|
yield remote_file if block_given?
|
98
98
|
raise "Unable to locate Release signature file" unless File.exists?(local_file)
|
99
|
-
s3_store(local_file, remote_file)
|
99
|
+
s3_store(local_file, remote_file, 'application/pgp-signature; charset=us-ascii')
|
100
100
|
File.unlink(local_file)
|
101
101
|
else
|
102
102
|
raise "Signing the Release file failed."
|
data/lib/deb/s3/utils.rb
CHANGED
@@ -18,10 +18,12 @@ module Deb::S3::Utils
|
|
18
18
|
def prefix; @prefix end
|
19
19
|
def prefix= v; @prefix = v end
|
20
20
|
|
21
|
+
class SafeSystemError < RuntimeError; end
|
22
|
+
|
21
23
|
def safesystem(*args)
|
22
24
|
success = system(*args)
|
23
25
|
if !success
|
24
|
-
raise "'system(#{args.inspect})' failed with error code: #{$?.exitstatus}"
|
26
|
+
raise SafeSystemError, "'system(#{args.inspect})' failed with error code: #{$?.exitstatus}"
|
25
27
|
end
|
26
28
|
return success
|
27
29
|
end
|
@@ -58,7 +60,7 @@ module Deb::S3::Utils
|
|
58
60
|
Deb::S3::Utils.s3.buckets[Deb::S3::Utils.bucket].objects[s3_path(path)].read
|
59
61
|
end
|
60
62
|
|
61
|
-
def s3_store(path, filename=nil)
|
63
|
+
def s3_store(path, filename=nil, content_type='application/octet-stream; charset=binary')
|
62
64
|
filename = File.basename(path) unless filename
|
63
65
|
obj = Deb::S3::Utils.s3.buckets[Deb::S3::Utils.bucket].objects[s3_path(filename)]
|
64
66
|
|
@@ -69,7 +71,7 @@ module Deb::S3::Utils
|
|
69
71
|
end
|
70
72
|
|
71
73
|
# upload the file
|
72
|
-
obj.write(Pathname.new(path), :acl => Deb::S3::Utils.access_policy)
|
74
|
+
obj.write(Pathname.new(path), :acl => Deb::S3::Utils.access_policy, :content_type => content_type)
|
73
75
|
end
|
74
76
|
|
75
77
|
def s3_remove(path)
|
metadata
CHANGED
@@ -1,20 +1,18 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: deb-s3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
5
|
-
prerelease:
|
4
|
+
version: 0.6.1
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Ken Robertson
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-04-25 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: thor
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ~>
|
20
18
|
- !ruby/object:Gem::Version
|
@@ -22,7 +20,6 @@ dependencies:
|
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
24
|
- - ~>
|
28
25
|
- !ruby/object:Gem::Version
|
@@ -30,7 +27,6 @@ dependencies:
|
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: aws-sdk
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
31
|
- - ~>
|
36
32
|
- !ruby/object:Gem::Version
|
@@ -38,11 +34,38 @@ dependencies:
|
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
38
|
- - ~>
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: '1.18'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
46
69
|
description: Easily create and manage an APT repository on S3.
|
47
70
|
email: ken@invalidlogic.com
|
48
71
|
executables:
|
@@ -51,37 +74,36 @@ extensions: []
|
|
51
74
|
extra_rdoc_files: []
|
52
75
|
files:
|
53
76
|
- bin/deb-s3
|
77
|
+
- README.md
|
78
|
+
- lib/deb/s3/release.rb
|
79
|
+
- lib/deb/s3/package.rb
|
80
|
+
- lib/deb/s3/utils.rb
|
54
81
|
- lib/deb/s3/cli.rb
|
55
82
|
- lib/deb/s3/manifest.rb
|
56
|
-
- lib/deb/s3/package.rb
|
57
|
-
- lib/deb/s3/release.rb
|
58
|
-
- lib/deb/s3/templates/package.erb
|
59
83
|
- lib/deb/s3/templates/release.erb
|
60
|
-
- lib/deb/s3/
|
84
|
+
- lib/deb/s3/templates/package.erb
|
61
85
|
- lib/deb/s3.rb
|
62
|
-
- README.md
|
63
86
|
homepage: http://invalidlogic.com/
|
64
87
|
licenses: []
|
88
|
+
metadata: {}
|
65
89
|
post_install_message:
|
66
90
|
rdoc_options: []
|
67
91
|
require_paths:
|
68
92
|
- lib
|
69
93
|
required_ruby_version: !ruby/object:Gem::Requirement
|
70
|
-
none: false
|
71
94
|
requirements:
|
72
|
-
- -
|
95
|
+
- - '>='
|
73
96
|
- !ruby/object:Gem::Version
|
74
97
|
version: '0'
|
75
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
76
|
-
none: false
|
77
99
|
requirements:
|
78
|
-
- -
|
100
|
+
- - '>='
|
79
101
|
- !ruby/object:Gem::Version
|
80
102
|
version: '0'
|
81
103
|
requirements: []
|
82
104
|
rubyforge_project:
|
83
|
-
rubygems_version:
|
105
|
+
rubygems_version: 2.0.14
|
84
106
|
signing_key:
|
85
|
-
specification_version:
|
107
|
+
specification_version: 4
|
86
108
|
summary: Easily create and manage an APT repository on S3.
|
87
109
|
test_files: []
|