packaging 0.99.65 → 0.99.66
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packaging/paths.rb +24 -7
- data/lib/packaging/util/ship.rb +30 -18
- data/spec/lib/packaging/paths_spec.rb +12 -3
- data/tasks/ship.rake +19 -39
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47aedaa86f3b67d8c5c0dac793bdc7ba76098d59a69a371d686ad040a82bcad7
|
4
|
+
data.tar.gz: 46903f549c65511da61bc15448809e2442d8569b9cc7c318b3a44c9d1389a4a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a4f6a1f1135c242cb3561b609943a44715f9bbf45653f76548c2682819dbf14c1a1f1909380a70b7c5b054eebbd871c0572760c8d76e104fae19b9fedb330d5
|
7
|
+
data.tar.gz: 69bb9b00a3e3711911fc98a4b68d175f9e79553e4c100db4a02ab4e57be3a6ed71c00b0014b19ff5ef5c30c22796e22db73efff32f9775ddf05b9204c12c6885
|
data/lib/packaging/paths.rb
CHANGED
@@ -151,7 +151,7 @@ module Pkg::Paths
|
|
151
151
|
when 'dmg'
|
152
152
|
return File.join(prefix, 'mac', link)
|
153
153
|
when 'msi'
|
154
|
-
return File.join(prefix,
|
154
|
+
return File.join(prefix, platform_name, link)
|
155
155
|
else
|
156
156
|
raise "Error: Unknown package format '#{package_format}'"
|
157
157
|
end
|
@@ -261,16 +261,33 @@ module Pkg::Paths
|
|
261
261
|
end
|
262
262
|
end
|
263
263
|
|
264
|
-
def remote_repo_base(platform_tag, nonfinal
|
265
|
-
|
266
|
-
|
264
|
+
def remote_repo_base(platform_tag = nil, nonfinal: false, package_format: nil)
|
265
|
+
if platform_tag.nil? && package_format.nil?
|
266
|
+
raise "Pkg::Paths.remote_repo_base must have `platform_tag` or `package_format` specified."
|
267
|
+
end
|
268
|
+
|
269
|
+
package_format ||= Pkg::Platforms.package_format_for_tag(platform_tag)
|
270
|
+
|
271
|
+
repo_base = case package_format
|
267
272
|
when 'rpm'
|
268
273
|
nonfinal ? Pkg::Config.nonfinal_yum_repo_path : Pkg::Config.yum_repo_path
|
269
274
|
when 'deb'
|
270
275
|
nonfinal ? Pkg::Config.nonfinal_apt_repo_path : Pkg::Config.apt_repo_path
|
276
|
+
when 'dmg'
|
277
|
+
nonfinal ? Pkg::Config.nonfinal_dmg_path : Pkg::Config.dmg_path
|
278
|
+
when 'swix'
|
279
|
+
nonfinal ? Pkg::Config.nonfinal_swix_path : Pkg::Config.swix_path
|
280
|
+
when 'msi'
|
281
|
+
nonfinal ? Pkg::Config.nonfinal_msi_path : Pkg::Config.msi_path
|
271
282
|
else
|
272
283
|
raise "Can't determine remote repo base path for package format '#{package_format}'."
|
273
284
|
end
|
285
|
+
|
286
|
+
# normalize the path for things shipping to the downloads server
|
287
|
+
if repo_base.match(/^\/opt\/downloads\/\w+$/)
|
288
|
+
repo_base = '/opt/downloads'
|
289
|
+
end
|
290
|
+
repo_base
|
274
291
|
end
|
275
292
|
|
276
293
|
# This is where deb packages end up after freight repo updates
|
@@ -278,7 +295,7 @@ module Pkg::Paths
|
|
278
295
|
fail "Can't determine path for non-debian platform #{platform_tag}." unless Pkg::Platforms.package_format_for_tag(platform_tag) == 'deb'
|
279
296
|
platform, version, _ = Pkg::Platforms.parse_platform_tag(platform_tag)
|
280
297
|
codename = Pkg::Platforms.codename_for_platform_version(platform, version)
|
281
|
-
return File.join(remote_repo_base(platform_tag, nonfinal), 'pool', codename, repo_name, project[0], project)
|
298
|
+
return File.join(remote_repo_base(platform_tag, nonfinal: nonfinal), 'pool', codename, repo_name, project[0], project)
|
282
299
|
end
|
283
300
|
|
284
301
|
def release_package_link_path(platform_tag, nonfinal = false)
|
@@ -286,10 +303,10 @@ module Pkg::Paths
|
|
286
303
|
package_format = Pkg::Platforms.package_format_for_tag(platform_tag)
|
287
304
|
case package_format
|
288
305
|
when 'rpm'
|
289
|
-
return File.join(remote_repo_base(platform_tag, nonfinal), "#{repo_name(nonfinal)}-release-#{platform}-#{version}.noarch.rpm")
|
306
|
+
return File.join(remote_repo_base(platform_tag, nonfinal: nonfinal), "#{repo_name(nonfinal)}-release-#{platform}-#{version}.noarch.rpm")
|
290
307
|
when 'deb'
|
291
308
|
codename = Pkg::Platforms.codename_for_platform_version(platform, version)
|
292
|
-
return File.join(remote_repo_base(platform_tag, nonfinal), "#{repo_name(nonfinal)}-release-#{codename}.deb")
|
309
|
+
return File.join(remote_repo_base(platform_tag, nonfinal: nonfinal), "#{repo_name(nonfinal)}-release-#{codename}.deb")
|
293
310
|
else
|
294
311
|
warn "No release packages for package format '#{package_format}', skipping . . ."
|
295
312
|
return nil
|
data/lib/packaging/util/ship.rb
CHANGED
@@ -106,22 +106,11 @@ module Pkg::Util::Ship
|
|
106
106
|
|
107
107
|
def ship_rpms(local_staging_directory, remote_path, opts = {})
|
108
108
|
ship_pkgs(["#{local_staging_directory}/**/*.rpm", "#{local_staging_directory}/**/*.srpm"], Pkg::Config.yum_staging_server, remote_path, opts)
|
109
|
-
|
110
|
-
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('el'), Pkg::Config.yum_staging_server, remote_path, opts[:nonfinal])
|
111
109
|
end
|
112
110
|
|
113
111
|
def ship_debs(local_staging_directory, remote_path, opts = {})
|
114
112
|
ship_pkgs(["#{local_staging_directory}/**/*.debian.tar.gz", "#{local_staging_directory}/**/*.orig.tar.gz" "#{local_staging_directory}/**/*.dsc", "#{local_staging_directory}/**/*.deb", "#{local_staging_directory}/**/*.changes"], Pkg::Config.apt_signing_server, remote_path, opts)
|
115
113
|
|
116
|
-
# We need to iterate through all the supported platforms here because of
|
117
|
-
# how deb repos are set up. Each codename will have its own link from the
|
118
|
-
# current versioned repo (e.g. puppet5) to the rolling repo. The one thing
|
119
|
-
# we don't care about is architecture, so we just grab the first supported
|
120
|
-
# architecture for the code name we're working with at the moment. [written
|
121
|
-
# by Melissa, copied by Molly]
|
122
|
-
Pkg::Platforms.codenames.each do |codename|
|
123
|
-
create_rolling_repo_link(Pkg::Platforms.codename_to_tags(codename)[0], Pkg::Config.apt_signing_server, remote_path, opts[:nonfinal])
|
124
|
-
end
|
125
114
|
end
|
126
115
|
|
127
116
|
def ship_svr4(local_staging_directory, remote_path, opts = {})
|
@@ -135,8 +124,6 @@ module Pkg::Util::Ship
|
|
135
124
|
def ship_dmg(local_staging_directory, remote_path, opts = {})
|
136
125
|
packages_have_shipped = ship_pkgs(["#{local_staging_directory}/**/*.dmg"], Pkg::Config.dmg_staging_server, remote_path, opts)
|
137
126
|
|
138
|
-
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('osx'), Pkg::Config.dmg_staging_server, remote_path, opts[:nonfinal])
|
139
|
-
|
140
127
|
if packages_have_shipped
|
141
128
|
Pkg::Platforms.platform_tags_for_package_format('dmg').each do |platform_tag|
|
142
129
|
# Create the latest symlink for the current supported repo
|
@@ -147,14 +134,11 @@ module Pkg::Util::Ship
|
|
147
134
|
|
148
135
|
def ship_swix(local_staging_directory, remote_path, opts = {})
|
149
136
|
ship_pkgs(["#{local_staging_directory}/**/*.swix"], Pkg::Config.swix_staging_server, remote_path, opts)
|
150
|
-
|
151
|
-
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('eos'), Pkg::Config.swix_staging_server, remote_path, opts[:nonfinal])
|
152
137
|
end
|
153
138
|
|
154
139
|
def ship_msi(local_staging_directory, remote_path, opts = {})
|
155
140
|
packages_have_shipped = ship_pkgs(["#{local_staging_directory}/**/*.msi"], Pkg::Config.msi_staging_server, remote_path, opts)
|
156
141
|
|
157
|
-
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('windows'), Pkg::Config.msi_staging_server, remote_path, opts[:nonfinal])
|
158
142
|
if packages_have_shipped
|
159
143
|
# Create the symlinks for the latest supported repo
|
160
144
|
Pkg::Util::Net.remote_create_latest_symlink(Pkg::Config.project, Pkg::Paths.artifacts_path(Pkg::Platforms.generic_platform_tag('windows'), remote_path, opts[:nonfinal]), 'msi', arch: 'x64')
|
@@ -205,7 +189,35 @@ module Pkg::Util::Ship
|
|
205
189
|
|
206
190
|
Pkg::Util::Net.remote_ssh_cmd(staging_server, command) unless command.nil?
|
207
191
|
rescue => e
|
208
|
-
fail "Failed to create rolling repo link for '#{platform_tag}'.\n#{e}"
|
192
|
+
fail "Failed to create rolling repo link for '#{platform_tag}'.\n#{e}\n#{e.backtrace}"
|
193
|
+
end
|
194
|
+
|
195
|
+
# create all of the rolling repo links in one step
|
196
|
+
def create_rolling_repo_links(nonfinal = false)
|
197
|
+
yum_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'rpm')
|
198
|
+
dmg_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'dmg')
|
199
|
+
swix_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'swix')
|
200
|
+
msi_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'msi')
|
201
|
+
|
202
|
+
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('el'), Pkg::Config.yum_staging_server, yum_path, nonfinal)
|
203
|
+
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('osx'), Pkg::Config.dmg_staging_server, dmg_path, nonfinal)
|
204
|
+
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('eos'), Pkg::Config.swix_staging_server, swix_path, nonfinal)
|
205
|
+
create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('windows'), Pkg::Config.msi_staging_server, msi_path, nonfinal)
|
206
|
+
|
207
|
+
# We need to iterate through all the supported platforms here because of
|
208
|
+
# how deb repos are set up. Each codename will have its own link from the
|
209
|
+
# current versioned repo (e.g. puppet5) to the rolling repo. The one thing
|
210
|
+
# we don't care about is architecture, so we just grab the first supported
|
211
|
+
# architecture for the code name we're working with at the moment. [written
|
212
|
+
# by Melissa, copied by Molly]
|
213
|
+
|
214
|
+
apt_path = Pkg::Config.apt_repo_staging_path
|
215
|
+
if nonfinal
|
216
|
+
apt_path = Pkg::Config.nonfinal_apt_repo_staging_path
|
217
|
+
end
|
218
|
+
Pkg::Platforms.codenames.each do |codename|
|
219
|
+
create_rolling_repo_link(Pkg::Platforms.codename_to_tags(codename)[0], Pkg::Config.apt_signing_server, apt_path, nonfinal)
|
220
|
+
end
|
209
221
|
end
|
210
222
|
|
211
223
|
def update_release_package_symlinks(local_staging_directory, nonfinal = false)
|
@@ -215,7 +227,7 @@ module Pkg::Util::Ship
|
|
215
227
|
package_format = Pkg::Platforms.package_format_for_tag(platform_tag)
|
216
228
|
case package_format
|
217
229
|
when 'rpm'
|
218
|
-
remote_base = Pkg::Paths.artifacts_path(platform_tag, Pkg::Paths.remote_repo_base(platform_tag, nonfinal), nonfinal)
|
230
|
+
remote_base = Pkg::Paths.artifacts_path(platform_tag, Pkg::Paths.remote_repo_base(platform_tag, nonfinal: nonfinal), nonfinal)
|
219
231
|
when 'deb'
|
220
232
|
remote_base = Pkg::Paths.apt_package_base_path(platform_tag, Pkg::Paths.repo_name(nonfinal), Pkg::Config.project, nonfinal)
|
221
233
|
else
|
@@ -213,6 +213,7 @@ describe 'Pkg::Paths' do
|
|
213
213
|
before :each do
|
214
214
|
allow(Pkg::Config).to receive(:yum_repo_path).and_return('foo')
|
215
215
|
allow(Pkg::Config).to receive(:apt_repo_path).and_return('bar')
|
216
|
+
allow(Pkg::Config).to receive(:dmg_path).and_return('/opt/downloads/mac')
|
216
217
|
allow(Pkg::Config).to receive(:nonfinal_yum_repo_path).and_return('foo-nightly')
|
217
218
|
allow(Pkg::Config).to receive(:nonfinal_apt_repo_path).and_return('bar-nightly')
|
218
219
|
end
|
@@ -223,13 +224,21 @@ describe 'Pkg::Paths' do
|
|
223
224
|
expect(Pkg::Paths.remote_repo_base('ubuntu-18.04-amd64')).to eq('bar')
|
224
225
|
end
|
225
226
|
it 'returns nonfinal_yum_repo_path for nonfinal rpms' do
|
226
|
-
expect(Pkg::Paths.remote_repo_base('fedora-31-x86_64', true)).to eq('foo-nightly')
|
227
|
+
expect(Pkg::Paths.remote_repo_base('fedora-31-x86_64', nonfinal: true)).to eq('foo-nightly')
|
227
228
|
end
|
228
229
|
it 'returns nonfinal_apt_repo_path for nonfinal debs' do
|
229
|
-
expect(Pkg::Paths.remote_repo_base('debian-9-amd64', true)).to eq('bar-nightly')
|
230
|
+
expect(Pkg::Paths.remote_repo_base('debian-9-amd64', nonfinal: true)).to eq('bar-nightly')
|
230
231
|
end
|
232
|
+
it 'fails if neither tag nor package_format is provided' do
|
233
|
+
expect { Pkg::Paths.remote_repo_base }.to raise_error(/Pkg::Paths.remote_repo_base must have/)
|
234
|
+
end
|
235
|
+
|
236
|
+
it 'returns /opt/downloads if the path is /opt/downloads/<something>' do
|
237
|
+
expect(Pkg::Paths.remote_repo_base(package_format: 'dmg')).to eq('/opt/downloads')
|
238
|
+
end
|
239
|
+
|
231
240
|
it 'fails for all other package formats' do
|
232
|
-
expect { Pkg::Paths.remote_repo_base('
|
241
|
+
expect { Pkg::Paths.remote_repo_base('solaris-11-i386') }.to raise_error(/Can't determine remote repo base path/)
|
233
242
|
end
|
234
243
|
end
|
235
244
|
|
data/tasks/ship.rake
CHANGED
@@ -368,46 +368,26 @@ namespace :pl do
|
|
368
368
|
|
369
369
|
desc "ship apple dmg to #{Pkg::Config.dmg_staging_server}"
|
370
370
|
task ship_dmg: 'pl:fetch' do
|
371
|
-
|
372
|
-
# removed, but only when we can successfully modify all instances of
|
373
|
-
# this to be set to '/opt/downloads'. In the meantime, we need to write
|
374
|
-
# this terrible workaround to ensure backward compatibility.
|
375
|
-
#
|
376
|
-
# I'm so sorry
|
377
|
-
# ~MAS 2017-08-14
|
378
|
-
if Pkg::Config.dmg_path == "/opt/downloads/mac"
|
379
|
-
path = "/opt/downloads"
|
380
|
-
else
|
381
|
-
path = Pkg::Config.dmg_path
|
382
|
-
end
|
371
|
+
path = Pkg::Paths.remote_repo_base(package_format: 'dmg')
|
383
372
|
Pkg::Util::Ship.ship_dmg('pkg', path)
|
384
373
|
end
|
385
374
|
|
386
375
|
desc "ship nightly apple dmgs to #{Pkg::Config.dmg_staging_server}"
|
387
376
|
task ship_nightly_dmg: 'pl:fetch' do
|
388
|
-
Pkg::
|
377
|
+
path = Pkg::Paths.remote_repo_base(package_format: 'dmg', nonfinal: true)
|
378
|
+
Pkg::Util::Ship.ship_dmg('pkg', path, nonfinal: true)
|
389
379
|
end
|
390
380
|
|
391
381
|
desc "ship Arista EOS swix packages and signatures to #{Pkg::Config.swix_staging_server}"
|
392
382
|
task ship_swix: 'pl:fetch' do
|
393
|
-
|
394
|
-
# removed, but only when we can successfully modify all instances of
|
395
|
-
# this to be set to '/opt/downloads'. In the meantime, we need to write
|
396
|
-
# this terrible workaround to ensure backward compatibility.
|
397
|
-
#
|
398
|
-
# I'm so sorry
|
399
|
-
# ~MAS 2017-08-14
|
400
|
-
if Pkg::Config.swix_path == "/opt/downloads/eos"
|
401
|
-
path = "/opt/downloads"
|
402
|
-
else
|
403
|
-
path = Pkg::Config.swix_path
|
404
|
-
end
|
383
|
+
path = Pkg::Paths.remote_repo_base(package_format: 'swix')
|
405
384
|
Pkg::Util::Ship.ship_swix('pkg', path)
|
406
385
|
end
|
407
386
|
|
408
387
|
desc "ship nightly Arista EOS swix packages and signatures to #{Pkg::Config.swix_staging_server}"
|
409
388
|
task ship_nightly_swix: 'pl:fetch' do
|
410
|
-
Pkg::
|
389
|
+
path = Pkg::Paths.remote_repo_base(package_format: 'swix', nonfinal: true)
|
390
|
+
Pkg::Util::Ship.ship_swix('pkg', path, nonfinal: true)
|
411
391
|
end
|
412
392
|
|
413
393
|
desc "ship tarball and signature to #{Pkg::Config.tar_staging_server}"
|
@@ -429,24 +409,14 @@ namespace :pl do
|
|
429
409
|
|
430
410
|
desc "Ship MSI packages to #{Pkg::Config.msi_staging_server}"
|
431
411
|
task ship_msi: 'pl:fetch' do
|
432
|
-
|
433
|
-
# removed, but only when we can successfully modify all instances of
|
434
|
-
# this to be set to '/opt/downloads'. In the meantime, we need to write
|
435
|
-
# this terrible workaround to ensure backward compatibility.
|
436
|
-
#
|
437
|
-
# I'm so sorry
|
438
|
-
# ~MAS 2017-08-14
|
439
|
-
if Pkg::Config.msi_path == "/opt/downloads/windows"
|
440
|
-
path = "/opt/downloads"
|
441
|
-
else
|
442
|
-
path = Pkg::Config.msi_path
|
443
|
-
end
|
412
|
+
path = Pkg::Paths.remote_repo_base(package_format: 'msi')
|
444
413
|
Pkg::Util::Ship.ship_msi('pkg', path, excludes: ["#{Pkg::Config.project}-x(86|64).msi"])
|
445
414
|
end
|
446
415
|
|
447
416
|
desc "Ship nightly MSI packages to #{Pkg::Config.msi_staging_server}"
|
448
417
|
task ship_nightly_msi: 'pl:fetch' do
|
449
|
-
Pkg::
|
418
|
+
path = Pkg::Paths.remote_repo_base(package_format: 'msi', nonfinal: true)
|
419
|
+
Pkg::Util::Ship.ship_msi('pkg', path, excludes: ["#{Pkg::Config.project}-x(86|64).msi"], nonfinal: true)
|
450
420
|
end
|
451
421
|
|
452
422
|
desc "Add #{Pkg::Config.project} version #{Pkg::Config.ref} to release-metrics"
|
@@ -546,6 +516,16 @@ namespace :pl do
|
|
546
516
|
puts " * #{err}"
|
547
517
|
end
|
548
518
|
end
|
519
|
+
|
520
|
+
desc 'Create the rolling repo links'
|
521
|
+
task create_repo_links: 'pl:fetch' do
|
522
|
+
Pkg::Util::Ship.create_rolling_repo_links
|
523
|
+
end
|
524
|
+
|
525
|
+
desc 'Create rolling repo links for nightlies'
|
526
|
+
task create_nightly_repo_links: 'pl:fetch' do
|
527
|
+
Pkg::Util::Ship.create_rolling_repo_links(true)
|
528
|
+
end
|
549
529
|
end
|
550
530
|
|
551
531
|
# It is odd to namespace this ship task under :jenkins, but this task is
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: packaging
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.99.
|
4
|
+
version: 0.99.66
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|