deb-s3-x 0.7.1.1
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.
- checksums.yaml +15 -0
- data/README.md +126 -0
- data/bin/deb-s3 +9 -0
- data/lib/deb/s3.rb +6 -0
- data/lib/deb/s3/cli.rb +531 -0
- data/lib/deb/s3/manifest.rb +125 -0
- data/lib/deb/s3/package.rb +303 -0
- data/lib/deb/s3/release.rb +151 -0
- data/lib/deb/s3/templates/package.erb +66 -0
- data/lib/deb/s3/templates/release.erb +20 -0
- data/lib/deb/s3/utils.rb +92 -0
- metadata +109 -0
@@ -0,0 +1,66 @@
|
|
1
|
+
Package: <%= name %>
|
2
|
+
Version: <%= "#{epoch}:" if epoch %><%= version %><%= "-" + iteration.to_s if iteration %>
|
3
|
+
License: <%= license %>
|
4
|
+
Vendor: <%= vendor %>
|
5
|
+
Architecture: <%= architecture %>
|
6
|
+
Maintainer: <%= maintainer %>
|
7
|
+
Installed-Size: <%= attributes[:deb_installed_size] %>
|
8
|
+
<% if !dependencies.empty? and !attributes[:no_depends?] -%>
|
9
|
+
Depends: <%= dependencies.collect { |d| fix_dependency(d) }.flatten.join(", ") %>
|
10
|
+
<% end -%>
|
11
|
+
<% if attributes[:deb_conflicts] -%>
|
12
|
+
Conflicts: <%= attributes[:deb_conflicts] %>
|
13
|
+
<% end -%>
|
14
|
+
<% if attributes[:deb_breaks] -%>
|
15
|
+
Breaks: <%= attributes[:deb_breaks] %>
|
16
|
+
<% end -%>
|
17
|
+
<% if attributes[:deb_pre_depends] -%>
|
18
|
+
Pre-Depends: <%= attributes[:deb_pre_depends] %>
|
19
|
+
<% end -%>
|
20
|
+
<% if attributes[:deb_provides] -%>
|
21
|
+
<%# Turn each provides from 'foo = 123' to simply 'foo' because Debian :\ -%>
|
22
|
+
<%# http://www.debian.org/doc/debian-policy/ch-relationships.html -%>
|
23
|
+
Provides: <%= attributes[:deb_provides] %>
|
24
|
+
<% end -%>
|
25
|
+
<% if attributes[:deb_replaces] -%>
|
26
|
+
Replaces: <%= attributes[:deb_replaces] %>
|
27
|
+
<% end -%>
|
28
|
+
<% if attributes[:deb_recommends] -%>
|
29
|
+
Recommends: <%= attributes[:deb_recommends] %>
|
30
|
+
<% end -%>
|
31
|
+
<% if attributes[:deb_suggests] -%>
|
32
|
+
Suggests: <%= attributes[:deb_suggests] %>
|
33
|
+
<% end -%>
|
34
|
+
<% if attributes[:deb_enhances] -%>
|
35
|
+
Enhances: <%= attributes[:deb_enhances] %>
|
36
|
+
<% end -%>
|
37
|
+
Section: <%= category %>
|
38
|
+
<% if attributes[:deb_origin] -%>
|
39
|
+
Origin: <%= attributes[:deb_origin] %>
|
40
|
+
<% end -%>
|
41
|
+
Priority: <%= attributes[:deb_priority] %>
|
42
|
+
Homepage: <%= url or "http://nourlgiven.example.com/" %>
|
43
|
+
Filename: <%= url_filename_encoded %>
|
44
|
+
<% if size -%>
|
45
|
+
Size: <%= size %>
|
46
|
+
<% end -%>
|
47
|
+
<% if sha1 -%>
|
48
|
+
SHA1: <%= sha1 %>
|
49
|
+
<% end -%>
|
50
|
+
<% if sha256 -%>
|
51
|
+
SHA256: <%= sha256 %>
|
52
|
+
<% end -%>
|
53
|
+
<% if md5 -%>
|
54
|
+
MD5sum: <%= md5 %>
|
55
|
+
<% end -%>
|
56
|
+
<% lines = (description or "no description given").split("\n") -%>
|
57
|
+
<% firstline, *remainder = lines -%>
|
58
|
+
Description: <%= firstline %>
|
59
|
+
<% if remainder.any? -%>
|
60
|
+
<%= remainder.collect { |l| l =~ /^ *$/ ? " ." : " #{l}" }.join("\n") %>
|
61
|
+
<% end -%>
|
62
|
+
<% if attributes[:deb_field] -%>
|
63
|
+
<% attributes[:deb_field].each do |field, value| -%>
|
64
|
+
<%= field %>: <%= value %>
|
65
|
+
<% end -%>
|
66
|
+
<% end -%>
|
@@ -0,0 +1,20 @@
|
|
1
|
+
<% if origin -%>
|
2
|
+
Origin: <%= origin %>
|
3
|
+
<% end -%>
|
4
|
+
Codename: <%= codename %>
|
5
|
+
Date: <%= Time.now.utc.strftime("%a, %d %b %Y %T %Z") %>
|
6
|
+
Architectures: <%= architectures.join(" ") %>
|
7
|
+
Components: <%= components.join(" ") %>
|
8
|
+
Suite: <%= suite %>
|
9
|
+
MD5Sum:
|
10
|
+
<% files.sort.each do |f,p| -%>
|
11
|
+
<%= p[:md5] %> <%= p[:size].to_s.rjust(16) %> <%= f %>
|
12
|
+
<% end -%>
|
13
|
+
SHA1:
|
14
|
+
<% files.sort.each do |f,p| -%>
|
15
|
+
<%= p[:sha1] %> <%= p[:size].to_s.rjust(16) %> <%= f %>
|
16
|
+
<% end -%>
|
17
|
+
SHA256:
|
18
|
+
<% files.sort.each do |f,p| -%>
|
19
|
+
<%= p[:sha256] %> <%= p[:size].to_s.rjust(16) %> <%= f %>
|
20
|
+
<% end -%>
|
data/lib/deb/s3/utils.rb
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
require "base64"
|
3
|
+
require "digest/md5"
|
4
|
+
require "erb"
|
5
|
+
require "tmpdir"
|
6
|
+
|
7
|
+
module Deb::S3::Utils
|
8
|
+
module_function
|
9
|
+
def s3; @s3 end
|
10
|
+
def s3= v; @s3 = v end
|
11
|
+
def bucket; @bucket end
|
12
|
+
def bucket= v; @bucket = v end
|
13
|
+
def access_policy; @access_policy end
|
14
|
+
def access_policy= v; @access_policy = v end
|
15
|
+
def signing_key; @signing_key end
|
16
|
+
def signing_key= v; @signing_key = v end
|
17
|
+
def gpg_options; @gpg_options end
|
18
|
+
def gpg_options= v; @gpg_options = v end
|
19
|
+
def prefix; @prefix end
|
20
|
+
def prefix= v; @prefix = v end
|
21
|
+
def encryption; @encryption end
|
22
|
+
def encryption= v; @encryption = v end
|
23
|
+
|
24
|
+
class SafeSystemError < RuntimeError; end
|
25
|
+
|
26
|
+
def safesystem(*args)
|
27
|
+
success = system(*args)
|
28
|
+
if !success
|
29
|
+
raise SafeSystemError, "'system(#{args.inspect})' failed with error code: #{$?.exitstatus}"
|
30
|
+
end
|
31
|
+
return success
|
32
|
+
end
|
33
|
+
|
34
|
+
def debianize_op(op)
|
35
|
+
# Operators in debian packaging are <<, <=, =, >= and >>
|
36
|
+
# So any operator like < or > must be replaced
|
37
|
+
{:< => "<<", :> => ">>"}[op.to_sym] or op
|
38
|
+
end
|
39
|
+
|
40
|
+
def template(path)
|
41
|
+
template_file = File.join(File.dirname(__FILE__), "templates", path)
|
42
|
+
template_code = File.read(template_file)
|
43
|
+
ERB.new(template_code, nil, "-")
|
44
|
+
end
|
45
|
+
|
46
|
+
def s3_path(path)
|
47
|
+
File.join(*[Deb::S3::Utils.prefix, path].compact)
|
48
|
+
end
|
49
|
+
|
50
|
+
# from fog, Fog::AWS.escape
|
51
|
+
def s3_escape(string)
|
52
|
+
string.gsub(/([^a-zA-Z0-9_.\-~+]+)/) {
|
53
|
+
"%" + $1.unpack("H2" * $1.bytesize).join("%").upcase
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
57
|
+
def s3_exists?(path)
|
58
|
+
Deb::S3::Utils.s3.buckets[Deb::S3::Utils.bucket].objects[s3_path(path)].exists?
|
59
|
+
end
|
60
|
+
|
61
|
+
def s3_read(path)
|
62
|
+
return nil unless s3_exists?(path)
|
63
|
+
Deb::S3::Utils.s3.buckets[Deb::S3::Utils.bucket].objects[s3_path(path)].read
|
64
|
+
end
|
65
|
+
|
66
|
+
def s3_store(path, filename=nil, content_type='application/octet-stream; charset=binary', cache_control=nil)
|
67
|
+
filename = File.basename(path) unless filename
|
68
|
+
obj = Deb::S3::Utils.s3.buckets[Deb::S3::Utils.bucket].objects[s3_path(filename)]
|
69
|
+
|
70
|
+
file_md5 = Digest::MD5.file(path)
|
71
|
+
|
72
|
+
# check if the object already exists
|
73
|
+
if obj.exists?
|
74
|
+
return if (file_md5.to_s == obj.etag.gsub('"', '') or file_md5.to_s == obj.metadata['md5'])
|
75
|
+
end
|
76
|
+
|
77
|
+
options = {:acl => Deb::S3::Utils.access_policy, :content_type => content_type, :metadata => {'md5' => file_md5}}
|
78
|
+
if !cache_control.nil?
|
79
|
+
options[:cache_control] = cache_control
|
80
|
+
end
|
81
|
+
|
82
|
+
# specify if encryption is required
|
83
|
+
options[:server_side_encryption] = :aes256 if Deb::S3::Utils.encryption
|
84
|
+
|
85
|
+
# upload the file
|
86
|
+
obj.write(Pathname.new(path), options)
|
87
|
+
end
|
88
|
+
|
89
|
+
def s3_remove(path)
|
90
|
+
Deb::S3::Utils.s3.buckets[Deb::S3::Utils.bucket].objects[s3_path(path)].delete if s3_exists?(path)
|
91
|
+
end
|
92
|
+
end
|
metadata
ADDED
@@ -0,0 +1,109 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: deb-s3-x
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.7.1.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- ! ' '
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-06-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: thor
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.18.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.18.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: aws-sdk
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '1.18'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ~>
|
39
|
+
- !ruby/object:Gem::Version
|
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'
|
69
|
+
description: Easily create and manage an APT repository on S3.
|
70
|
+
email:
|
71
|
+
executables:
|
72
|
+
- deb-s3
|
73
|
+
extensions: []
|
74
|
+
extra_rdoc_files: []
|
75
|
+
files:
|
76
|
+
- lib/deb/s3.rb
|
77
|
+
- lib/deb/s3/utils.rb
|
78
|
+
- lib/deb/s3/manifest.rb
|
79
|
+
- lib/deb/s3/cli.rb
|
80
|
+
- lib/deb/s3/package.rb
|
81
|
+
- lib/deb/s3/templates/package.erb
|
82
|
+
- lib/deb/s3/templates/release.erb
|
83
|
+
- lib/deb/s3/release.rb
|
84
|
+
- README.md
|
85
|
+
- bin/deb-s3
|
86
|
+
homepage:
|
87
|
+
licenses: []
|
88
|
+
metadata: {}
|
89
|
+
post_install_message:
|
90
|
+
rdoc_options: []
|
91
|
+
require_paths:
|
92
|
+
- lib
|
93
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ! '>='
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '0'
|
98
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - ! '>='
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: '0'
|
103
|
+
requirements: []
|
104
|
+
rubyforge_project:
|
105
|
+
rubygems_version: 2.1.11
|
106
|
+
signing_key:
|
107
|
+
specification_version: 4
|
108
|
+
summary: Easily create and manage an APT repository on S3.
|
109
|
+
test_files: []
|