packaging 0.99.3 → 0.99.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.
@@ -75,9 +75,6 @@ module Pkg::Rpm::Repo
75
75
  path = Pathname.new(origin_path)
76
76
  dest_path = Pathname.new(destination_path)
77
77
 
78
- # You may think "rsync doesn't actually remove the sticky bit, let's
79
- # remove the Dugo-s from the chmod". However, that will make your rsyncs
80
- # fail due to permission errors.
81
78
  options = %w(
82
79
  rsync
83
80
  --recursive
@@ -51,6 +51,10 @@ module Pkg::Util::Gpg
51
51
  gpg ||= Pkg::Util::Tool.find_tool('gpg')
52
52
 
53
53
  if gpg
54
+ if File.exist? "#{file}.asc"
55
+ warn "Signature on #{file} exists, skipping..."
56
+ return true
57
+ end
54
58
  use_tty = "--no-tty --use-agent" if ENV['RPM_GPG_AGENT']
55
59
  stdout, _, _ = Pkg::Util::Execution.capture3("#{gpg} #{use_tty} --armor --detach-sign -u #{key} #{file}")
56
60
  stdout
@@ -24,14 +24,14 @@ module Pkg::Util::Ship
24
24
  #
25
25
  # If this is platform_independent the packages will not get reorganized,
26
26
  # just copied under the tmp directory for more consistent workflows
27
- def reorganize_packages(pkgs, tmp, platform_independent = false)
27
+ def reorganize_packages(pkgs, tmp, platform_independent = false, nonfinal = false)
28
28
  new_pkgs = []
29
29
  pkgs.each do |pkg|
30
30
  if platform_independent
31
31
  path = 'pkg'
32
32
  else
33
33
  platform_tag = Pkg::Paths.tag_from_artifact_path(pkg)
34
- path = Pkg::Paths.artifacts_path(platform_tag, 'pkg')
34
+ path = Pkg::Paths.artifacts_path(platform_tag, 'pkg', nonfinal)
35
35
  end
36
36
  FileUtils.mkdir_p File.join(tmp, path)
37
37
  FileUtils.cp pkg, File.join(tmp, path)
@@ -64,7 +64,8 @@ module Pkg::Util::Ship
64
64
  options = {
65
65
  excludes: [],
66
66
  chattr: true,
67
- platform_independent: false }.merge(opts)
67
+ platform_independent: false,
68
+ nonfinal: false }.merge(opts)
68
69
 
69
70
  # First find the packages to be shipped. We must find them before moving
70
71
  # to our temporary staging directory
@@ -72,7 +73,7 @@ module Pkg::Util::Ship
72
73
  return if local_packages.empty?
73
74
 
74
75
  tmpdir = Dir.mktmpdir
75
- staged_pkgs = reorganize_packages(local_packages, tmpdir, options[:platform_independent])
76
+ staged_pkgs = reorganize_packages(local_packages, tmpdir, options[:platform_independent], options[:nonfinal])
76
77
 
77
78
  puts staged_pkgs.sort
78
79
  puts "Do you want to ship the above files to (#{staging_server})?"
@@ -105,7 +106,7 @@ module Pkg::Util::Ship
105
106
  def ship_rpms(local_staging_directory, remote_path, opts = {})
106
107
  ship_pkgs(["#{local_staging_directory}/**/*.rpm", "#{local_staging_directory}/**/*.srpm"], Pkg::Config.yum_staging_server, remote_path, opts)
107
108
 
108
- create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('el'), Pkg::Config.yum_staging_server, remote_path)
109
+ create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('el'), Pkg::Config.yum_staging_server, remote_path, opts[:nonfinal])
109
110
  end
110
111
 
111
112
  def ship_debs(local_staging_directory, remote_path, opts = {})
@@ -118,7 +119,7 @@ module Pkg::Util::Ship
118
119
  # architecture for the code name we're working with at the moment. [written
119
120
  # by Melissa, copied by Molly]
120
121
  Pkg::Platforms.codenames.each do |codename|
121
- create_rolling_repo_link(Pkg::Platforms.codename_to_tags(codename)[0], Pkg::Config.apt_signing_server, remote_path)
122
+ create_rolling_repo_link(Pkg::Platforms.codename_to_tags(codename)[0], Pkg::Config.apt_signing_server, remote_path, opts[:nonfinal])
122
123
  end
123
124
  end
124
125
 
