right_publish 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1,3 @@
1
+ .idea
2
+ .ruby-version
3
+ .rvmrc
data/Rakefile CHANGED
@@ -33,6 +33,7 @@ end
33
33
  require 'jeweler'
34
34
  Jeweler::Tasks.new do |gem|
35
35
  # gem is a Gem::Specification; see http://docs.rubygems.org/read/chapter/20 for more options
36
+ Rake.application.jeweler_tasks.jeweler.commit = false
36
37
  gem.name = "right_publish"
37
38
  gem.homepage = "https://github.com/rightscale/right_publish"
38
39
  gem.license = "Proprietary"
@@ -40,6 +41,7 @@ Jeweler::Tasks.new do |gem|
40
41
  gem.description = %Q{A tool for maintaining S3-based DEB, GEM and RPM packages.}
41
42
  gem.email = "support@rightscale.com"
42
43
  gem.authors = ['Brian Szmyd', 'Tony Spataro']
44
+ gem.files = `git ls-files`.split("\n")
43
45
  end
44
46
  Jeweler::RubygemsDotOrgTasks.new
45
47
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -148,3 +148,4 @@ end
148
148
  require 'right_publish/repos/apt'
149
149
  require 'right_publish/repos/gem'
150
150
  require 'right_publish/repos/yum'
151
+ require 'right_publish/repos/zypp'
@@ -55,6 +55,7 @@ module RightPublish
55
55
  # Rebuild the yum index'
56
56
  repo_updates.each_key do |repo_path|
57
57
  regen_metadata( repo_path )
58
+ sign_metadata( repo_path )
58
59
  end
59
60
 
60
61
  # Commit back to remote storage
@@ -148,7 +149,11 @@ module RightPublish
148
149
  do_in_subdir(repo_path) do
149
150
  exit_val = system('createrepo --update -o $(pwd) $(pwd) 2>&1 >/dev/null')
150
151
  raise Exception, "yum regen_metadata failed; cannot continue publishing" unless exit_val
152
+ end
153
+ end
151
154
 
155
+ def sign_metadata(repo_path)
156
+ do_in_subdir(repo_path) do
152
157
  if repo_config[:gpg_key_id]
153
158
  File.unlink("repodata/repomd.xml.asc") if File.exists?("repodata/repomd.xml.asc")
154
159
  exit_val = system("gpg -a --batch --passphrase '#{repo_config[:gpg_password]}' --detach-sign repodata/repomd.xml")
@@ -0,0 +1,84 @@
1
+ require 'nokogiri'
2
+ require 'digest/sha1'
3
+ require 'zlib'
4
+
5
+ module RightPublish
6
+ class ZyppRepo < YumRepo
7
+ REPO_KEY = :zypp_repo
8
+
9
+ private
10
+ def regen_metadata(repo_path)
11
+ super(repo_path)
12
+ do_in_subdir(repo_path) do
13
+ SuseMetadata.new.add
14
+ end
15
+ end
16
+
17
+ class Package
18
+ attr_reader :checksum
19
+ attr_reader :name
20
+ attr_reader :arch
21
+ attr_reader :ver
22
+ attr_reader :rel
23
+
24
+ def initialize(rpmfile)
25
+ @checksum = Digest::SHA1.hexdigest(File.new(rpmfile).read)
26
+ rpm = File.basename(rpmfile, ".rpm")
27
+ rpm, _, @arch = rpm.rpartition(".")
28
+ rpm, _,@rel = rpm.rpartition("-")
29
+ @name, _,@ver = rpm.rpartition("-")
30
+ end
31
+ end
32
+
33
+ # http://en.opensuse.org/openSUSE:Standards_Rpm_Metadata#SUSE_primary_data_.28susedata.xml.29.2C_extensions_to_primary.xml
34
+ class SuseMetadata
35
+ def initialize
36
+ @packages = Dir["*.rpm"].map { |rpmfile| Package.new(rpmfile) }
37
+ end
38
+
39
+ def href
40
+ "repodata/susedata.xml.gz"
41
+ end
42
+
43
+ def suse_data
44
+ @suse_data ||= Nokogiri::XML::Builder.new do |xml|
45
+ xml.susedata("packages" => @packages.length) do |susedata|
46
+ @packages.each do |package|
47
+ susedata.package('pkgid' => package.checksum, 'name' => package.name) do |pkg|
48
+ pkg.version('ver' => package.ver, 'rel' => package.rel, 'arch' => package.arch, 'epoch' => 0)
49
+ pkg.keyword("support_l3")
50
+ end
51
+ end
52
+ end
53
+ end.to_xml
54
+ end
55
+
56
+ def create
57
+ susedata_file = File.join("repodata", "susedata.xml.gz")
58
+ Zlib::GzipWriter.open(susedata_file) { |file| file.write(suse_data) }
59
+ @checksum = Digest::SHA256.hexdigest(File.open(susedata_file).read)
60
+ @open_checksum = Digest::SHA256.hexdigest(suse_data)
61
+ end
62
+
63
+ def update_repomd
64
+ repomd = File.join("repodata", "repomd.xml")
65
+ doc = Nokogiri::XML(File.open(repomd))
66
+ Nokogiri::XML::Builder.with(doc.at_css("repomd")) do |xml|
67
+ xml.data('type' => 'susedata') do |data|
68
+ data.timestamp(File.ctime(href).to_i)
69
+ data.checksum({ 'type' => 'sha256' }, @checksum)
70
+ data.location('href' => href)
71
+ data.send(:"open-checksum", { 'type' => 'sha256' }, @open_checksum)
72
+ end
73
+ end
74
+ File.open(repomd, "w") { |f| doc.write_xml_to f }
75
+ end
76
+
77
+ def add
78
+ create
79
+ update_repomd
80
+ end
81
+ end
82
+ end
83
+ RightPublish::RepoManager.register_repo(ZyppRepo)
84
+ end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "right_publish"
8
- s.version = "0.2.1"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Szmyd", "Tony Spataro"]
12
- s.date = "2013-07-24"
12
+ s.date = "2013-08-12"
13
13
  s.description = "A tool for maintaining S3-based DEB, GEM and RPM packages."
