packaging 0.99.71 → 0.99.76
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 +4 -4
- data/README.md +1 -1
- data/lib/packaging/config.rb +26 -0
- data/lib/packaging/config/params.rb +12 -0
- data/lib/packaging/config/validations.rb +13 -0
- data/lib/packaging/gem.rb +14 -10
- data/lib/packaging/paths.rb +54 -9
- data/lib/packaging/platforms.rb +2 -2
- data/lib/packaging/sign/msi.rb +2 -3
- data/lib/packaging/util/git.rb +1 -1
- data/lib/packaging/util/net.rb +1 -1
- data/lib/packaging/util/ship.rb +20 -5
- data/spec/lib/packaging/paths_spec.rb +233 -114
- data/spec/lib/packaging/util/git_tag_spec.rb +1 -1
- data/spec/lib/packaging/util/ship_spec.rb +142 -72
- data/tasks/config.rake +5 -0
- data/tasks/fetch.rake +17 -14
- data/tasks/gem.rake +0 -10
- data/tasks/ship.rake +10 -28
- metadata +15 -14
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 0d737ac46704906a2bc986128797b3db649dd3e35e1432f2a98f362da67ffa56
|
|
4
|
+
data.tar.gz: 7a1ae857ec7a92940499a60c9d649f5e5e40fd8f2340aa95d2751f0de29d9fbd
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cacbbdc7c63c443a6a6bb6c0bc7f77367343b22b8356c4d99c00fe67a1fd448af0c7e0647d616ec533d1cb1cdfb6412fbff953bfb6926dbb4a06911d08da20df
|
|
7
|
+
data.tar.gz: 39ada32cc8dde4df7d661d00807ba937667338278191391ec534c98423228c594a49e2c74bedd10e9c8bd18601dae6bdff54804d48f2e255bc995b198bef4c13
|
data/README.md
CHANGED
|
@@ -404,7 +404,7 @@ deb_build_mirrors:
|
|
|
404
404
|
# Who is packaging. Turns up in various packaging artifacts
|
|
405
405
|
packager: 'puppetlabs'
|
|
406
406
|
# GPG key ID of the signer
|
|
407
|
-
gpg_key: '
|
|
407
|
+
gpg_key: '4528B6CD9E61EF26'
|
|
408
408
|
# Whether to require tarball signing as a prerequisite of other package building
|
|
409
409
|
sign_tar: false
|
|
410
410
|
# a space separated list of mock configs. These are the rpm distributions to package for. If a noarch package, only one arch of each is needed.
|
data/lib/packaging/config.rb
CHANGED
|
@@ -6,6 +6,7 @@ module Pkg
|
|
|
6
6
|
#
|
|
7
7
|
class Config
|
|
8
8
|
require 'packaging/config/params.rb'
|
|
9
|
+
require 'packaging/config/validations.rb'
|
|
9
10
|
require 'yaml'
|
|
10
11
|
|
|
11
12
|
class << self
|
|
@@ -389,6 +390,31 @@ module Pkg
|
|
|
389
390
|
end
|
|
390
391
|
end
|
|
391
392
|
|
|
393
|
+
##
|
|
394
|
+
# Ask for validation of BUILD_PARAMS
|
|
395
|
+
#
|
|
396
|
+
# Issued as warnings initially but the intent is to turn this into
|
|
397
|
+
# a failure.
|
|
398
|
+
#
|
|
399
|
+
def perform_validations
|
|
400
|
+
error_count = 0
|
|
401
|
+
Pkg::Params::VALIDATIONS.each do |v|
|
|
402
|
+
variable_name = v[:var]
|
|
403
|
+
variable_value = self.instance_variable_get("@#{v[:var]}")
|
|
404
|
+
validations = v[:validations]
|
|
405
|
+
validations.each do |validation|
|
|
406
|
+
unless Pkg::ConfigValidations.send(validation, variable_value)
|
|
407
|
+
warn "Warning: variable \"#{variable_name}\" failed validation \"#{validation}\""
|
|
408
|
+
error_count += 1
|
|
409
|
+
end
|
|
410
|
+
end
|
|
411
|
+
end
|
|
412
|
+
|
|
413
|
+
if error_count != 0
|
|
414
|
+
warn "Warning: #{error_count} validation failure(s)."
|
|
415
|
+
end
|
|
416
|
+
end
|
|
417
|
+
|
|
392
418
|
def string_to_array(str)
|
|
393
419
|
delimiters = /[,\s;]/
|
|
394
420
|
return str if str.respond_to?('each')
|
|
@@ -298,6 +298,7 @@ module Pkg::Params
|
|
|
298
298
|
{ :var => :team, :envvar => :TEAM },
|
|
299
299
|
{ :var => :update_version_file, :envvar => :NEW_STYLE_PACKAGE },
|
|
300
300
|
{ :var => :vanagon_project, :envvar => :VANAGON_PROJECT, :type => :bool },
|
|
301
|
+
{ :var => :version, :envvar => :PACKAGING_PACKAGE_VERSION },
|
|
301
302
|
{ :var => :yum_archive_path, :envvar => :YUM_ARCHIVE_PATH },
|
|
302
303
|
{ :var => :yum_host, :envvar => :YUM_HOST },
|
|
303
304
|
{ :var => :yum_repo_path, :envvar => :YUM_REPO },
|
|
@@ -362,6 +363,7 @@ module Pkg::Params
|
|
|
362
363
|
{ :oldvar => :yum_host, :newvar => :tar_host },
|
|
363
364
|
]
|
|
364
365
|
|
|
366
|
+
|
|
365
367
|
# These are variables that we have deprecated. If they are encountered in a
|
|
366
368
|
# project's config, we issue deprecations for them.
|
|
367
369
|
#
|
|
@@ -372,4 +374,14 @@ module Pkg::Params
|
|
|
372
374
|
{ :var => :gpg_name, :message => "
|
|
373
375
|
DEPRECATED, 29-Jul-2014: 'gpg_name' has been replaced with 'gpg_key'.
|
|
374
376
|
Please update this field in your build_defaults.yaml" }]
|
|
377
|
+
|
|
378
|
+
# Provide an open-ended template for validating BUILD_PARAMS.
|
|
379
|
+
#
|
|
380
|
+
# Each validatation contains the variable name as ':var' and a list of validations it
|
|
381
|
+
# must pass from the Pkg::Params::Validations class.
|
|
382
|
+
#
|
|
383
|
+
VALIDATIONS = [
|
|
384
|
+
{ :var => :project, :validations => [:not_empty?] }
|
|
385
|
+
]
|
|
386
|
+
|
|
375
387
|
end
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
module Pkg
|
|
2
|
+
class ConfigValidations
|
|
3
|
+
|
|
4
|
+
class << self
|
|
5
|
+
|
|
6
|
+
# As a validation, this one is kindof lame but is intended as a seed pattern for possibly
|
|
7
|
+
# more robust ones.
|
|
8
|
+
def not_empty?(value)
|
|
9
|
+
value.to_s.empty? ? false : true
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
13
|
+
end
|
data/lib/packaging/gem.rb
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
require 'json'
|
|
2
2
|
module Pkg::Gem
|
|
3
3
|
class << self
|
|
4
|
-
# This is preserved because I don't want to update the deprecated code path
|
|
5
|
-
# yet; I'm not entirely sure I've fixed everything that might attempt
|
|
6
|
-
# to call this method so this is now a wrapper for a wrapper.
|
|
7
4
|
def ship(file)
|
|
8
5
|
rsync_to_downloads(file)
|
|
9
6
|
ship_to_rubygems(file)
|
|
@@ -13,17 +10,21 @@ module Pkg::Gem
|
|
|
13
10
|
# checksums, or other glob-able artifacts to an external download server.
|
|
14
11
|
def rsync_to_downloads(file)
|
|
15
12
|
Pkg::Util.deprecate('Pkg::Gem.rsync_to_downloads', 'Pkg::Util::Ship.ship_pkgs')
|
|
16
|
-
Pkg::Util::Ship.ship_pkgs(["#{file}*"], Pkg::Config.gem_host,
|
|
13
|
+
Pkg::Util::Ship.ship_pkgs(["#{file}*"], Pkg::Config.gem_host,
|
|
14
|
+
Pkg::Config.gem_path, platform_independent: true)
|
|
17
15
|
end
|
|
18
16
|
|
|
19
17
|
def shipped_to_rubygems?(gem_name, gem_version, gem_platform)
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
rubygems_url = "https://rubygems.org/api/v1/versions/#{gem_name}.json"
|
|
19
|
+
gem_data = JSON.parse(%x(curl --silent #{rubygems_url}))
|
|
20
|
+
gem = gem_data.select do |data|
|
|
21
|
+
data['number'] == gem_version && data['platform'] == gem_platform
|
|
22
|
+
end
|
|
22
23
|
return !gem.empty?
|
|
23
24
|
rescue => e
|
|
24
|
-
puts "
|
|
25
|
+
puts "Something went wrong searching for gem '#{gem_name}':"
|
|
25
26
|
puts e
|
|
26
|
-
puts "Perhaps you're shipping
|
|
27
|
+
puts "Perhaps you're shipping '#{gem_name}' for the first time?"
|
|
27
28
|
return false
|
|
28
29
|
end
|
|
29
30
|
|
|
@@ -40,7 +41,7 @@ module Pkg::Gem
|
|
|
40
41
|
gem_platform ||= 'ruby'
|
|
41
42
|
|
|
42
43
|
if shipped_to_rubygems?(Pkg::Config.gem_name, Pkg::Config.gemversion, gem_platform)
|
|
43
|
-
puts "#{file} has already been shipped to rubygems, skipping
|
|
44
|
+
puts "#{file} has already been shipped to rubygems, skipping."
|
|
44
45
|
return
|
|
45
46
|
end
|
|
46
47
|
Pkg::Util::File.file_exists?("#{ENV['HOME']}/.gem/credentials", :required => true)
|
|
@@ -60,7 +61,10 @@ module Pkg::Gem
|
|
|
60
61
|
|
|
61
62
|
def ship_to_internal_mirror(file)
|
|
62
63
|
internal_mirror_api_key_name = 'artifactory_api_key'
|
|
63
|
-
ship_to_rubygems(file, {
|
|
64
|
+
ship_to_rubygems(file, {
|
|
65
|
+
host: Pkg::Config.internal_gem_host,
|
|
66
|
+
key: internal_mirror_api_key_name
|
|
67
|
+
})
|
|
64
68
|
end
|
|
65
69
|
end
|
|
66
70
|
end
|
data/lib/packaging/paths.rb
CHANGED
|
@@ -16,9 +16,9 @@ module Pkg::Paths
|
|
|
16
16
|
if source_formats.find { |fmt| path =~ /#{fmt}$/ }
|
|
17
17
|
return Pkg::Platforms.get_attribute_for_platform_version(platform, version, :source_architecture)
|
|
18
18
|
end
|
|
19
|
-
arches.find { |a| path.include?(a) } || arches[0]
|
|
19
|
+
arches.find { |a| path.include?(package_arch(platform, a)) } || arches[0]
|
|
20
20
|
rescue
|
|
21
|
-
arches.find { |a| path.include?(a) } || arches[0]
|
|
21
|
+
arches.find { |a| path.include?(package_arch(platform, a)) } || arches[0]
|
|
22
22
|
end
|
|
23
23
|
|
|
24
24
|
# Given a path to an artifact, divine the appropriate platform tag associated
|
|
@@ -109,9 +109,19 @@ module Pkg::Paths
|
|
|
109
109
|
platform_name = path_data[:platform_name]
|
|
110
110
|
platform_tag = path_data[:platform_tag]
|
|
111
111
|
|
|
112
|
+
repo_name = Pkg::Config.repo_name
|
|
113
|
+
|
|
112
114
|
case package_format
|
|
113
115
|
when 'deb'
|
|
114
116
|
debian_code_name = Pkg::Platforms.get_attribute(platform_tag, :codename)
|
|
117
|
+
|
|
118
|
+
# In puppet7 and beyond, we moved the repo_name to the top to allow each
|
|
119
|
+
# puppet major release to have its own apt repo.
|
|
120
|
+
if %w(FUTURE-puppet7 FUTURE-puppet7-nightly).include? repo_name
|
|
121
|
+
return File.join(prefix, apt_repo_name(is_nonfinal), debian_code_name)
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
# For puppet6 and prior
|
|
115
125
|
return File.join(prefix, debian_code_name, apt_repo_name(is_nonfinal))
|
|
116
126
|
when 'dmg'
|
|
117
127
|
return File.join(prefix, 'mac', repo_name(is_nonfinal))
|
|
@@ -292,23 +302,47 @@ module Pkg::Paths
|
|
|
292
302
|
|
|
293
303
|
# This is where deb packages end up after freight repo updates
|
|
294
304
|
def apt_package_base_path(platform_tag, repo_name, project, nonfinal = false)
|
|
295
|
-
|
|
305
|
+
unless Pkg::Platforms.package_format_for_tag(platform_tag) == 'deb'
|
|
306
|
+
fail "Can't determine path for non-debian platform #{platform_tag}."
|
|
307
|
+
end
|
|
308
|
+
|
|
296
309
|
platform, version, _ = Pkg::Platforms.parse_platform_tag(platform_tag)
|
|
297
|
-
|
|
298
|
-
|
|
310
|
+
code_name = Pkg::Platforms.codename_for_platform_version(platform, version)
|
|
311
|
+
remote_repo_path = remote_repo_base(platform_tag, nonfinal: nonfinal)
|
|
312
|
+
|
|
313
|
+
# In puppet7 and beyond, we moved the puppet major version to near the top to allow each
|
|
314
|
+
# puppet major release to have its own apt repo, for example:
|
|
315
|
+
# /opt/repository/apt/puppet7/pool/bionic/p/puppet-agent
|
|
316
|
+
if %w(FUTURE-puppet7 FUTURE-puppet7-nightly).include? repo_name
|
|
317
|
+
return File.join(remote_repo_path, repo_name, 'pool', code_name, project[0], project)
|
|
318
|
+
end
|
|
319
|
+
|
|
320
|
+
# For repos prior to puppet7, the puppet version was part of the repository
|
|
321
|
+
# For example: /opt/repository/apt/pool/bionic/puppet6/p/puppet-agent
|
|
322
|
+
if %w(puppet7 puppet7-nightly
|
|
323
|
+
puppet6 puppet6-nightly
|
|
324
|
+
puppet5 puppet5-nightly
|
|
325
|
+
puppet puppet-nightly
|
|
326
|
+
puppet-tools).include? repo_name
|
|
327
|
+
return File.join(remote_repo_path, 'pool', code_name, repo_name, project[0], project)
|
|
328
|
+
end
|
|
329
|
+
|
|
330
|
+
raise "Error: Cannot determine apt_package_base_path for repo: \"#{repo_name}\"."
|
|
299
331
|
end
|
|
300
332
|
|
|
301
333
|
def release_package_link_path(platform_tag, nonfinal = false)
|
|
302
|
-
platform, version,
|
|
334
|
+
platform, version, _ = Pkg::Platforms.parse_platform_tag(platform_tag)
|
|
303
335
|
package_format = Pkg::Platforms.package_format_for_tag(platform_tag)
|
|
304
336
|
case package_format
|
|
305
337
|
when 'rpm'
|
|
306
|
-
return File.join(remote_repo_base(platform_tag, nonfinal: nonfinal),
|
|
338
|
+
return File.join(remote_repo_base(platform_tag, nonfinal: nonfinal),
|
|
339
|
+
"#{repo_name(nonfinal)}-release-#{platform}-#{version}.noarch.rpm")
|
|
307
340
|
when 'deb'
|
|
308
341
|
codename = Pkg::Platforms.codename_for_platform_version(platform, version)
|
|
309
|
-
return File.join(remote_repo_base(platform_tag, nonfinal: nonfinal),
|
|
342
|
+
return File.join(remote_repo_base(platform_tag, nonfinal: nonfinal),
|
|
343
|
+
"#{repo_name(nonfinal)}-release-#{codename}.deb")
|
|
310
344
|
else
|
|
311
|
-
warn "No release packages for package format '#{package_format}', skipping
|
|
345
|
+
warn "No release packages for package format '#{package_format}', skipping."
|
|
312
346
|
return nil
|
|
313
347
|
end
|
|
314
348
|
end
|
|
@@ -328,4 +362,15 @@ module Pkg::Paths
|
|
|
328
362
|
return base_component if component_qualifier == 'repos'
|
|
329
363
|
return full_component
|
|
330
364
|
end
|
|
365
|
+
|
|
366
|
+
#for ubuntu-20.04-aarch64, debian package architecture is arm64
|
|
367
|
+
def package_arch(platform, arch)
|
|
368
|
+
if platform == 'ubuntu' && arch == 'aarch64'
|
|
369
|
+
return 'arm64'
|
|
370
|
+
end
|
|
371
|
+
arch
|
|
372
|
+
end
|
|
373
|
+
|
|
374
|
+
private :package_arch
|
|
375
|
+
|
|
331
376
|
end
|
data/lib/packaging/platforms.rb
CHANGED
|
@@ -100,7 +100,7 @@ module Pkg
|
|
|
100
100
|
repo: true,
|
|
101
101
|
},
|
|
102
102
|
'8' => {
|
|
103
|
-
architectures: ['x86_64', 'aarch64'],
|
|
103
|
+
architectures: ['x86_64', 'ppc64le', 'aarch64'],
|
|
104
104
|
source_architecture: 'SRPMS',
|
|
105
105
|
package_format: 'rpm',
|
|
106
106
|
source_package_formats: ['src.rpm'],
|
|
@@ -248,7 +248,7 @@ module Pkg
|
|
|
248
248
|
},
|
|
249
249
|
'20.04' => {
|
|
250
250
|
codename: 'focal',
|
|
251
|
-
architectures: ['amd64'],
|
|
251
|
+
architectures: ['amd64', 'aarch64'],
|
|
252
252
|
source_architecture: 'source',
|
|
253
253
|
package_format: 'deb',
|
|
254
254
|
source_package_formats: DEBIAN_SOURCE_FORMATS,
|
data/lib/packaging/sign/msi.rb
CHANGED
|
@@ -71,9 +71,8 @@ for msipath in #{msis.join(" ")}; do
|
|
|
71
71
|
echo "$msi is already signed, skipping . . ." ;
|
|
72
72
|
else
|
|
73
73
|
tries=5
|
|
74
|
-
sha1Servers=(http://timestamp.
|
|
75
|
-
http://timestamp.
|
|
76
|
-
http://www.startssl.com/timestamp)
|
|
74
|
+
sha1Servers=(http://timestamp.digicert.com/sha1/timestamp
|
|
75
|
+
http://timestamp.comodoca.com/authenticode)
|
|
77
76
|
for timeserver in "${sha1Servers[@]}"; do
|
|
78
77
|
for ((try=1; try<=$tries; try++)) do
|
|
79
78
|
ret=$(/cygdrive/c/tools/osslsigncode-fork/osslsigncode.exe sign \
|
data/lib/packaging/util/git.rb
CHANGED
|
@@ -6,7 +6,7 @@ module Pkg::Util::Git
|
|
|
6
6
|
# Git utility to create a new git commit
|
|
7
7
|
def commit_file(file, message = 'changes')
|
|
8
8
|
fail_unless_repo
|
|
9
|
-
puts '
|
|
9
|
+
puts 'Committing changes:'
|
|
10
10
|
puts
|
|
11
11
|
diff, = Pkg::Util::Execution.capture3("#{Pkg::Util::Tool::GIT} diff HEAD #{file}")
|
|
12
12
|
puts diff
|
data/lib/packaging/util/net.rb
CHANGED
|
@@ -372,7 +372,7 @@ DOC
|
|
|
372
372
|
def remote_bundle_install_command
|
|
373
373
|
export_packaging_location = ''
|
|
374
374
|
export_packaging_location = "export PACKAGING_LOCATION='#{ENV['PACKAGING_LOCATION']}';" if ENV['PACKAGING_LOCATION'] && !ENV['PACKAGING_LOCATION'].empty?
|
|
375
|
-
command = "source /usr/local/rvm/scripts/rvm; rvm use ruby-2.
|
|
375
|
+
command = "source /usr/local/rvm/scripts/rvm; rvm use ruby-2.5.1; #{export_packaging_location} bundle install --path .bundle/gems ;"
|
|
376
376
|
end
|
|
377
377
|
|
|
378
378
|
# Given a BuildInstance object and a host, send its params to the host. Return
|
data/lib/packaging/util/ship.rb
CHANGED
|
@@ -105,12 +105,22 @@ module Pkg::Util::Ship
|
|
|
105
105
|
end
|
|
106
106
|
|
|
107
107
|
def ship_rpms(local_staging_directory, remote_path, opts = {})
|
|
108
|
-
|
|
108
|
+
things_to_ship = [
|
|
109
|
+
"#{local_staging_directory}/**/*.rpm",
|
|
110
|
+
"#{local_staging_directory}/**/*.srpm"
|
|
111
|
+
]
|
|
112
|
+
ship_pkgs(things_to_ship, Pkg::Config.yum_staging_server, remote_path, opts)
|
|
109
113
|
end
|
|
110
114
|
|
|
111
115
|
def ship_debs(local_staging_directory, remote_path, opts = {})
|
|
112
|
-
|
|
113
|
-
|
|
116
|
+
things_to_ship = [
|
|
117
|
+
"#{local_staging_directory}/**/*.debian.tar.gz",
|
|
118
|
+
"#{local_staging_directory}/**/*.orig.tar.gz",
|
|
119
|
+
"#{local_staging_directory}/**/*.dsc",
|
|
120
|
+
"#{local_staging_directory}/**/*.deb",
|
|
121
|
+
"#{local_staging_directory}/**/*.changes"
|
|
122
|
+
]
|
|
123
|
+
ship_pkgs(things_to_ship, Pkg::Config.apt_signing_server, remote_path, opts)
|
|
114
124
|
end
|
|
115
125
|
|
|
116
126
|
def ship_svr4(local_staging_directory, remote_path, opts = {})
|
|
@@ -122,12 +132,17 @@ module Pkg::Util::Ship
|
|
|
122
132
|
end
|
|
123
133
|
|
|
124
134
|
def ship_dmg(local_staging_directory, remote_path, opts = {})
|
|
125
|
-
packages_have_shipped = ship_pkgs(["#{local_staging_directory}/**/*.dmg"],
|
|
135
|
+
packages_have_shipped = ship_pkgs(["#{local_staging_directory}/**/*.dmg"],
|
|
136
|
+
Pkg::Config.dmg_staging_server, remote_path, opts)
|
|
126
137
|
|
|
127
138
|
if packages_have_shipped
|
|
128
139
|
Pkg::Platforms.platform_tags_for_package_format('dmg').each do |platform_tag|
|
|
129
140
|
# Create the latest symlink for the current supported repo
|
|
130
|
-
Pkg::Util::Net.remote_create_latest_symlink(
|
|
141
|
+
Pkg::Util::Net.remote_create_latest_symlink(
|
|
142
|
+
Pkg::Config.project,
|
|
143
|
+
Pkg::Paths.artifacts_path(platform_tag, remote_path, opts[:nonfinal]),
|
|
144
|
+
'dmg'
|
|
145
|
+
)
|
|
131
146
|
end
|
|
132
147
|
end
|
|
133
148
|
end
|
|
@@ -3,42 +3,39 @@ require 'spec_helper'
|
|
|
3
3
|
describe 'Pkg::Paths' do
|
|
4
4
|
describe '#arch_from_artifact_path' do
|
|
5
5
|
arch_transformations = {
|
|
6
|
-
['artifacts/aix/6.1/
|
|
7
|
-
['pkg/el-
|
|
8
|
-
['
|
|
9
|
-
['
|
|
6
|
+
['artifacts/aix/6.1/puppet6/ppc/puppet-agent-6.9.0-1.aix6.1.ppc.rpm', 'aix', '6.1'] => 'power',
|
|
7
|
+
['pkg/el-8-x86_64/puppet-agent-6.9.0-1.el8.x86_64.rpm', 'el', '8'] => 'x86_64',
|
|
8
|
+
['pkg/el/8/puppet6/aarch64/puppet-agent-6.5.0.3094.g16b6fa6f-1.el8.aarch64.rpm', 'el', '8'] => 'aarch64',
|
|
9
|
+
['artifacts/fedora/32/puppet6/x86_64/puppet-agent-6.9.0-1.fc30.x86_64.rpm', 'fedora', '32'] => 'x86_64',
|
|
10
10
|
['pkg/ubuntu-16.04-amd64/puppet-agent_4.99.0-1xenial_amd64.deb', 'ubuntu', '16.04'] => 'amd64',
|
|
11
|
+
['artifacts/deb/focal/puppet6/puppet-agent_6.5.0.3094.g16b6fa6f-1focal_arm64.deb', 'ubuntu', '20.04'] => 'aarch64',
|
|
12
|
+
|
|
13
|
+
['artifacts/ubuntu-16.04-i386/puppetserver_5.0.1-0.1SNAPSHOT.2017.07.27T2346puppetlabs1.debian.tar.gz', 'ubuntu', '16.04'] => 'source',
|
|
11
14
|
['artifacts/deb/jessie/PC1/puppetserver_5.0.1.master.orig.tar.gz', 'debian', '8'] => 'source',
|
|
12
15
|
['artifacts/el/6/PC1/SRPMS/puppetserver-5.0.1.master-0.1SNAPSHOT.2017.08.18T0951.el6.src.rpm', 'el', '6'] => 'SRPMS'
|
|
13
16
|
}
|
|
14
17
|
arch_transformations.each do |path_array, arch|
|
|
15
18
|
it "should correctly return #{arch} for #{path_array[0]}" do
|
|
16
|
-
expect(Pkg::Paths.arch_from_artifact_path(path_array[1], path_array[2], path_array[0]))
|
|
19
|
+
expect(Pkg::Paths.arch_from_artifact_path(path_array[1], path_array[2], path_array[0]))
|
|
20
|
+
.to eq(arch)
|
|
17
21
|
end
|
|
18
22
|
end
|
|
19
23
|
end
|
|
20
24
|
|
|
21
25
|
describe '#tag_from_artifact_path' do
|
|
22
26
|
path_tranformations = {
|
|
23
|
-
'artifacts/aix/6.1/
|
|
24
|
-
'pkg/el-7-x86_64/puppet-agent-
|
|
25
|
-
'pkg/ubuntu-
|
|
26
|
-
'pkg/windows
|
|
27
|
+
'artifacts/aix/6.1/puppet6/ppc/puppet-agent-6.9.0-1.aix6.1.ppc.rpm' => 'aix-6.1-power',
|
|
28
|
+
'pkg/el-7-x86_64/puppet-agent-5.5.22-1.el8.x86_64.rpm' => 'el-7-x86_64',
|
|
29
|
+
'pkg/ubuntu-20.04-amd64/puppet-agent_5.5.22-1xenial_amd64.deb' => 'ubuntu-20.04-amd64',
|
|
30
|
+
'pkg/windows/puppet-agent-5.5.22-x86.msi' => 'windows-2012-x86',
|
|
27
31
|
'artifacts/el/6/products/x86_64/pe-r10k-2.5.4.3-1.el6.x86_64.rpm' => 'el-6-x86_64',
|
|
28
32
|
'pkg/pe/rpm/el-6-i386/pe-puppetserver-2017.3.0.3-1.el6.noarch.rpm' => 'el-6-i386',
|
|
29
|
-
'pkg/deb/
|
|
30
|
-
'pkg/
|
|
31
|
-
'pkg/pe/deb/
|
|
32
|
-
'artifacts/deb/
|
|
33
|
-
'pkg/
|
|
34
|
-
'pkg/apple/10.14/PC1/x86_64/puppet-agent-1.9.0-1.osx10.14.dmg' => 'osx-10.14-x86_64',
|
|
35
|
-
'artifacts/mac/10.15/PC1/x86_64/puppet-agent-1.9.0-1.osx10.15.dmg' => 'osx-10.15-x86_64',
|
|
36
|
-
'artifacts/eos/4/PC1/i386/puppet-agent-1.9.0-1.eos4.i386.swix' => 'eos-4-i386',
|
|
33
|
+
'pkg/deb/bionic/pe-r10k_3.5.2.0-1bionic_amd64.deb' => 'ubuntu-18.04-amd64',
|
|
34
|
+
'pkg/deb/buster/pe-r10k_3.5.2.0-1buster_amd64.deb' => 'debian-10-amd64',
|
|
35
|
+
'pkg/pe/deb/bionic/pe-puppetserver_2019.8.2.32-1bionic_all.deb' => 'ubuntu-18.04-amd64',
|
|
36
|
+
'artifacts/deb/focal/puppet6/puppetdb_6.13.0-1focal_all.deb' => 'ubuntu-20.04-amd64',
|
|
37
|
+
'pkg/apple/10.15/puppet6/x86_64/puppet-agent-6.19.0-1.osx10.15.dmg' => 'osx-10.15-x86_64',
|
|
37
38
|
'pkg/windows/puppet-agent-1.9.0-x86.msi' => 'windows-2012-x86',
|
|
38
|
-
'artifacts/ubuntu-16.04-i386/puppetserver_5.0.1-0.1SNAPSHOT.2017.07.27T2346puppetlabs1.debian.tar.gz' => 'ubuntu-16.04-source',
|
|
39
|
-
'http://saturn.puppetlabs.net/deb_repos/1234abcd/repos/apt/xenial' => 'ubuntu-16.04-amd64',
|
|
40
|
-
'http://builds.puppetlabs.lan/puppet-agent/0ce4e6a0448366e01537323bbab77f834d7035c7/repos/el/6/PC1/x86_64/' => 'el-6-x86_64',
|
|
41
|
-
'http://builds.puppetlabs.lan/puppet-agent/0ce4e6a0448366e01537323bbab77f834d7035c7/repos/el/6/PC1/x86_64/' => 'el-6-x86_64',
|
|
42
39
|
'pkg/pe/rpm/el-6-i386/pe-puppetserver-2017.3.0.3-1.el6.src.rpm' => 'el-6-SRPMS',
|
|
43
40
|
'pkg/pe/deb/xenial/pe-puppetserver_2017.3.0.3-1puppet1.orig.tar.gz' => 'ubuntu-16.04-source',
|
|
44
41
|
'pkg/puppet-agent-5.1.0.79.g782e03c.gem' => nil,
|
|
@@ -63,10 +60,14 @@ describe 'Pkg::Paths' do
|
|
|
63
60
|
end
|
|
64
61
|
|
|
65
62
|
describe '#repo_name' do
|
|
63
|
+
it 'should return repo_name for final version' do
|
|
64
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
|
65
|
+
expect(Pkg::Paths.repo_name).to eq('puppet6')
|
|
66
|
+
end
|
|
66
67
|
|
|
67
68
|
it 'should return repo_name for final version' do
|
|
68
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('
|
|
69
|
-
expect(Pkg::Paths.repo_name).to eq('
|
|
69
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('FUTURE-puppet7')
|
|
70
|
+
expect(Pkg::Paths.repo_name).to eq('FUTURE-puppet7')
|
|
70
71
|
end
|
|
71
72
|
|
|
72
73
|
it 'should be empty string if repo_name is not set for final version' do
|
|
@@ -75,56 +76,84 @@ describe 'Pkg::Paths' do
|
|
|
75
76
|
end
|
|
76
77
|
|
|
77
78
|
it 'should return nonfinal_repo_name for non-final version' do
|
|
78
|
-
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('
|
|
79
|
-
expect(Pkg::Paths.repo_name(true)).to eq('
|
|
79
|
+
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('puppet6-nightly')
|
|
80
|
+
expect(Pkg::Paths.repo_name(true)).to eq('puppet6-nightly')
|
|
80
81
|
end
|
|
81
82
|
|
|
82
83
|
it 'should fail if nonfinal_repo_name is not set for non-final version' do
|
|
83
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('
|
|
84
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
|
84
85
|
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nil)
|
|
85
86
|
expect { Pkg::Paths.repo_name(true) }.to raise_error
|
|
86
87
|
end
|
|
87
88
|
end
|
|
88
89
|
|
|
89
90
|
describe '#artifacts_path' do
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
context 'all puppet versions' do
|
|
92
|
+
before :each do
|
|
93
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
|
94
|
+
end
|
|
93
95
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
+
it 'should work on all current platforms' do
|
|
97
|
+
Pkg::Platforms.platform_tags.each do |tag|
|
|
98
|
+
expect { Pkg::Paths.artifacts_path(tag) }.not_to raise_error
|
|
99
|
+
end
|
|
100
|
+
end
|
|
96
101
|
end
|
|
97
102
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
103
|
+
context 'for puppet 6 and prior' do
|
|
104
|
+
before :each do
|
|
105
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
|
106
|
+
end
|
|
101
107
|
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
108
|
+
it 'should be correct for el7' do
|
|
109
|
+
expect(Pkg::Paths.artifacts_path('el-7-x86_64'))
|
|
110
|
+
.to eq('artifacts/puppet6/el/7/x86_64')
|
|
111
|
+
end
|
|
105
112
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
113
|
+
it 'should be correct for bionic' do
|
|
114
|
+
expect(Pkg::Paths.artifacts_path('ubuntu-18.04-amd64'))
|
|
115
|
+
.to eq('artifacts/bionic/puppet6')
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
it 'should be correct for solaris 11' do
|
|
119
|
+
expect(Pkg::Paths.artifacts_path('solaris-11-sparc'))
|
|
120
|
+
.to eq('artifacts/solaris/puppet6/11')
|
|
121
|
+
end
|
|
109
122
|
|
|
110
|
-
|
|
111
|
-
|
|
123
|
+
it 'should be correct for osx' do
|
|
124
|
+
expect(Pkg::Paths.artifacts_path('osx-10.15-x86_64'))
|
|
125
|
+
.to eq('artifacts/mac/puppet6/10.15/x86_64')
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
it 'should be correct for windows' do
|
|
129
|
+
expect(Pkg::Paths.artifacts_path('windows-2012-x64'))
|
|
130
|
+
.to eq('artifacts/windows/puppet6')
|
|
131
|
+
end
|
|
112
132
|
end
|
|
113
133
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
134
|
+
context 'after puppet 7 apt changes' do
|
|
135
|
+
before :each do
|
|
136
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('FUTURE-puppet7')
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
it 'should be correct for bionic' do
|
|
140
|
+
expect(Pkg::Paths.artifacts_path('ubuntu-18.04-amd64'))
|
|
141
|
+
.to eq('artifacts/FUTURE-puppet7/bionic')
|
|
142
|
+
end
|
|
143
|
+
it 'should be correct for focal' do
|
|
144
|
+
expect(Pkg::Paths.artifacts_path('ubuntu-20.04-amd64'))
|
|
145
|
+
.to eq('artifacts/FUTURE-puppet7/focal')
|
|
117
146
|
end
|
|
118
147
|
end
|
|
119
148
|
end
|
|
120
149
|
|
|
121
150
|
describe '#repo_path' do
|
|
122
151
|
before :each do
|
|
123
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('
|
|
152
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
|
124
153
|
end
|
|
125
154
|
|
|
126
155
|
it 'should be correct' do
|
|
127
|
-
expect(Pkg::Paths.repo_path('el-7-x86_64')).to eq('repos/
|
|
156
|
+
expect(Pkg::Paths.repo_path('el-7-x86_64')).to eq('repos/puppet6/el/7/x86_64')
|
|
128
157
|
end
|
|
129
158
|
|
|
130
159
|
it 'should work on all current platforms' do
|
|
@@ -135,8 +164,16 @@ describe 'Pkg::Paths' do
|
|
|
135
164
|
end
|
|
136
165
|
|
|
137
166
|
describe '#repo_config_path' do
|
|
138
|
-
it 'should
|
|
139
|
-
expect(Pkg::Paths.repo_config_path('el-7-x86_64'))
|
|
167
|
+
it 'should construct rpm/deb-specific repo configs' do
|
|
168
|
+
expect(Pkg::Paths.repo_config_path('el-7-x86_64'))
|
|
169
|
+
.to eq('repo_configs/rpm/*el-7-x86_64*.repo')
|
|
170
|
+
expect(Pkg::Paths.repo_config_path('ubuntu-18.04-amd64'))
|
|
171
|
+
.to eq('repo_configs/deb/*bionic*.list')
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
it 'should raise a RuntimeError with unfamilar repo configs' do
|
|
175
|
+
expect { Pkg::Paths.repo_config_path('bogus') }
|
|
176
|
+
.to raise_error(/Could not verify that 'bogus' is a valid tag/)
|
|
140
177
|
end
|
|
141
178
|
|
|
142
179
|
it 'should work on all current platforms' do
|
|
@@ -148,15 +185,15 @@ describe 'Pkg::Paths' do
|
|
|
148
185
|
|
|
149
186
|
describe '#apt_repo_name' do
|
|
150
187
|
it 'should return `Pkg::Config.repo_name` if set' do
|
|
151
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('
|
|
152
|
-
allow(Pkg::Config).to receive(:apt_repo_name).and_return('
|
|
153
|
-
expect(Pkg::Paths.apt_repo_name).to eq('
|
|
188
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
|
189
|
+
allow(Pkg::Config).to receive(:apt_repo_name).and_return('stuff')
|
|
190
|
+
expect(Pkg::Paths.apt_repo_name).to eq('puppet6')
|
|
154
191
|
end
|
|
155
192
|
|
|
156
193
|
it 'should return `Pkg::Config.apt_repo_name` if `Pkg::Config.repo_name` is not set' do
|
|
157
194
|
allow(Pkg::Config).to receive(:repo_name).and_return(nil)
|
|
158
|
-
allow(Pkg::Config).to receive(:apt_repo_name).and_return('
|
|
159
|
-
expect(Pkg::Paths.apt_repo_name).to eq('
|
|
195
|
+
allow(Pkg::Config).to receive(:apt_repo_name).and_return('puppet6')
|
|
196
|
+
expect(Pkg::Paths.apt_repo_name).to eq('puppet6')
|
|
160
197
|
end
|
|
161
198
|
|
|
162
199
|
it 'should return \'main\' if nothing is set' do
|
|
@@ -164,14 +201,15 @@ describe 'Pkg::Paths' do
|
|
|
164
201
|
allow(Pkg::Config).to receive(:apt_repo_name).and_return(nil)
|
|
165
202
|
expect(Pkg::Paths.apt_repo_name).to eq('main')
|
|
166
203
|
end
|
|
204
|
+
|
|
167
205
|
it 'should return nonfinal_repo_name for nonfinal version' do
|
|
168
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('
|
|
169
|
-
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('
|
|
170
|
-
expect(Pkg::Paths.apt_repo_name(true)).to eq('
|
|
206
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('FUTURE-puppet7')
|
|
207
|
+
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('FUTURE-puppet7-nightly')
|
|
208
|
+
expect(Pkg::Paths.apt_repo_name(true)).to eq('FUTURE-puppet7-nightly')
|
|
171
209
|
end
|
|
172
210
|
|
|
173
211
|
it 'should fail if nonfinal_repo_name is not set for non-final version' do
|
|
174
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('
|
|
212
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('FUTURE-puppet7')
|
|
175
213
|
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nil)
|
|
176
214
|
expect { Pkg::Paths.apt_repo_name(true) }.to raise_error
|
|
177
215
|
end
|
|
@@ -179,15 +217,15 @@ describe 'Pkg::Paths' do
|
|
|
179
217
|
|
|
180
218
|
describe '#yum_repo_name' do
|
|
181
219
|
it 'should return `Pkg::Config.repo_name` if set' do
|
|
182
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('
|
|
183
|
-
allow(Pkg::Config).to receive(:yum_repo_name).and_return('
|
|
184
|
-
expect(Pkg::Paths.yum_repo_name).to eq('
|
|
220
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
|
221
|
+
allow(Pkg::Config).to receive(:yum_repo_name).and_return('stuff')
|
|
222
|
+
expect(Pkg::Paths.yum_repo_name).to eq('puppet6')
|
|
185
223
|
end
|
|
186
224
|
|
|
187
225
|
it 'should return `Pkg::Config.yum_repo_name` if `Pkg::Config.repo_name` is not set' do
|
|
188
226
|
allow(Pkg::Config).to receive(:repo_name).and_return(nil)
|
|
189
|
-
allow(Pkg::Config).to receive(:yum_repo_name).and_return('
|
|
190
|
-
expect(Pkg::Paths.yum_repo_name).to eq('
|
|
227
|
+
allow(Pkg::Config).to receive(:yum_repo_name).and_return('FUTURE-puppet7')
|
|
228
|
+
expect(Pkg::Paths.yum_repo_name).to eq('FUTURE-puppet7')
|
|
191
229
|
end
|
|
192
230
|
|
|
193
231
|
it 'should return \'products\' if nothing is set' do
|
|
@@ -197,40 +235,50 @@ describe 'Pkg::Paths' do
|
|
|
197
235
|
end
|
|
198
236
|
|
|
199
237
|
it 'should return nonfinal_repo_name for nonfinal version' do
|
|
200
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('
|
|
201
|
-
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('
|
|
202
|
-
expect(Pkg::Paths.yum_repo_name(true)).to eq('
|
|
238
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('FUTURE-puppet7')
|
|
239
|
+
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('FUTURE-puppet7-nightly')
|
|
240
|
+
expect(Pkg::Paths.yum_repo_name(true)).to eq('FUTURE-puppet7-nightly')
|
|
203
241
|
end
|
|
204
242
|
|
|
205
243
|
it 'should fail if nonfinal_repo_name is not set for non-final version' do
|
|
206
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('
|
|
244
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('FUTURE-puppet7')
|
|
207
245
|
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nil)
|
|
208
246
|
expect { Pkg::Paths.yum_repo_name(true) }.to raise_error
|
|
209
247
|
end
|
|
210
248
|
end
|
|
211
249
|
|
|
212
250
|
describe '#remote_repo_base' do
|
|
251
|
+
fake_yum_repo_path = '/fake/yum'
|
|
252
|
+
fake_yum_nightly_repo_path = '/fake/yum-nightly'
|
|
253
|
+
fake_apt_repo_path = '/fake/apt'
|
|
254
|
+
fake_apt_nightly_repo_path = '/fake/apt-nightly'
|
|
255
|
+
|
|
213
256
|
before :each do
|
|
214
|
-
allow(Pkg::Config).to receive(:yum_repo_path).and_return(
|
|
215
|
-
allow(Pkg::Config).to receive(:apt_repo_path).and_return(
|
|
257
|
+
allow(Pkg::Config).to receive(:yum_repo_path).and_return(fake_yum_repo_path)
|
|
258
|
+
allow(Pkg::Config).to receive(:apt_repo_path).and_return(fake_apt_repo_path)
|
|
216
259
|
allow(Pkg::Config).to receive(:dmg_path).and_return('/opt/downloads/mac')
|
|
217
|
-
allow(Pkg::Config).to receive(:nonfinal_yum_repo_path).and_return(
|
|
218
|
-
allow(Pkg::Config).to receive(:nonfinal_apt_repo_path).and_return(
|
|
260
|
+
allow(Pkg::Config).to receive(:nonfinal_yum_repo_path).and_return(fake_yum_nightly_repo_path)
|
|
261
|
+
allow(Pkg::Config).to receive(:nonfinal_apt_repo_path).and_return(fake_apt_nightly_repo_path)
|
|
219
262
|
end
|
|
220
263
|
it 'returns yum_repo_path for rpms' do
|
|
221
|
-
expect(Pkg::Paths.remote_repo_base('el-7-x86_64'))
|
|
264
|
+
expect(Pkg::Paths.remote_repo_base('el-7-x86_64'))
|
|
265
|
+
.to eq(fake_yum_repo_path)
|
|
222
266
|
end
|
|
223
267
|
it 'returns apt_repo_path for debs' do
|
|
224
|
-
expect(Pkg::Paths.remote_repo_base('ubuntu-18.04-amd64'))
|
|
268
|
+
expect(Pkg::Paths.remote_repo_base('ubuntu-18.04-amd64'))
|
|
269
|
+
.to eq(fake_apt_repo_path)
|
|
225
270
|
end
|
|
226
271
|
it 'returns nonfinal_yum_repo_path for nonfinal rpms' do
|
|
227
|
-
expect(Pkg::Paths.remote_repo_base('fedora-31-x86_64', nonfinal: true))
|
|
272
|
+
expect(Pkg::Paths.remote_repo_base('fedora-31-x86_64', nonfinal: true))
|
|
273
|
+
.to eq(fake_yum_nightly_repo_path)
|
|
228
274
|
end
|
|
229
275
|
it 'returns nonfinal_apt_repo_path for nonfinal debs' do
|
|
230
|
-
expect(Pkg::Paths.remote_repo_base('debian-9-amd64', nonfinal: true))
|
|
276
|
+
expect(Pkg::Paths.remote_repo_base('debian-9-amd64', nonfinal: true))
|
|
277
|
+
.to eq(fake_apt_nightly_repo_path)
|
|
231
278
|
end
|
|
232
279
|
it 'fails if neither tag nor package_format is provided' do
|
|
233
|
-
expect { Pkg::Paths.remote_repo_base }
|
|
280
|
+
expect { Pkg::Paths.remote_repo_base }
|
|
281
|
+
.to raise_error(/Pkg::Paths.remote_repo_base must have/)
|
|
234
282
|
end
|
|
235
283
|
|
|
236
284
|
it 'returns /opt/downloads if the path is /opt/downloads/<something>' do
|
|
@@ -238,56 +286,127 @@ describe 'Pkg::Paths' do
|
|
|
238
286
|
end
|
|
239
287
|
|
|
240
288
|
it 'fails for all other package formats' do
|
|
241
|
-
expect { Pkg::Paths.remote_repo_base('solaris-11-i386') }
|
|
289
|
+
expect { Pkg::Paths.remote_repo_base('solaris-11-i386') }
|
|
290
|
+
.to raise_error(/Can't determine remote repo base path/)
|
|
242
291
|
end
|
|
243
292
|
end
|
|
244
293
|
|
|
245
294
|
describe '#apt_package_base_path' do
|
|
246
295
|
it 'fails for non-debian platforms' do
|
|
247
|
-
expect { Pkg::Paths.apt_package_base_path('el-7-x86_64', 'puppet6', 'puppet-agent') }
|
|
296
|
+
expect { Pkg::Paths.apt_package_base_path('el-7-x86_64', 'puppet6', 'puppet-agent') }
|
|
297
|
+
.to raise_error(/Can't determine path for non-debian platform/)
|
|
248
298
|
end
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
299
|
+
|
|
300
|
+
context 'for puppet 6 and prior' do
|
|
301
|
+
it 'returns the approprate apt repo path' do
|
|
302
|
+
allow(Pkg::Paths).to receive(:remote_repo_base).and_return('/opt/repository/apt')
|
|
303
|
+
expect(Pkg::Paths.apt_package_base_path('ubuntu-18.04-amd64', 'puppet6', 'puppet-agent'))
|
|
304
|
+
.to eq('/opt/repository/apt/pool/bionic/puppet6/p/puppet-agent')
|
|
305
|
+
expect(Pkg::Paths.apt_package_base_path('debian-9-amd64', 'puppet6', 'bolt-server'))
|
|
306
|
+
.to eq('/opt/repository/apt/pool/stretch/puppet6/b/bolt-server')
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
end
|
|
310
|
+
it 'returns the appropriate nonfinal repo path' do
|
|
311
|
+
allow(Pkg::Paths).to receive(:remote_repo_base).and_return('/opt/repository-nightlies/apt')
|
|
312
|
+
expect(Pkg::Paths.apt_package_base_path('ubuntu-18.04-amd64', 'puppet6-nightly',
|
|
313
|
+
'puppet-agent', true))
|
|
314
|
+
.to eq('/opt/repository-nightlies/apt/pool/bionic/puppet6-nightly/p/puppet-agent')
|
|
315
|
+
expect(Pkg::Paths.apt_package_base_path('debian-10-amd64', 'puppet6-nightly',
|
|
316
|
+
'pdk', true))
|
|
317
|
+
.to eq('/opt/repository-nightlies/apt/pool/buster/puppet6-nightly/p/pdk')
|
|
318
|
+
end
|
|
253
319
|
end
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
320
|
+
|
|
321
|
+
context 'for puppet 7 and after' do
|
|
322
|
+
it 'returns the approprate apt repo path' do
|
|
323
|
+
allow(Pkg::Paths).to receive(:remote_repo_base).and_return('/opt/repository/apt')
|
|
324
|
+
expect(Pkg::Paths.apt_package_base_path('ubuntu-18.04-amd64', 'FUTURE-puppet7', 'puppet-agent'))
|
|
325
|
+
.to eq('/opt/repository/apt/FUTURE-puppet7/pool/bionic/p/puppet-agent')
|
|
326
|
+
expect(Pkg::Paths.apt_package_base_path('ubuntu-20.04-amd64', 'FUTURE-puppet7', 'puppet-agent'))
|
|
327
|
+
.to eq('/opt/repository/apt/FUTURE-puppet7/pool/focal/p/puppet-agent')
|
|
328
|
+
end
|
|
329
|
+
it 'returns the appropriate nonfinal repo path' do
|
|
330
|
+
allow(Pkg::Paths).to receive(:remote_repo_base).and_return('/opt/repository-nightlies/apt')
|
|
331
|
+
expect(Pkg::Paths.apt_package_base_path('debian-10-amd64', 'FUTURE-puppet7-nightly', 'pdk', true))
|
|
332
|
+
.to eq('/opt/repository-nightlies/apt/FUTURE-puppet7-nightly/pool/buster/p/pdk')
|
|
333
|
+
end
|
|
258
334
|
end
|
|
259
335
|
end
|
|
260
336
|
|
|
261
337
|
describe '#release_package_link_path' do
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
338
|
+
context 'for puppet 6' do
|
|
339
|
+
repo_name = 'puppet6'
|
|
340
|
+
nonfinal_repo_name = 'puppet6-nightly'
|
|
341
|
+
yum_repo_path = '/opt/repository/yum'
|
|
342
|
+
apt_repo_path = '/opt/repository/apt'
|
|
343
|
+
nonfinal_yum_repo_path = '/opt/repository-nightlies/yum'
|
|
344
|
+
nonfinal_apt_repo_path = '/opt/repository-nightlies/apt'
|
|
345
|
+
before :each do
|
|
346
|
+
allow(Pkg::Config).to receive(:repo_name).and_return(repo_name)
|
|
347
|
+
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nonfinal_repo_name)
|
|
348
|
+
allow(Pkg::Config).to receive(:yum_repo_path).and_return(yum_repo_path)
|
|
349
|
+
allow(Pkg::Config).to receive(:apt_repo_path).and_return(apt_repo_path)
|
|
350
|
+
allow(Pkg::Config).to receive(:nonfinal_yum_repo_path).and_return(nonfinal_yum_repo_path)
|
|
351
|
+
allow(Pkg::Config).to receive(:nonfinal_apt_repo_path).and_return(nonfinal_apt_repo_path)
|
|
352
|
+
end
|
|
353
|
+
it 'returns the appropriate link path for rpm release packages' do
|
|
354
|
+
expect(Pkg::Paths.release_package_link_path('sles-12-ppc64le'))
|
|
355
|
+
.to eq("#{yum_repo_path}/#{repo_name}-release-sles-12.noarch.rpm")
|
|
356
|
+
end
|
|
357
|
+
it 'returns the appropriate link path for deb release packages' do
|
|
358
|
+
expect(Pkg::Paths.release_package_link_path('ubuntu-16.04-amd64'))
|
|
359
|
+
.to eq("#{apt_repo_path}/#{repo_name}-release-xenial.deb")
|
|
360
|
+
end
|
|
361
|
+
it 'returns the appropriate link path for nonfinal rpm release packages' do
|
|
362
|
+
expect(Pkg::Paths.release_package_link_path('el-7-x86_64', true))
|
|
363
|
+
.to eq("#{nonfinal_yum_repo_path}/#{nonfinal_repo_name}-release-el-7.noarch.rpm")
|
|
364
|
+
end
|
|
365
|
+
it 'returns the appropriate link path for nonfinal deb release packages' do
|
|
366
|
+
expect(Pkg::Paths.release_package_link_path('debian-9-i386', true))
|
|
367
|
+
.to eq("#{nonfinal_apt_repo_path}/#{nonfinal_repo_name}-release-stretch.deb")
|
|
368
|
+
end
|
|
369
|
+
it 'returns nil for package formats that do not have release packages' do
|
|
370
|
+
expect(Pkg::Paths.release_package_link_path('osx-10.15-x86_64')).to eq(nil)
|
|
371
|
+
expect(Pkg::Paths.release_package_link_path('windows-2012-x86')).to eq(nil)
|
|
372
|
+
end
|
|
287
373
|
end
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
374
|
+
|
|
375
|
+
context 'for puppet 7' do
|
|
376
|
+
repo_name = 'FUTURE-puppet7'
|
|
377
|
+
nonfinal_repo_name = 'FUTURE-puppet7-nightly'
|
|
378
|
+
yum_repo_path = '/opt/repository/yum'
|
|
379
|
+
apt_repo_path = '/opt/repository/apt'
|
|
380
|
+
nonfinal_yum_repo_path = '/opt/repository-nightlies/yum'
|
|
381
|
+
nonfinal_apt_repo_path = '/opt/repository-nightlies/apt'
|
|
382
|
+
before :each do
|
|
383
|
+
allow(Pkg::Config).to receive(:repo_name).and_return(repo_name)
|
|
384
|
+
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nonfinal_repo_name)
|
|
385
|
+
allow(Pkg::Config).to receive(:yum_repo_path).and_return(yum_repo_path)
|
|
386
|
+
allow(Pkg::Config).to receive(:apt_repo_path).and_return(apt_repo_path)
|
|
387
|
+
allow(Pkg::Config).to receive(:nonfinal_yum_repo_path).and_return(nonfinal_yum_repo_path)
|
|
388
|
+
allow(Pkg::Config).to receive(:nonfinal_apt_repo_path).and_return(nonfinal_apt_repo_path)
|
|
389
|
+
end
|
|
390
|
+
it 'returns the appropriate link path for rpm release packages' do
|
|
391
|
+
expect(Pkg::Paths.release_package_link_path('sles-12-ppc64le'))
|
|
392
|
+
.to eq("#{yum_repo_path}/#{repo_name}-release-sles-12.noarch.rpm")
|
|
393
|
+
end
|
|
394
|
+
it 'returns the appropriate link path for deb release packages' do
|
|
395
|
+
expect(Pkg::Paths.release_package_link_path('ubuntu-20.04-amd64'))
|
|
396
|
+
.to eq("#{apt_repo_path}/#{repo_name}-release-focal.deb")
|
|
397
|
+
end
|
|
398
|
+
it 'returns the appropriate link path for nonfinal rpm release packages' do
|
|
399
|
+
expect(Pkg::Paths.release_package_link_path('el-8-x86_64', true))
|
|
400
|
+
.to eq("#{nonfinal_yum_repo_path}/#{nonfinal_repo_name}-release-el-8.noarch.rpm")
|
|
401
|
+
end
|
|
402
|
+
it 'returns the appropriate link path for nonfinal deb release packages' do
|
|
403
|
+
expect(Pkg::Paths.release_package_link_path('debian-10-i386', true))
|
|
404
|
+
.to eq("#{nonfinal_apt_repo_path}/#{nonfinal_repo_name}-release-buster.deb")
|
|
405
|
+
end
|
|
406
|
+
it 'returns nil for package formats that do not have release packages' do
|
|
407
|
+
expect(Pkg::Paths.release_package_link_path('osx-10.15-x86_64')).to eq(nil)
|
|
408
|
+
expect(Pkg::Paths.release_package_link_path('windows-2012-x86')).to eq(nil)
|
|
409
|
+
end
|
|
291
410
|
end
|
|
292
411
|
end
|
|
293
412
|
end
|