@@ -133,7 +134,7 @@ module Pkg::Util::Ship
133
134
  def ship_dmg(local_staging_directory, remote_path, opts = {})
134
135
  ship_pkgs(["#{local_staging_directory}/**/*.dmg"], Pkg::Config.dmg_staging_server, remote_path, opts)
135
136
 
136
- create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('osx'), Pkg::Config.dmg_staging_server, remote_path)
137
+ create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('osx'), Pkg::Config.dmg_staging_server, remote_path, opts[:nonfinal])
137
138
 
138
139
  Pkg::Platforms.platform_tags_for_package_format('dmg').each do |platform_tag|
139
140
  # TODO remove the PC1 links when we no longer need to maintain them
@@ -148,13 +149,13 @@ module Pkg::Util::Ship
148
149
  def ship_swix(local_staging_directory, remote_path, opts = {})
149
150
  ship_pkgs(["#{local_staging_directory}/**/*.swix"], Pkg::Config.swix_staging_server, remote_path, opts)
150
151
 
151
- create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('eos'), Pkg::Config.swix_staging_server, remote_path)
152
+ create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('eos'), Pkg::Config.swix_staging_server, remote_path, opts[:nonfinal])
152
153
  end
153
154
 
154
155
  def ship_msi(local_staging_directory, remote_path, opts = {})
155
156
  ship_pkgs(["#{local_staging_directory}/**/*.msi"], Pkg::Config.msi_staging_server, remote_path, opts)
156
157
 
157
- create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('windows'), Pkg::Config.msi_staging_server, remote_path)
158
+ create_rolling_repo_link(Pkg::Platforms.generic_platform_tag('windows'), Pkg::Config.msi_staging_server, remote_path, opts[:nonfinal])
158
159
  # Create the symlinks for the latest supported repo
159
160
  Pkg::Util::Net.remote_create_latest_symlink('puppet-agent', Pkg::Paths.artifacts_path(Pkg::Platforms.generic_platform_tag('windows'), remote_path), 'msi', arch: 'x64')
160
161
  Pkg::Util::Net.remote_create_latest_symlink('puppet-agent', Pkg::Paths.artifacts_path(Pkg::Platforms.generic_platform_tag('windows'), remote_path), 'msi', arch: 'x86')
@@ -175,8 +176,8 @@ module Pkg::Util::Ship
175
176
  ship_pkgs(["#{local_staging_directory}/*.tar.gz*"], Pkg::Config.tar_staging_server, remote_path, opts)
176
177
  end
177
178
 
178
- def rolling_repo_link_command(platform_tag, repo_path)
179
- base_path, link_path = Pkg::Paths.artifacts_base_path_and_link_path(platform_tag, repo_path)
179
+ def rolling_repo_link_command(platform_tag, repo_path, nonfinal = false)
180
+ base_path, link_path = Pkg::Paths.artifacts_base_path_and_link_path(platform_tag, repo_path, nonfinal)
180
181
 
181
182
  if link_path.nil?
182
183
  puts "No link target set, not creating rolling repo link for #{base_path}"
@@ -205,8 +206,8 @@ module Pkg::Util::Ship
205
206
  CMD
206
207
  end
207
208
 
208
- def create_rolling_repo_link(platform_tag, staging_server, repo_path)
209
- command = rolling_repo_link_command(platform_tag, repo_path)
209
+ def create_rolling_repo_link(platform_tag, staging_server, repo_path, nonfinal = false)
210
+ command = rolling_repo_link_command(platform_tag, repo_path, nonfinal)
210
211
 
211
212
  Pkg::Util::Net.remote_ssh_cmd(staging_server, command) unless command.nil?
212
213
  rescue => e
@@ -0,0 +1 @@
1
+ spec/fixtures/config/ext/../params.yaml
@@ -0,0 +1 @@
1
+ spec/fixtures/config/ext/../params.yaml
@@ -67,33 +67,29 @@ describe 'Pkg::Paths' do
67
67
 
68
68
  it 'should return repo_name for final version' do
69
69
  allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
70
- allow(Pkg::Util::Version).to receive(:final?).and_return(true)
71
70
  expect(Pkg::Paths.repo_name).to eq('puppet5')
72
71
  end
73
72
 
74
73
  it 'should be empty string if repo_name is not set for final version' do
75
74
  allow(Pkg::Config).to receive(:repo_name).and_return(nil)
