packaging 0.99.80 → 0.102.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/packaging/artifactory.rb +49 -20
- data/lib/packaging/config.rb +12 -8
- data/lib/packaging/platforms.rb +8 -0
- data/lib/packaging/repo.rb +14 -11
- data/lib/packaging/util/apt_staging_server.rb +8 -0
- data/lib/packaging/util/build_metadata.rb +17 -0
- data/lib/packaging/util/distribution_server.rb +42 -0
- data/lib/packaging/util/ezbake.rb +26 -0
- data/lib/packaging/util/net.rb +2 -2
- data/lib/packaging/util/ship.rb +136 -78
- data/lib/packaging/util/windows.rb +38 -0
- data/lib/packaging/util.rb +5 -0
- data/tasks/jenkins.rake +1 -1
- data/tasks/nightly_repos.rake +1 -1
- data/tasks/ship.rake +222 -174
- metadata +60 -27
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f8109d6dfa1a7f7e43f5ecf91242eef84cdf835e787332330edf69a72575964a
|
4
|
+
data.tar.gz: 3e7758f0d7aa68dda7ba93496fd3560d8a89fcadb90945009f3637bfe36df293
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d6c20e9875ac5f178dd5fa1f819eb179d853e85097cc5ea322918ee57dfed229bd02fa8d4f89fd19db4a06a4633d13bde6103d69d524bbbb62af5f67461b90f
|
7
|
+
data.tar.gz: d8765d30cc28d2001766cc9705333594d14f39053e4a3fab9c38763be812ec7a4ceeb783c9c44593b9a6a0852129ebb391c5ec057cddfe250d7274524f5ed9d9
|
@@ -342,40 +342,69 @@ module Pkg
|
|
342
342
|
end
|
343
343
|
end
|
344
344
|
|
345
|
-
# Using the manifest provided by enterprise-dist, grab the
|
345
|
+
# Using the manifest provided by enterprise-dist, grab the
|
346
|
+
# appropropriate packages from artifactory based on md5sum
|
347
|
+
|
346
348
|
# @param staging_directory [String] location to download packages to
|
347
|
-
# @param manifest [File] JSON file
|
349
|
+
# @param manifest [File] JSON file listing which packages to download and
|
350
|
+
# the corresponding md5sums
|
348
351
|
# @param remote_path [String] Optional partial path on the remote host containing packages
|
349
352
|
# Used to specify which subdirectories packages will be downloaded from.
|
350
353
|
def download_packages(staging_directory, manifest, remote_path = '')
|
351
354
|
check_authorization
|
355
|
+
download_repositories = %w(rpm_enterprise__local debian_enterprise__local)
|
352
356
|
manifest.each do |dist, packages|
|
353
|
-
puts "Grabbing the #{dist} packages from artifactory"
|
354
357
|
packages.each do |name, info|
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
358
|
+
package_file_name = info['filename']
|
359
|
+
puts format(
|
360
|
+
"Searching Artifactory [%s]%s for %s (md5: %s)",
|
361
|
+
download_repositories.join(', '),
|
362
|
+
remote_path.empty? ? '' : "/#{remote_path}",
|
363
|
+
package_file_name,
|
364
|
+
info['md5']
|
365
|
+
)
|
366
|
+
artifacts = Artifactory::Resource::Artifact.checksum_search(
|
367
|
+
md5: info['md5'],
|
368
|
+
repos: download_repositories,
|
369
|
+
name: package_file_name
|
370
|
+
)
|
371
|
+
|
372
|
+
artifact_to_download = artifacts.select do |artifact|
|
373
|
+
artifact.download_uri.include? remote_path
|
374
|
+
end.first
|
375
|
+
|
376
|
+
# If we found matching artifacts, but not in the correct
|
377
|
+
# path, copy the artifact to the correct path This should
|
378
|
+
# help us keep repos up to date with the packages we are
|
379
|
+
# expecting to be there while helping us avoid 'could not
|
380
|
+
# find package' errors
|
361
381
|
if artifact_to_download.nil? && !artifacts.empty?
|
362
382
|
artifact_to_copy = artifacts.first
|
363
|
-
copy_artifact(artifact_to_copy, artifact_to_copy.repo,
|
364
|
-
|
365
|
-
|
383
|
+
copy_artifact(artifact_to_copy, artifact_to_copy.repo,
|
384
|
+
"#{remote_path}/#{dist}/#{package_file_name}")
|
385
|
+
|
386
|
+
# Now, search again to make sure we find them in the correct path.
|
387
|
+
artifacts = Artifactory::Resource::Artifact.checksum_search(
|
388
|
+
md5: info['md5'],
|
389
|
+
repos: download_repositories,
|
390
|
+
name: package_file_name
|
391
|
+
)
|
392
|
+
artifact_to_download = artifacts.select do |artifact|
|
393
|
+
artifact.download_uri.include? remote_path
|
394
|
+
end.first
|
366
395
|
end
|
367
396
|
|
368
397
|
if artifact_to_download.nil?
|
369
|
-
message = "Error:
|
370
|
-
|
371
|
-
|
372
|
-
end
|
398
|
+
message = "Error: could not find package #{package_file_name} " \
|
399
|
+
"with md5sum #{info['md5']}"
|
400
|
+
message += " in #{remote_path}" unless remote_path.empty?
|
373
401
|
raise message
|
374
|
-
else
|
375
|
-
full_staging_path = "#{staging_directory}/#{dist}"
|
376
|
-
puts "downloading #{artifact_to_download.download_uri} to #{File.join(full_staging_path, filename)}"
|
377
|
-
artifact_to_download.download(full_staging_path, filename: filename)
|
378
402
|
end
|
403
|
+
|
404
|
+
full_staging_path = "#{staging_directory}/#{dist}"
|
405
|
+
puts "Downloading #{artifact_to_download.download_uri} to " \
|
406
|
+
"#{File.join(full_staging_path, package_file_name)}"
|
407
|
+
artifact_to_download.download(full_staging_path, filename: package_file_name)
|
379
408
|
end
|
380
409
|
end
|
381
410
|
end
|
data/lib/packaging/config.rb
CHANGED
@@ -80,7 +80,7 @@ module Pkg
|
|
80
80
|
|
81
81
|
dir = "/opt/jenkins-builds/#{self.project}/#{self.ref}"
|
82
82
|
cmd = "if [ -s \"#{dir}/artifacts\" ]; then cd #{dir};"\
|
83
|
-
"find ./artifacts
|
83
|
+
"find ./artifacts -mindepth 2 -type f; fi"
|
84
84
|
artifacts, _ = Pkg::Util::Net.remote_execute(
|
85
85
|
self.builds_server,
|
86
86
|
cmd,
|
@@ -95,6 +95,7 @@ module Pkg
|
|
95
95
|
# the correct place. For 5.x and 6.x release streams the f prefix
|
96
96
|
# has been removed and so tag will equal original_tag
|
97
97
|
original_tag = Pkg::Paths.tag_from_artifact_path(artifact)
|
98
|
+
fail "Error: unrecognized artifact \"#{artifact}\"" if original_tag.nil?
|
98
99
|
|
99
100
|
# Remove the f-prefix from the fedora platform tag keys so that
|
100
101
|
# beaker can rely on consistent keys once we rip out the f for good
|
@@ -203,15 +204,18 @@ module Pkg
|
|
203
204
|
# string. Accept an argument for the write target file. If not specified,
|
204
205
|
# the name of the params file is the current git commit sha or tag.
|
205
206
|
#
|
206
|
-
def config_to_yaml(
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
File.
|
207
|
+
def config_to_yaml(destination_directory = nil)
|
208
|
+
destination_directory = Pkg::Util::File.mktemp if destination_directory.nil?
|
209
|
+
config_yaml_file_name = "#{self.ref}.yaml"
|
210
|
+
|
211
|
+
config_yaml_path = File.join(destination_directory, config_yaml_file_name)
|
212
|
+
|
213
|
+
Pkg::Util::File.file_writable?(File.dirname(config_yaml_path), :required => true)
|
214
|
+
File.open(config_yaml_path, 'w') do |f|
|
211
215
|
f.puts self.config_to_hash.to_yaml
|
212
216
|
end
|
213
|
-
puts
|
214
|
-
|
217
|
+
puts config_yaml_path
|
218
|
+
return config_yaml_path
|
215
219
|
end
|
216
220
|
|
217
221
|
##
|
data/lib/packaging/platforms.rb
CHANGED
@@ -157,6 +157,14 @@ module Pkg
|
|
157
157
|
source_package_formats: ['src.rpm'],
|
158
158
|
signature_format: 'v3',
|
159
159
|
repo: true,
|
160
|
+
},
|
161
|
+
'8' => {
|
162
|
+
architectures: ['x86_64'],
|
163
|
+
source_architecture: 'SRPMS',
|
164
|
+
package_format: 'rpm',
|
165
|
+
source_package_formats: ['src.rpm'],
|
166
|
+
signature_format: 'v3',
|
167
|
+
repo: true,
|
160
168
|
}
|
161
169
|
},
|
162
170
|
|
data/lib/packaging/repo.rb
CHANGED
@@ -36,7 +36,8 @@ module Pkg::Repo
|
|
36
36
|
Dir.chdir(File.join('pkg', local_target)) do
|
37
37
|
puts "Info: Archiving #{repo_location} as #{archive_name}"
|
38
38
|
target_tarball = File.join('repos', "#{archive_name}.tar.gz")
|
39
|
-
tar_command =
|
39
|
+
tar_command = %W[#{tar} --owner=0 --group=0 --create --gzip
|
40
|
+
--file #{target_tarball} #{repo_location}].join(' ')
|
40
41
|
stdout, _, _ = Pkg::Util::Execution.capture3(tar_command)
|
41
42
|
return stdout
|
42
43
|
end
|
@@ -62,12 +63,12 @@ module Pkg::Repo
|
|
62
63
|
next
|
63
64
|
end
|
64
65
|
|
65
|
-
tar_action =
|
66
|
-
if File.exist?(all_repos_tarball_name)
|
67
|
-
|
68
|
-
|
66
|
+
tar_action = '--create'
|
67
|
+
tar_action = '--update' if File.exist?(all_repos_tarball_name)
|
68
|
+
|
69
|
+
tar_command = %W[#{tar} --owner=0 --group=0 #{tar_action}
|
70
|
+
--file #{all_repos_tarball_name} #{repo_tarball_path}].join(' ')
|
69
71
|
|
70
|
-
tar_command = "#{tar} --owner=0 --group=0 #{tar_action} --file #{all_repos_tarball_name} #{repo_tarball_path}"
|
71
72
|
stdout, _, _ = Pkg::Util::Execution.capture3(tar_command)
|
72
73
|
puts stdout
|
73
74
|
end
|
@@ -117,7 +118,8 @@ module Pkg::Repo
|
|
117
118
|
)
|
118
119
|
return stdout.split
|
119
120
|
rescue => e
|
120
|
-
fail "Error: Could not retrieve directories that contain #{pkg_ext}
|
121
|
+
fail "Error: Could not retrieve directories that contain #{pkg_ext} " \
|
122
|
+
"packages in #{Pkg::Config.distribution_server}:#{artifact_directory}: #{e}"
|
121
123
|
end
|
122
124
|
|
123
125
|
def populate_repo_directory(artifact_parent_directory)
|
@@ -126,7 +128,8 @@ module Pkg::Repo
|
|
126
128
|
cmd << 'rsync --archive --verbose --one-file-system --ignore-existing artifacts/ repos/ '
|
127
129
|
Pkg::Util::Net.remote_execute(Pkg::Config.distribution_server, cmd)
|
128
130
|
rescue => e
|
129
|
-
fail "Error: Could not populate repos directory in
|
131
|
+
fail "Error: Could not populate repos directory in " \
|
132
|
+
"#{Pkg::Config.distribution_server}:#{artifact_parent_directory}: #{e}"
|
130
133
|
end
|
131
134
|
|
132
135
|
def argument_required?(argument_name, repo_command)
|
@@ -134,12 +137,12 @@ module Pkg::Repo
|
|
134
137
|
end
|
135
138
|
|
136
139
|
def update_repo(remote_host, command, options = {})
|
137
|
-
fail_message = "Error: Missing required argument '%s', update
|
140
|
+
fail_message = "Error: Missing required argument '%s', perhaps update build_defaults?"
|
138
141
|
[:repo_name, :repo_path, :repo_host, :repo_url].each do |option|
|
139
142
|
fail fail_message % option.to_s if argument_required?(option.to_s, command) && !options[option]
|
140
143
|
end
|
141
144
|
|
142
|
-
|
145
|
+
repo_configuration = {
|
143
146
|
__REPO_NAME__: options[:repo_name],
|
144
147
|
__REPO_PATH__: options[:repo_path],
|
145
148
|
__REPO_HOST__: options[:repo_host],
|
@@ -149,7 +152,7 @@ module Pkg::Repo
|
|
149
152
|
}
|
150
153
|
Pkg::Util::Net.remote_execute(
|
151
154
|
remote_host,
|
152
|
-
Pkg::Util::Misc.search_and_replace(command,
|
155
|
+
Pkg::Util::Misc.search_and_replace(command, repo_configuration))
|
153
156
|
end
|
154
157
|
end
|
155
158
|
end
|
@@ -0,0 +1,8 @@
|
|
1
|
+
# Utility methods for handling Apt staging server.
|
2
|
+
|
3
|
+
module Pkg::Util::AptStagingServer
|
4
|
+
def self.send_packages(pkg_directory, apt_component = 'stable')
|
5
|
+
%x(apt-stage-artifacts --component=#{apt_component} #{pkg_directory})
|
6
|
+
fail 'APT artifact staging failed.' unless $CHILD_STATUS.success?
|
7
|
+
end
|
8
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# Utility methods for handling miscellaneous build metadata
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module Pkg::Util::BuildMetadata
|
6
|
+
class << self
|
7
|
+
def add_misc_json_files(target_directory)
|
8
|
+
misc_json_files = Dir.glob('ext/build_metadata*.json')
|
9
|
+
misc_json_files.each do |source_file|
|
10
|
+
target_file = File.join(
|
11
|
+
target_directory, "#{Pkg::Config.ref}.#{File.basename(source_file)}"
|
12
|
+
)
|
13
|
+
FileUtils.cp(source_file, target_file)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# Utility methods for the older distribution server
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module Pkg::Util::DistributionServer
|
6
|
+
class << self
|
7
|
+
def send_packages(local_source_directory, remote_target_directory)
|
8
|
+
Pkg::Util::Execution.retry_on_fail(times: 3) do
|
9
|
+
Pkg::Util::Net.remote_execute(
|
10
|
+
Pkg::Config.distribution_server,
|
11
|
+
"mkdir --mode=775 --parents #{remote_target_directory}"
|
12
|
+
)
|
13
|
+
Pkg::Util::Net.rsync_to(
|
14
|
+
"#{local_source_directory}/",
|
15
|
+
Pkg::Config.distribution_server, "#{remote_target_directory}/",
|
16
|
+
extra_flags: ['--ignore-existing', '--exclude repo_configs']
|
17
|
+
)
|
18
|
+
end
|
19
|
+
|
20
|
+
# In order to get a snapshot of what this build looked like at the time
|
21
|
+
# of shipping, we also generate and ship the params file
|
22
|
+
#
|
23
|
+
Pkg::Config.config_to_yaml(local_source_directory)
|
24
|
+
Pkg::Util::Execution.retry_on_fail(times: 3) do
|
25
|
+
Pkg::Util::Net.rsync_to(
|
26
|
+
"#{local_source_directory}/#{Pkg::Config.ref}.yaml",
|
27
|
+
Pkg::Config.distribution_server, "#{remote_target_directory}/",
|
28
|
+
extra_flags: ["--exclude repo_configs"]
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
# If we just shipped a tagged version, we want to make it immutable
|
33
|
+
files = Dir.glob("#{local_source_directory}/**/*")
|
34
|
+
.select { |f| File.file?(f) and !f.include? "#{Pkg::Config.ref}.yaml" }
|
35
|
+
.map { |f| "#{remote_target_directory}/#{f.sub(/^#{local_source_directory}\//, '')}" }
|
36
|
+
|
37
|
+
Pkg::Util::Net.remote_set_ownership(Pkg::Config.distribution_server, 'root', 'release', files)
|
38
|
+
Pkg::Util::Net.remote_set_permissions(Pkg::Config.distribution_server, '0664', files)
|
39
|
+
Pkg::Util::Net.remote_set_immutable(Pkg::Config.distribution_server, files)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# Utility methods for handling ezbake
|
2
|
+
|
3
|
+
require 'fileutils'
|
4
|
+
|
5
|
+
module Pkg::Util::EZbake
|
6
|
+
class << self
|
7
|
+
def add_manifest(target_directory)
|
8
|
+
ezbake_manifest = File.join('ext', 'ezbake.manifest')
|
9
|
+
ezbake_yaml = File.join('ext', 'ezbake.manifest.yaml')
|
10
|
+
|
11
|
+
if File.exist?(ezbake_manifest)
|
12
|
+
FileUtils.cp(
|
13
|
+
ezbake_manifest,
|
14
|
+
File.join(target_directory, "#{Pkg::Config.ref}.ezbake.manifest")
|
15
|
+
)
|
16
|
+
end
|
17
|
+
|
18
|
+
if File.exists?(ezbake_yaml)
|
19
|
+
FileUtils.cp(
|
20
|
+
ezbake_yaml,
|
21
|
+
File.join(target_directory, "#{Pkg::Config.ref}.ezbake.manifest.yaml")
|
22
|
+
)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
data/lib/packaging/util/net.rb
CHANGED
@@ -159,7 +159,7 @@ module Pkg::Util::Net
|
|
159
159
|
raise(ArgumentError, "Cannot sync path '#{origin}' because both origin_host and target_host are nil. Perhaps you need to set TEAM=release ?") unless
|
160
160
|
options[:origin_host] || options[:target_host]
|
161
161
|
|
162
|
-
cmd = %W
|
162
|
+
cmd = %W[
|
163
163
|
#{options[:bin]}
|
164
164
|
--recursive
|
165
165
|
--hard-links
|
@@ -169,7 +169,7 @@ module Pkg::Util::Net
|
|
169
169
|
--no-perms
|
170
170
|
--no-owner
|
171
171
|
--no-group
|
172
|
-
|
172
|
+
] + [*options[:extra_flags]]
|
173
173
|
|
174
174
|
cmd << '--dry-run' if options[:dryrun]
|
175
175
|
cmd << Pkg::Util.pseudo_uri(path: origin, host: options[:origin_host])
|
data/lib/packaging/util/ship.rb
CHANGED
@@ -1,14 +1,20 @@
|
|
1
1
|
# Module for shipping all packages to places
|
2
|
+
|
3
|
+
require 'English'
|
2
4
|
require 'tmpdir'
|
5
|
+
|
3
6
|
module Pkg::Util::Ship
|
4
7
|
module_function
|
5
8
|
|
6
|
-
def collect_packages(pkg_exts, excludes = [])
|
9
|
+
def collect_packages(pkg_exts, excludes = [])
|
7
10
|
pkgs = pkg_exts.map { |ext| Dir.glob(ext) }.flatten
|
8
11
|
return [] if pkgs.empty?
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
+
|
13
|
+
if excludes
|
14
|
+
excludes.each do |exclude|
|
15
|
+
pkgs.delete_if { |p| p.match(exclude) }
|
16
|
+
end
|
17
|
+
end
|
12
18
|
if pkgs.empty?
|
13
19
|
$stdout.puts "No packages with (#{pkg_exts.join(', ')}) extensions found staged in 'pkg'"
|
14
20
|
$stdout.puts "Maybe your excludes argument (#{excludes}) is too restrictive?"
|
@@ -59,13 +65,13 @@ module Pkg::Util::Ship
|
|
59
65
|
# false (most paths will be platform dependent), but set to true for gems
|
60
66
|
# and tarballs since those just land directly under /opt/downloads/<project>
|
61
67
|
#
|
62
|
-
# rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
63
68
|
def ship_pkgs(pkg_exts, staging_server, remote_path, opts = {})
|
64
69
|
options = {
|
65
70
|
excludes: [],
|
66
71
|
chattr: true,
|
67
72
|
platform_independent: false,
|
68
|
-
nonfinal: false
|
73
|
+
nonfinal: false
|
74
|
+
}.merge(opts)
|
69
75
|
|
70
76
|
# First find the packages to be shipped. We must find them before moving
|
71
77
|
# to our temporary staging directory
|
@@ -73,35 +79,39 @@ module Pkg::Util::Ship
|
|
73
79
|
return false if local_packages.empty?
|
74
80
|
|
75
81
|
tmpdir = Dir.mktmpdir
|
76
|
-
staged_pkgs = reorganize_packages(
|
82
|
+
staged_pkgs = reorganize_packages(
|
83
|
+
local_packages, tmpdir, options[:platform_independent], options[:nonfinal]
|
84
|
+
)
|
77
85
|
|
78
86
|
puts staged_pkgs.sort
|
79
87
|
puts "Do you want to ship the above files to (#{staging_server})?"
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
88
|
+
return false unless Pkg::Util.ask_yes_or_no
|
89
|
+
|
90
|
+
extra_flags = %w(--ignore-existing --delay-updates)
|
91
|
+
extra_flags << '--dry-run' if ENV['DRYRUN']
|
92
|
+
|
93
|
+
staged_pkgs.each do |pkg|
|
94
|
+
Pkg::Util::Execution.retry_on_fail(times: 3) do
|
95
|
+
sub_string = 'pkg'
|
96
|
+
remote_pkg = pkg.sub(sub_string, remote_path)
|
97
|
+
remote_basepath = File.dirname(remote_pkg)
|
98
|
+
Pkg::Util::Net.remote_execute(staging_server, "mkdir -p #{remote_basepath}")
|
99
|
+
Pkg::Util::Net.rsync_to(
|
100
|
+
File.join(tmpdir, pkg),
|
101
|
+
staging_server,
|
102
|
+
remote_basepath,
|
103
|
+
extra_flags: extra_flags
|
104
|
+
)
|
105
|
+
|
106
|
+
Pkg::Util::Net.remote_set_ownership(
|
107
|
+
staging_server, 'root', 'release', [remote_basepath, remote_pkg]
|
108
|
+
)
|
109
|
+
Pkg::Util::Net.remote_set_permissions(staging_server, '775', [remote_basepath])
|
110
|
+
Pkg::Util::Net.remote_set_permissions(staging_server, '0664', [remote_pkg])
|
111
|
+
Pkg::Util::Net.remote_set_immutable(staging_server, [remote_pkg]) if options[:chattr]
|
102
112
|
end
|
103
|
-
return true
|
104
113
|
end
|
114
|
+
return true
|
105
115
|
end
|
106
116
|
|
107
117
|
def ship_rpms(local_staging_directory, remote_path, opts = {})
|
@@ -123,6 +133,8 @@ module Pkg::Util::Ship
|
|
123
133
|
ship_pkgs(things_to_ship, Pkg::Config.apt_signing_server, remote_path, opts)
|
124
134
|
end
|
125
135
|
|
136
|
+
|
137
|
+
|
126
138
|
def ship_svr4(local_staging_directory, remote_path, opts = {})
|
127
139
|
ship_pkgs(["#{local_staging_directory}/**/*.pkg.gz"], Pkg::Config.svr4_host, remote_path, opts)
|
128
140
|
end
|
@@ -132,33 +144,63 @@ module Pkg::Util::Ship
|
|
132
144
|
end
|
133
145
|
|
134
146
|
def ship_dmg(local_staging_directory, remote_path, opts = {})
|
135
|
-
packages_have_shipped = ship_pkgs(
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
+
packages_have_shipped = ship_pkgs(
|
148
|
+
["#{local_staging_directory}/**/*.dmg"],
|
149
|
+
Pkg::Config.dmg_staging_server, remote_path, opts
|
150
|
+
)
|
151
|
+
|
152
|
+
return unless packages_have_shipped
|
153
|
+
|
154
|
+
Pkg::Platforms.platform_tags_for_package_format('dmg').each do |platform_tag|
|
155
|
+
# Create the latest symlink for the current supported repo
|
156
|
+
Pkg::Util::Net.remote_create_latest_symlink(
|
157
|
+
Pkg::Config.project,
|
158
|
+
Pkg::Paths.artifacts_path(platform_tag, remote_path, opts[:nonfinal]),
|
159
|
+
'dmg'
|
160
|
+
)
|
147
161
|
end
|
148
162
|
end
|
149
163
|
|
150
164
|
def ship_swix(local_staging_directory, remote_path, opts = {})
|
151
|
-
ship_pkgs(
|
165
|
+
ship_pkgs(
|
166
|
+
["#{local_staging_directory}/**/*.swix"],
|
167
|
+
Pkg::Config.swix_staging_server,
|
168
|
+
remote_path,
|
169
|
+
opts
|
170
|
+
)
|
152
171
|
end
|
153
172
|
|
154
173
|
def ship_msi(local_staging_directory, remote_path, opts = {})
|
155
|
-
packages_have_shipped = ship_pkgs(
|
174
|
+
packages_have_shipped = ship_pkgs(
|
175
|
+
["#{local_staging_directory}/**/*.msi"],
|
176
|
+
Pkg::Config.msi_staging_server,
|
177
|
+
remote_path,
|
178
|
+
opts
|
179
|
+
)
|
180
|
+
return unless packages_have_shipped
|
156
181
|
|
157
|
-
|
158
|
-
|
159
|
-
Pkg::
|
160
|
-
Pkg::
|
161
|
-
|
182
|
+
# Create the symlinks for the latest supported repo
|
183
|
+
Pkg::Util::Net.remote_create_latest_symlink(
|
184
|
+
Pkg::Config.project,
|
185
|
+
Pkg::Paths.artifacts_path(
|
186
|
+
Pkg::Platforms.generic_platform_tag('windows'),
|
187
|
+
remote_path,
|
188
|
+
opts[:nonfinal]
|
189
|
+
),
|
190
|
+
'msi',
|
191
|
+
arch: 'x64'
|
192
|
+
)
|
193
|
+
|
194
|
+
Pkg::Util::Net.remote_create_latest_symlink(
|
195
|
+
Pkg::Config.project,
|
196
|
+
Pkg::Paths.artifacts_path(
|
197
|
+
Pkg::Platforms.generic_platform_tag('windows'),
|
198
|
+
remote_path,
|
199
|
+
opts[:nonfinal]
|
200
|
+
),
|
201
|
+
'msi',
|
202
|
+
arch: 'x86'
|
203
|
+
)
|
162
204
|
end
|
163
205
|
|
164
206
|
def ship_gem(local_staging_directory, remote_path, opts = {})
|
@@ -166,44 +208,32 @@ module Pkg::Util::Ship
|
|
166
208
|
end
|
167
209
|
|
168
210
|
def ship_tar(local_staging_directory, remote_path, opts = {})
|
169
|
-
ship_pkgs(
|
211
|
+
ship_pkgs(
|
212
|
+
["#{local_staging_directory}/*.tar.gz*"],
|
213
|
+
Pkg::Config.tar_staging_server,
|
214
|
+
remote_path,
|
215
|
+
opts
|
216
|
+
)
|
170
217
|
end
|
171
218
|
|
172
219
|
def rolling_repo_link_command(platform_tag, repo_path, nonfinal = false)
|
173
|
-
base_path, link_path = Pkg::Paths.artifacts_base_path_and_link_path(
|
220
|
+
base_path, link_path = Pkg::Paths.artifacts_base_path_and_link_path(
|
221
|
+
platform_tag,
|
222
|
+
repo_path,
|
223
|
+
nonfinal
|
224
|
+
)
|
174
225
|
|
175
226
|
if link_path.nil?
|
176
227
|
puts "No link target set, not creating rolling repo link for #{base_path}"
|
177
228
|
return nil
|
178
229
|
end
|
179
|
-
|
180
|
-
cmd = <<-CMD
|
181
|
-
if [ ! -d #{base_path} ] ; then
|
182
|
-
echo "Link target '#{base_path}' does not exist; skipping"
|
183
|
-
exit 0
|
184
|
-
fi
|
185
|
-
# If it's a link but pointing to the wrong place, remove the link
|
186
|
-
# This is likely to happen around the transition times, like puppet5 -> puppet6
|
187
|
-
if [ -L #{link_path} ] && [ ! #{base_path} -ef #{link_path} ] ; then
|
188
|
-
rm #{link_path}
|
189
|
-
# This is the link you're looking for, nothing to see here
|
190
|
-
elif [ -L #{link_path} ] ; then
|
191
|
-
exit 0
|
192
|
-
# Don't want to delete it if it isn't a link, that could be destructive
|
193
|
-
# So, fail!
|
194
|
-
elif [ -e #{link_path} ] ; then
|
195
|
-
echo "#{link_path} exists but isn't a link, I don't know what to do with this" >&2
|
196
|
-
exit 1
|
197
|
-
fi
|
198
|
-
ln -s #{base_path} #{link_path}
|
199
|
-
CMD
|
200
230
|
end
|
201
231
|
|
202
232
|
def create_rolling_repo_link(platform_tag, staging_server, repo_path, nonfinal = false)
|
203
233
|
command = rolling_repo_link_command(platform_tag, repo_path, nonfinal)
|
204
234
|
|
205
235
|
Pkg::Util::Net.remote_execute(staging_server, command) unless command.nil?
|
206
|
-
rescue => e
|
236
|
+
rescue StandardError => e
|
207
237
|
fail "Failed to create rolling repo link for '#{platform_tag}'.\n#{e}\n#{e.backtrace}"
|
208
238
|
end
|
209
239
|
|
@@ -214,10 +244,33 @@ module Pkg::Util::Ship
|
|
214
244
|
swix_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'swix')
|
215
245
|
msi_path = Pkg::Paths.remote_repo_base(nonfinal: nonfinal, package_format: 'msi')
|
216
246
|
|
217
|
-
create_rolling_repo_link(
|
218
|
-
|
219
|
-
|
220
|
-
|
247
|
+
create_rolling_repo_link(
|
248
|
+
Pkg::Platforms.generic_platform_tag('el'),
|
249
|
+
Pkg::Config.yum_staging_server,
|
250
|
+
yum_path,
|
251
|
+
nonfinal
|
252
|
+
)
|
253
|
+
|
254
|
+
create_rolling_repo_link(
|
255
|
+
Pkg::Platforms.generic_platform_tag('osx'),
|
256
|
+
Pkg::Config.dmg_staging_server,
|
257
|
+
dmg_path,
|
258
|
+
nonfinal
|
259
|
+
)
|
260
|
+
|
261
|
+
create_rolling_repo_link(
|
262
|
+
Pkg::Platforms.generic_platform_tag('eos'),
|
263
|
+
Pkg::Config.swix_staging_server,
|
264
|
+
swix_path,
|
265
|
+
nonfinal
|
266
|
+
)
|
267
|
+
|
268
|
+
create_rolling_repo_link(
|
269
|
+
Pkg::Platforms.generic_platform_tag('windows'),
|
270
|
+
Pkg::Config.msi_staging_server,
|
271
|
+
msi_path,
|
272
|
+
nonfinal
|
273
|
+
)
|
221
274
|
|
222
275
|
# We need to iterate through all the supported platforms here because of
|
223
276
|
# how deb repos are set up. Each codename will have its own link from the
|
@@ -231,7 +284,12 @@ module Pkg::Util::Ship
|
|
231
284
|
apt_path = Pkg::Config.nonfinal_apt_repo_staging_path
|
232
285
|
end
|
233
286
|
Pkg::Platforms.codenames.each do |codename|
|
234
|
-
create_rolling_repo_link(
|
287
|
+
create_rolling_repo_link(
|
288
|
+
Pkg::Platforms.codename_to_tags(codename)[0],
|
289
|
+
Pkg::Config.apt_signing_server,
|
290
|
+
apt_path,
|
291
|
+
nonfinal
|
292
|
+
)
|
235
293
|
end
|
236
294
|
end
|
237
295
|
|