14
14
  s.email = "support@rightscale.com"
15
15
  s.executables = ["autosign.expect", "right_publish"]
@@ -17,6 +17,7 @@ Gem::Specification.new do |s|
17
17
  "README.rdoc"
18
18
  ]
19
19
  s.files = [
20
+ ".gitignore",
20
21
  ".rspec",
21
22
  "Gemfile",
22
23
  "Gemfile.lock",
@@ -31,6 +32,7 @@ Gem::Specification.new do |s|
31
32
  "lib/right_publish/repos/apt.rb",
32
33
  "lib/right_publish/repos/gem.rb",
33
34
  "lib/right_publish/repos/yum.rb",
35
+ "lib/right_publish/repos/zypp.rb",
34
36
  "lib/right_publish/storage.rb",
35
37
  "lib/right_publish/stores/local.rb",
36
38
  "lib/right_publish/stores/s3.rb",
@@ -49,7 +51,7 @@ Gem::Specification.new do |s|
49
51
  s.homepage = "https://github.com/rightscale/right_publish"
50
52
  s.licenses = ["Proprietary"]
51
53
  s.require_paths = ["lib"]
52
- s.rubygems_version = "1.8.15"
54
+ s.rubygems_version = "1.8.24"
53
55
  s.summary = "Package publishing and indexing tool"
54
56
 
55
57
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: right_publish
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Szmyd
@@ -16,10 +16,12 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2013-07-24 00:00:00 Z
19
+ date: 2013-08-12 00:00:00 Z
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
- version_requirements: &id001 !ruby/object:Gem::Requirement
22
+ name: builder
23
+ prerelease: false
24
+ requirement: &id001 !ruby/object:Gem::Requirement
23
25
  none: false
24
26
  requirements:
25
27
  - - ">="
@@ -29,11 +31,11 @@ dependencies:
29
31
  - 0
30
32
  version: "0"
31
33
  type: :runtime
32
- requirement: *id001
33
- prerelease: false
34
- name: builder
34
+ version_requirements: *id001
35
35
  - !ruby/object:Gem::Dependency
36
- version_requirements: &id002 !ruby/object:Gem::Requirement
36
+ name: fog
37
+ prerelease: false
38
+ requirement: &id002 !ruby/object:Gem::Requirement
37
39
  none: false
38
40
  requirements:
39
41
  - - ~>
@@ -44,11 +46,11 @@ dependencies:
44
46
  - 9
45
47
  version: "1.9"
46
48
  type: :runtime
47
- requirement: *id002
48
- prerelease: false
49
- name: fog
49
+ version_requirements: *id002
50
50
  - !ruby/object:Gem::Dependency
51
- version_requirements: &id003 !ruby/object:Gem::Requirement
51
+ name: trollop
52
+ prerelease: false
53
+ requirement: &id003 !ruby/object:Gem::Requirement
52
54
  none: false
53
55
  requirements:
54
56
  - - ~>
@@ -59,11 +61,11 @@ dependencies:
59
61
  - 0
60
62
  version: "2.0"
61
63
  type: :runtime
62
- requirement: *id003
63
- prerelease: false
64
- name: trollop
64
+ version_requirements: *id003
65
65
  - !ruby/object:Gem::Dependency
66
- version_requirements: &id004 !ruby/object:Gem::Requirement
66
+ name: rake
67
+ prerelease: false
68
+ requirement: &id004 !ruby/object:Gem::Requirement
67
69
  none: false
68
70
  requirements:
69
71
  - - ~>
@@ -74,11 +76,11 @@ dependencies:
74
76
  - 9
75
77
  version: "0.9"
76
78
  type: :development
77
- requirement: *id004
78
- prerelease: false
79
- name: rake
79
+ version_requirements: *id004
80
80
  - !ruby/object:Gem::Dependency
81
- version_requirements: &id005 !ruby/object:Gem::Requirement
81
+ name: jeweler
82
+ prerelease: false
83
+ requirement: &id005 !ruby/object:Gem::Requirement
82
84
  none: false
83
85
  requirements:
84
86
  - - ~>
@@ -90,11 +92,11 @@ dependencies:
90
92
  - 3
91
93
  version: 1.8.3
92
94
  type: :development
93
- requirement: *id005
94
- prerelease: false
95
- name: jeweler
95
+ version_requirements: *id005
96
96
  - !ruby/object:Gem::Dependency
97
- version_requirements: &id006 !ruby/object:Gem::Requirement
97
+ name: right_develop
98
+ prerelease: false
99
+ requirement: &id006 !ruby/object:Gem::Requirement
98
100
  none: false
99
101
  requirements:
100
102
  - - ~>
@@ -105,11 +107,11 @@ dependencies:
105
107
  - 0
106
108
  version: "1.0"
107
109
  type: :development
108
- requirement: *id006
109
- prerelease: false
110
- name: right_develop
110
+ version_requirements: *id006
111
111
  - !ruby/object:Gem::Dependency
112
- version_requirements: &id007 !ruby/object:Gem::Requirement
112
+ name: rdoc
113
+ prerelease: false
114
+ requirement: &id007 !ruby/object:Gem::Requirement
113
115
  none: false
114
116
  requirements:
115
117
  - - ">="
@@ -121,11 +123,11 @@ dependencies:
121
123
  - 2
122
124
  version: 2.4.2
123
125
  type: :development
124
- requirement: *id007
125
- prerelease: false
126
- name: rdoc
126
+ version_requirements: *id007
127
127
  - !ruby/object:Gem::Dependency
128
- version_requirements: &id008 !ruby/object:Gem::Requirement
128
+ name: rspec
129
+ prerelease: false
130
+ requirement: &id008 !ruby/object:Gem::Requirement
129
131
  none: false
130
132
  requirements:
131
133
  - - ~>
@@ -136,11 +138,11 @@ dependencies:
136
138
  - 0
137
139
  version: "2.0"
138
140
  type: :development
139
- requirement: *id008
140
- prerelease: false
141
- name: rspec
141
+ version_requirements: *id008
142
142
  - !ruby/object:Gem::Dependency
143
- version_requirements: &id009 !ruby/object:Gem::Requirement
143
+ name: flexmock
144
+ prerelease: false
145
+ requirement: &id009 !ruby/object:Gem::Requirement
144
146
  none: false
145
147
  requirements:
146
148
  - - ~>
@@ -151,11 +153,11 @@ dependencies:
151
153
  - 9
152
154
  version: "0.9"
153
155
  type: :development
154
- requirement: *id009
155
- prerelease: false
156
- name: flexmock
156
+ version_requirements: *id009
157
157
  - !ruby/object:Gem::Dependency
158
- version_requirements: &id010 !ruby/object:Gem::Requirement
158
+ name: simplecov
159
+ prerelease: false
160
+ requirement: &id010 !ruby/object:Gem::Requirement
159
161
  none: false
160
162
  requirements:
161
163
  - - ">="
@@ -165,11 +167,11 @@ dependencies:
165
167
  - 0
166
168
  version: "0"
167
169
  type: :development
168
- requirement: *id010
169
- prerelease: false
170
- name: simplecov
170
+ version_requirements: *id010
171
171
  - !ruby/object:Gem::Dependency
172
- version_requirements: &id011 !ruby/object:Gem::Requirement
172
+ name: ruby-debug
173
+ prerelease: false
174
+ requirement: &id011 !ruby/object:Gem::Requirement
173
175
  none: false
174
176
  requirements:
175
177
  - - ">="
@@ -180,11 +182,11 @@ dependencies:
180
182
  - 10
181
183
  version: "0.10"
182
184
  type: :development
183
- requirement: *id011
184
- prerelease: false
185
- name: ruby-debug
185
+ version_requirements: *id011
186
186
  - !ruby/object:Gem::Dependency
187
- version_requirements: &id012 !ruby/object:Gem::Requirement
187
+ name: ruby-debug19
188
+ prerelease: false
189
+ requirement: &id012 !ruby/object:Gem::Requirement
188
190
  none: false
189
191
  requirements:
190
192
  - - ">="
@@ -196,9 +198,7 @@ dependencies:
196
198
  - 6
197
199
  version: 0.11.6
198
200
  type: :development
199
- requirement: *id012
200
- prerelease: false
201
- name: ruby-debug19
201
+ version_requirements: *id012
202
202
  description: A tool for maintaining S3-based DEB, GEM and RPM packages.
203
203
  email: support@rightscale.com
204
204
  executables:
@@ -209,6 +209,7 @@ extensions: []
209
209
  extra_rdoc_files:
210
210
  - README.rdoc
211
211
  files:
212
+ - .gitignore
212
213
  - .rspec
213
214
  - Gemfile
214
215
  - Gemfile.lock
@@ -223,6 +224,7 @@ files:
223
224
  - lib/right_publish/repos/apt.rb
224
225
  - lib/right_publish/repos/gem.rb
225
226
  - lib/right_publish/repos/yum.rb
227
+ - lib/right_publish/repos/zypp.rb
226
228
  - lib/right_publish/storage.rb
227
229
  - lib/right_publish/stores/local.rb
228
230
  - lib/right_publish/stores/s3.rb