76
- allow(Pkg::Util::Version).to receive(:final?).and_return(true)
77
75
  expect(Pkg::Paths.repo_name).to eq('')
78
76
  end
79
77
 
80
78
  it 'should return nonfinal_repo_name for non-final version' do
81
79
  allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('puppet5-nightly')
82
- allow(Pkg::Util::Version).to receive(:final?).and_return(false)
83
- expect(Pkg::Paths.repo_name).to eq('puppet5-nightly')
80
+ expect(Pkg::Paths.repo_name(true)).to eq('puppet5-nightly')
84
81
  end
85
82
 
86
- it 'should return repo_name if nonfinal_repo_name is not set for non-final version' do
83
+ it 'should fail if nonfinal_repo_name is not set for non-final version' do
87
84
  allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
88
85
  allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nil)
89
- allow(Pkg::Util::Version).to receive(:final?).and_return(false)
90
- expect(Pkg::Paths.repo_name).to eq('puppet5')
86
+ expect { Pkg::Paths.repo_name(true) }.to raise_error
91
87
  end
92
88
  end
93
89
 
94
90
  describe '#artifacts_path' do
95
91
  before :each do
96
- allow(Pkg::Paths).to receive(:repo_name).and_return('puppet5')
92
+ allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
97
93
  end
98
94
 
99
95
  it 'should be correct for el7' do
@@ -125,7 +121,7 @@ describe 'Pkg::Paths' do
125
121
 
126
122
  describe '#repo_path' do
127
123
  before :each do
128
- allow(Pkg::Paths).to receive(:repo_name).and_return('puppet5')
124
+ allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
129
125
  end
130
126
 
131
127
  it 'should be correct' do
@@ -150,4 +146,93 @@ describe 'Pkg::Paths' do
150
146
  end
151
147
  end
152
148
  end
149
+
150
+ describe '#apt_repo_name' do
151
+ it 'should return `Pkg::Config.repo_name` if set' do
152
+ allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
153
+ allow(Pkg::Config).to receive(:apt_repo_name).and_return('PC1')
154
+ expect(Pkg::Paths.apt_repo_name).to eq('puppet5')
155
+ end
156
+
157
+ it 'should return `Pkg::Config.apt_repo_name` if `Pkg::Config.repo_name` is not set' do
158
+ allow(Pkg::Config).to receive(:repo_name).and_return(nil)
159
+ allow(Pkg::Config).to receive(:apt_repo_name).and_return('PC1')
160
+ expect(Pkg::Paths.apt_repo_name).to eq('PC1')
161
+ end
162
+
163
+ it 'should return \'main\' if nothing is set' do
164
+ allow(Pkg::Config).to receive(:repo_name).and_return(nil)
165
+ allow(Pkg::Config).to receive(:apt_repo_name).and_return(nil)
166
+ expect(Pkg::Paths.apt_repo_name).to eq('main')
167
+ end
168
+ it 'should return nonfinal_repo_name for nonfinal version' do
169
+ allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
170
+ allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('puppet5-nightly')
171
+ expect(Pkg::Paths.apt_repo_name(true)).to eq('puppet5-nightly')
172
+ end
173
+
174
+ it 'should fail if nonfinal_repo_name is not set for non-final version' do
175
+ allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
176
+ allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nil)
177
+ expect { Pkg::Paths.apt_repo_name(true) }.to raise_error
178
+ end
179
+ end
180
+
181
+ describe '#yum_repo_name' do
182
+ it 'should return `Pkg::Config.repo_name` if set' do
183
+ allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
184
+ allow(Pkg::Config).to receive(:yum_repo_name).and_return('PC1')
185
+ expect(Pkg::Paths.yum_repo_name).to eq('puppet5')
186
+ end
187
+
188
+ it 'should return `Pkg::Config.yum_repo_name` if `Pkg::Config.repo_name` is not set' do
189
+ allow(Pkg::Config).to receive(:repo_name).and_return(nil)
190
+ allow(Pkg::Config).to receive(:yum_repo_name).and_return('PC1')
191
+ expect(Pkg::Paths.yum_repo_name).to eq('PC1')
192
+ end
193
+
194
+ it 'should return \'products\' if nothing is set' do
195
+ allow(Pkg::Config).to receive(:repo_name).and_return(nil)
196
+ allow(Pkg::Config).to receive(:yum_repo_name).and_return(nil)
197
+ expect(Pkg::Paths.yum_repo_name).to eq('products')
198
+ end
199
+
200
+ it 'should return nonfinal_repo_name for nonfinal version' do
201
+ allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
202
+ allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('puppet5-nightly')
203
+ expect(Pkg::Paths.yum_repo_name(true)).to eq('puppet5-nightly')
204
+ end
205
+
206
+ it 'should fail if nonfinal_repo_name is not set for non-final version' do
207
+ allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
208
+ allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nil)
209
+ expect { Pkg::Paths.yum_repo_name(true) }.to raise_error
210
+ end
211
+ end
212
+
213
+ describe '#is_legacy_repo?' do
214
+ it 'returns true for empty strings' do
215
+ expect(Pkg::Paths.is_legacy_repo?('')).to be_true
216
+ end
217
+
218
+ it 'returns true for PC1' do
219
+ expect(Pkg::Paths.is_legacy_repo?('PC1')).to be_true
220
+ end
221
+
222
+ it 'returns true for foopuppetbar' do
223
+ expect(Pkg::Paths.is_legacy_repo?('foopuppetbar')).to be_true
224
+ end
225
+
226
+ it 'returns false for puppet5' do
227
+ expect(Pkg::Paths.is_legacy_repo?('puppet5')).to be_false
228
+ end
229
+
230
+ it 'returns false for puppet8-nightly' do
231
+ expect(Pkg::Paths.is_legacy_repo?('puppet8-nightly')).to be_false
232
+ end
233
+
234
+ it 'returns false for puppet' do
235
+ expect(Pkg::Paths.is_legacy_repo?('puppet')).to be_false
236
+ end
237
+ end
153
238
  end
@@ -4,7 +4,7 @@ describe 'Pkg::Platforms' do
4
4
  describe '#by_package_format' do
5
5
  it 'should return an array of platforms that use a given format' do
6
6
  deb_platforms = ['cumulus', 'debian', 'ubuntu']
7
- rpm_platforms = ['aix', 'cisco-wrlinux', 'el', 'fedora', 'redhat-fips', 'sles']
7
+ rpm_platforms = ['aix', 'cisco-wrlinux', 'el', 'fedora', 'redhatfips', 'sles']
8
8
  expect(Pkg::Platforms.by_package_format('deb')).to match_array(deb_platforms)
9
9
  expect(Pkg::Platforms.by_package_format('rpm')).to match_array(rpm_platforms)
10
10
  end
@@ -19,7 +19,7 @@ describe 'Pkg::Platforms' do
19
19
 
20
20
  describe '#supported_platforms' do
21
21
  it 'should return all supported platforms' do
22
- platforms = ['aix', 'cisco-wrlinux', 'cumulus', 'debian', 'el', 'eos', 'fedora', 'osx', 'redhat-fips', 'sles', 'solaris', 'ubuntu', 'windows']
22
+ platforms = ['aix', 'cisco-wrlinux', 'cumulus', 'debian', 'el', 'eos', 'fedora', 'osx', 'redhatfips', 'sles', 'solaris', 'ubuntu', 'windows']
23
23
  expect(Pkg::Platforms.supported_platforms).to match_array(platforms)
24
24
  end
25
25
  end
@@ -36,7 +36,7 @@ describe 'Pkg::Platforms' do
36
36
 
37
37
  describe '#codenames' do
38
38
  it 'should return all codenames for a given platform' do
39
- codenames = ['cumulus', 'wheezy', 'jessie', 'stretch', 'trusty', 'xenial']
39
+ codenames = ['bionic', 'buster', 'cumulus', 'wheezy', 'jessie', 'stretch', 'trusty', 'xenial']
40
40
  expect(Pkg::Platforms.codenames).to match_array(codenames)
41
41
  end
42
42
  end
@@ -134,7 +134,7 @@ describe 'Pkg::Platforms' do
134
134
  'xenial-amd64' => ['ubuntu', '16.04', 'amd64'],
135
135
  'xenial' => ['ubuntu', '16.04', ''],
136
136
  'windows-2012' => ['windows', '2012', ''],
137
- 'redhat-fips-7-x86_64' => ['redhat-fips', '7', 'x86_64'],
137
+ 'redhatfips-7-x86_64' => ['redhatfips', '7', 'x86_64'],
138
138
  'el-7-SRPMS' => ['el', '7', 'SRPMS'],
139
139
  'ubuntu-14.04-source' => ['ubuntu', '14.04', 'source'],
140
140
  }
@@ -59,7 +59,7 @@ new_pkgs = [
59
59
  tmpdir = Dir.mktmpdir
60
60
 
61
61
  before :each do
62
- allow(Pkg::Paths).to receive(:repo_name).and_return('puppet5')
62
+ allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
63
63
  expect(FileUtils).to receive(:cp).at_least(:once)
64
64
  end
65
65
 
@@ -205,7 +205,7 @@ DOC
205
205
 
206
206
  if args.foss_only && Pkg::Config.foss_platforms && !Pkg::Config.foss_platforms.empty?
207
207
  Pkg::Config.foss_platforms.each do |platform|
208
- include_paths << Pkg::Paths.repo_path(platform, legacy: true)
208
+ include_paths << Pkg::Paths.repo_path(platform, legacy: true, nonfinal: true)
209
209
  if Pkg::Paths.repo_config_path(platform)
210
210
  include_paths << Pkg::Paths.repo_config_path(platform)
211
211
  end
@@ -337,7 +337,7 @@ DOC
337
337
 
338
338
  latest_filename = File.join(latest_filepath, "LATEST")
339
339
  File.open(latest_filename, 'w') { |file| file.write(version) }
340
- Pkg::Util::Net.s3sync_to(latest_filepath, target_bucket, Pkg::Config.project, ["--acl-public", "--follow-symlinks"])
340
+ Pkg::Util::Net.s3sync_to(latest_filename, target_bucket, Pkg::Config.project, ["--acl-public", "--follow-symlinks"])
341
341
  FileUtils.rm_rf latest_filepath
342
342
  end
343
343
  end
@@ -10,7 +10,7 @@ namespace :pl do
10
10
  command = Pkg::Config.yum_repo_command || 'rake -f /opt/repository/Rakefile mk_repo'
11
11
  $stdout.puts "Really run remote repo update on '#{Pkg::Config.yum_staging_server}'? [y,n]"
12
12
  if Pkg::Util.ask_yes_or_no
13
- Pkg::Repo.update_repo(Pkg::Config.yum_staging_server, command, { :repo_name => Pkg::Config.repo_name, :repo_path => Pkg::Config.yum_repo_path, :repo_host => Pkg::Config.yum_staging_server })
13
+ Pkg::Repo.update_repo(Pkg::Config.yum_staging_server, command, { :repo_name => Pkg::Paths.yum_repo_name, :repo_path => Pkg::Config.yum_repo_path, :repo_host => Pkg::Config.yum_staging_server })
14
14
  end
15
15
  end
16
16
 
@@ -47,7 +47,7 @@ namespace :pl do
47
47
  task update_apt_repo: 'pl:fetch' do
48
48
  $stdout.puts "Really run remote repo update on '#{Pkg::Config.apt_signing_server}'? [y,n]"
49
49
  if Pkg::Util.ask_yes_or_no
50
- Pkg::Repo.update_repo(Pkg::Config.apt_signing_server, Pkg::Config.apt_repo_command, { :repo_name => Pkg::Config.repo_name, :repo_path => Pkg::Config.apt_repo_path, :repo_host => Pkg::Config.apt_host, :repo_url => Pkg::Config.apt_repo_url })
50
+ Pkg::Repo.update_repo(Pkg::Config.apt_signing_server, Pkg::Config.apt_repo_command, { :repo_name => Pkg::Paths.apt_repo_name, :repo_path => Pkg::Config.apt_repo_path, :repo_host => Pkg::Config.apt_host, :repo_url => Pkg::Config.apt_repo_url })
51
51
  end
52
52
  end
53
53
 
@@ -256,7 +256,7 @@ namespace :pl do
256
256
 
257
257
  desc "Ship nightly rpms to #{Pkg::Config.yum_staging_server}"
258
258
  task ship_nightly_rpms: 'pl:fetch' do
259
- Pkg::Util::Ship.ship_rpms('pkg', Pkg::Config.nonfinal_yum_repo_path)
259
+ Pkg::Util::Ship.ship_rpms('pkg', Pkg::Config.nonfinal_yum_repo_path, nonfinal: true)
260
260
  end
261
261
 
262
262
  desc "Ship cow-built debs to #{Pkg::Config.apt_signing_server}"
@@ -266,7 +266,7 @@ namespace :pl do
266
266
 
267
267
  desc "Ship nightly debs to #{Pkg::Config.apt_signing_server}"
268
268
  task ship_nightly_debs: 'pl:fetch' do
269
- Pkg::Util::Ship.ship_debs('pkg', Pkg::Config.nonfinal_apt_repo_staging_path, chattr: false)
269
+ Pkg::Util::Ship.ship_debs('pkg', Pkg::Config.nonfinal_apt_repo_staging_path, chattr: false, nonfinal: true)
270
270
  end
271
271
 
272
272
  desc 'Ship built gem to rubygems.org, internal Gem mirror, and public file server'
@@ -375,7 +375,7 @@ namespace :pl do
375
375
 
376
376
  desc "ship nightly apple dmgs to #{Pkg::Config.dmg_staging_server}"
377
377
  task ship_nightly_dmg: 'pl:fetch' do
378
- Pkg::Util::Ship.ship_dmg('pkg', Pkg::Config.nonfinal_dmg_path)
378
+ Pkg::Util::Ship.ship_dmg('pkg', Pkg::Config.nonfinal_dmg_path, nonfinal: true)
379
379
  end
380
380
 
381
381
  desc "ship Arista EOS swix packages and signatures to #{Pkg::Config.swix_staging_server}"
@@ -397,7 +397,7 @@ namespace :pl do
397
397
 
398
398
  desc "ship nightly Arista EOS swix packages and signatures to #{Pkg::Config.swix_staging_server}"
399
399
  task ship_nightly_swix: 'pl:fetch' do
400
- Pkg::Util::Ship.ship_swix('pkg', Pkg::Config.nonfinal_swix_path)
400
+ Pkg::Util::Ship.ship_swix('pkg', Pkg::Config.nonfinal_swix_path, nonfinal: true)
401
401
  end
402
402
 
403
403
  desc "ship tarball and signature to #{Pkg::Config.tar_staging_server}"
@@ -436,7 +436,7 @@ namespace :pl do
436
436
 
437
437
  desc "Ship nightly MSI packages to #{Pkg::Config.msi_staging_server}"
438
438
  task ship_nightly_msi: 'pl:fetch' do
439
- Pkg::Util::Ship.ship_msi('pkg', Pkg::Config.nonfinal_msi_path, excludes: ["#{Pkg::Config.project}-x(86|64).msi"])
439
+ Pkg::Util::Ship.ship_msi('pkg', Pkg::Config.nonfinal_msi_path, excludes: ["#{Pkg::Config.project}-x(86|64).msi"], nonfinal: true)
440
440
  end
441
441
 
442
442
  desc 'UBER ship: ship all the things in pkg'
@@ -10,9 +10,13 @@ namespace :pl do
10
10
  end
11
11
  end
12
12
 
13
+ # If no directory to sign is specified assume "pkg"
14
+ $DEFAULT_DIRECTORY = "pkg"
15
+
13
16
  desc "Sign the Arista EOS swix packages, defaults to PL key, pass GPG_KEY to override or edit build_defaults"
14
- task :sign_swix do
15
- packages = Dir["pkg/**/*.swix"]
17
+ task :sign_swix, :root_dir do |_t, args|
18
+ swix_dir = args.root_dir || $DEFAULT_DIRECTORY
19
+ packages = Dir["#{swix_dir}/**/*.swix"]
16
20
  unless packages.empty?
17
21
  Pkg::Util::Gpg.load_keychain if Pkg::Util::Tool.find_tool('keychain')
18
22
  packages.each do |swix_package|
@@ -22,10 +26,11 @@ namespace :pl do
22
26
  end
23
27
 
24
28
  desc "Detach sign any solaris svr4 packages"
25
- task :sign_svr4 do
26
- unless Dir["pkg/**/*.pkg.gz"].empty?
29
+ task :sign_svr4, :root_dir do |_t, args|
30
+ svr4_dir = args.root_dir || $DEFAULT_DIRECTORY
31
+ unless Dir["#{svr4_dir}/**/*.pkg.gz"].empty?
27
32
  Pkg::Util::Gpg.load_keychain if Pkg::Util::Tool.find_tool('keychain')
28
- Dir["pkg/**/*.pkg.gz"].each do |pkg|
33
+ Dir["#{svr4_dir}/**/*.pkg.gz"].each do |pkg|
29
34
  Pkg::Util::Gpg.sign_file pkg
30
35
  end
31
36
  end
@@ -33,7 +38,7 @@ namespace :pl do
33
38
 
34
39
  desc "Sign mocked rpms, Defaults to PL Key, pass GPG_KEY to override"
35
40
  task :sign_rpms, :root_dir do |t, args|
36
- rpm_dir = args.root_dir || "pkg"
41
+ rpm_dir = args.root_dir || $DEFAULT_DIRECTORY
37
42
 
38
43
  # Create a hash mapping full paths to basenames.
39
44
  # This will allow us to keep track of the different paths that may be
@@ -97,13 +102,15 @@ namespace :pl do
97
102
  end
98
103
 
99
104
  desc "Sign ips package, uses PL certificates by default, update privatekey_pem, certificate_pem, and ips_inter_cert in build_defaults.yaml to override."
100
- task :sign_ips do
101
- Pkg::Sign::Ips.sign unless Dir['pkg/**/*.p5p'].empty?
105
+ task :sign_ips, :root_dir do |_t, args|
106
+ ips_dir = args.root_dir || $DEFAULT_DIRECTORY
107
+ Pkg::Sign::Ips.sign(ips_dir) unless Dir["#{ips_dir}/**/*.p5p"].empty?
102
108
  end
103
109
 
104
110
  desc "Sign built gems, defaults to PL key, pass GPG_KEY to override or edit build_defaults"
105
- task :sign_gem do
106
- gems = FileList["pkg/*.gem"]
111
+ task :sign_gem, :root_dir do |_t, args|
112
+ gems_dir = args.root_dir || $DEFAULT_DIRECTORY
113
+ gems = FileList["#{gems_dir}/*.gem"]
107
114
  gems.each do |gem|
108
115
  puts "signing gem #{gem}"
109
116
  Pkg::Util::Gpg.sign_file(gem)
@@ -111,9 +118,10 @@ namespace :pl do
111
118
  end
112
119
 
113
120
  desc "Check if all rpms are signed"
114
- task :check_rpm_sigs do
121
+ task :check_rpm_sigs, :root_dir do |_t, args|
122
+ rpm_dir = args.root_dir || $DEFAULT_DIRECTORY
115
123
  signed = TRUE
116
- rpms = Dir["pkg/**/*.rpm"]
124
+ rpms = Dir["#{rpm_dir}/**/*.rpm"]
117
125
  print 'Checking rpm signatures'
118
126
  rpms.each do |rpm|
119
127
  if Pkg::Sign::Rpm.has_sig? rpm
@@ -128,12 +136,13 @@ namespace :pl do
128
136
  end
129
137
 
130
138
  desc "Sign generated debian changes files. Defaults to PL Key, pass GPG_KEY to override"
131
- task :sign_deb_changes do
139
+ task :sign_deb_changes, :root_dir do |_t, args|
132
140
  begin
133
- change_files = Dir["pkg/**/*.changes"]
141
+ deb_dir = args.root_dir || $DEFAULT_DIRECTORY
142
+ change_files = Dir["#{deb_dir}/**/*.changes"]
134
143
  unless change_files.empty?
135
144
  Pkg::Util::Gpg.load_keychain if Pkg::Util::Tool.find_tool('keychain')
136
- Pkg::Sign::Deb.sign_changes("pkg/**/*.changes")
145
+ Pkg::Sign::Deb.sign_changes("#{deb_dir}/**/*.changes")
137
146
  end
138
147
  ensure
139
148
  Pkg::Util::Gpg.kill_keychain
@@ -141,13 +150,15 @@ namespace :pl do
141
150
  end
142
151
 
143
152
  desc "Sign OSX packages"
144
- task :sign_osx => "pl:fetch" do
145
- Pkg::Sign::Dmg.sign unless Dir['pkg/**/*.dmg'].empty?
153
+ task :sign_osx, [:root_dir] => "pl:fetch" do |_t, args|
154
+ dmg_dir = args.root_dir || $DEFAULT_DIRECTORY
155
+ Pkg::Sign::Dmg.sign(dmg_dir) unless Dir["#{dmg_dir}/**/*.dmg"].empty?
146
156
  end
147
157
 
148
158
  desc "Sign MSI packages"
149
- task :sign_msi => "pl:fetch" do
150
- Pkg::Sign::Msi.sign unless Dir['pkg/**/*.msi'].empty?
159
+ task :sign_msi, [:root_dir] => "pl:fetch" do |_t, args|
160
+ msi_dir = args.root_dir || $DEFAULT_DIRECTORY
161
+ Pkg::Sign::Msi.sign(msi_dir) unless Dir["#{msi_dir}/**/*.msi"].empty?
151
162
  end
152
163
 
153
164
  ##
@@ -156,8 +167,10 @@ namespace :pl do
156
167
  #
157
168
  namespace :jenkins do
158
169
  desc "Sign all locally staged packages on #{Pkg::Config.signing_server}"
159
- task :sign_all => "pl:fetch" do
160
- Dir["pkg/*"].empty? and fail "There were files found in pkg/. Maybe you wanted to build/retrieve something first?"
170
+ task :sign_all, :root_dir do |_t, args|
171
+ Pkg::Util::RakeUtils.invoke_task('pl:fetch')
172
+ root_dir = args.root_dir || $DEFAULT_DIRECTORY
173
+ Dir["#{root_dir}/*"].empty? and fail "There were no files found in #{root_dir}. Maybe you wanted to build/retrieve something first?"
161
174
 
162
175
  # Because rpms and debs are laid out differently in PE under pkg/ they
163
176
  # have a different sign task to address this. Rather than create a whole
@@ -172,7 +185,7 @@ namespace :pl do
172
185
  rpm_sign_task = Pkg::Config.build_pe ? "pe:sign_rpms" : "pl:sign_rpms"
173
186
  deb_sign_task = Pkg::Config.build_pe ? "pe:sign_deb_changes" : "pl:sign_deb_changes"
174
187
  sign_tasks = [rpm_sign_task]
175
- sign_tasks << deb_sign_task unless Dir['pkg/**/*.changes'].empty?
188
+ sign_tasks << deb_sign_task unless Dir["#{root_dir}/**/*.changes"].empty?
176
189
  sign_tasks << "pl:sign_tar" if Pkg::Config.build_tar
177
190
  sign_tasks << "pl:sign_gem" if Pkg::Config.build_gem
178
191
  sign_tasks << "pl:sign_osx" if Pkg::Config.build_dmg || Pkg::Config.vanagon_project
@@ -182,7 +195,7 @@ namespace :pl do
182
195
  sign_tasks << "pl:sign_msi" if Pkg::Config.build_msi || Pkg::Config.vanagon_project
183
196
  remote_repo = Pkg::Util::Net.remote_bootstrap(Pkg::Config.signing_server, 'HEAD', nil, signing_bundle)
184
197
  build_params = Pkg::Util::Net.remote_buildparams(Pkg::Config.signing_server, Pkg::Config)
185
- Pkg::Util::Net.rsync_to('pkg', Pkg::Config.signing_server, remote_repo)
198
+ Pkg::Util::Net.rsync_to(root_dir, Pkg::Config.signing_server, remote_repo)
186
199
  rake_command = <<-DOC
187
200
  cd #{remote_repo} ;
188
201
  bundle_prefix= ;
@@ -190,13 +203,13 @@ if [[ -r Gemfile ]]; then
190
203
  source /usr/local/rvm/scripts/rvm; rvm use ruby-2.3.1; bundle install --path .bundle/gems;
191
204
  bundle_prefix='bundle exec';
192
205
  fi ;
193
- $bundle_prefix rake #{sign_tasks.join(' ')} PARAMS_FILE=#{build_params}
206
+ $bundle_prefix rake #{sign_tasks.map { |task| task + "[#{root_dir}]" }.join(" ")} PARAMS_FILE=#{build_params}
194
207
  DOC
195
208
  Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.signing_server, rake_command)
196
- Pkg::Util::Net.rsync_from("#{remote_repo}/pkg/", Pkg::Config.signing_server, "pkg/")
209
+ Pkg::Util::Net.rsync_from("#{remote_repo}/#{root_dir}/", Pkg::Config.signing_server, "#{$DEFAULT_DIRECTORY}/")
197
210
  Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.signing_server, "rm -rf #{remote_repo}")
198
211
  Pkg::Util::Net.remote_ssh_cmd(Pkg::Config.signing_server, "rm #{build_params}")
199
- puts "Signed packages staged in 'pkg/ directory"
212
+ puts "Signed packages staged in #{$DEFAULT_DIRECTORY}/ directory"
200
213
  end
201
214
  end
202
- end
215
+ end