packaging 0.99.57 → 0.99.62

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a26342fa551df9cbae2afbc9b8c1c03aa03bd7001ef16511598013735d1b400
4
- data.tar.gz: d29a92aa8e936a01df40db513e02e98763c0e6a74a8a5801ad47a242f4e4b67b
3
+ metadata.gz: 51f93e35b2b4e64053f41aef02546deaa59b2ef0f5ee2c84839f1caf5f5a678c
4
+ data.tar.gz: f5d99ceffa53426ff02533f901cc80080fb4202b0c53ccc34094e2c5cd2a6049
5
5
  SHA512:
6
- metadata.gz: 3bfafe308304409ca317f83c3fc514607a9732fb064c040fe6a12f35eb8282620d3c9c3acf58acfa66d2c269318b8938a83126c10fecf546b8be61cc4350e540
7
- data.tar.gz: cde4572cbe48d14bd039d7b8e94bedc2d3584a674637a47a1310049180a651661ed7e450af2977b15bae435b0bc8bb6fb44e371f36922507311ebe02941f6107
6
+ metadata.gz: f1dbac744ef49d74eeb5c7cbf0e5afa2b4cf8d23d1984ca79a5af78a78165044ebc9008e3ad747bb7205156b7dae22e0b366a7cb50fcf50393133ef4316759d1
7
+ data.tar.gz: d8338b79efa5280c0a72d33b6a1b4de28b0ee25d265e2ea33f786786c33c3ce97aa4238d8bdc90ed726f2acef4231e918ba451207616d3261aa4e865df5a1a4c
@@ -2,67 +2,7 @@ require 'artifactory'
2
2
  require 'uri'
3
3
  require 'open-uri'
4
4
  require 'digest'
5
-
6
- #
7
- # [eric.griswold] This is unfortunate. The 'pattern_search' class method really does belong in
8
- # the Artifactory gem. However, because of some of Chef's social policies,
9
- # I am unwilling to contribute this code there. If that changes, I'll submit a PR. Until
10
- # then, it'll live here.
11
- #
12
- module Artifactory
13
- class Resource::Artifact
14
- #
15
- # Search for an artifact in a repo using an Ant-like pattern.
16
- # Unlike many Artifactory searches, this one is restricted to a single
17
- # repository.
18
- #
19
- # @example Search in a repository named 'foo_local' for an artifact in a directory containing
20
- # the word "recent", named "artifact[0-9].txt"
21
- # Artifact.pattern_search(pattern: '*recent*/artifact[0-9].txt',
22
- # repo: 'foo_local')
23
- #
24
- # @param [Hash] options
25
- # A hash of options, as follows:
26
- #
27
- # @option options [Artifactory::Client] :client
28
- # the client object to make the request with
29
- # @option options [String] :pattern
30
- # the Ant-like pattern to use for finding artifacts within the repos. Note that the
31
- # Ant pattern '**' is barred in this case by JFrog.
32
- # @option options [String] :repo
33
- # the repo to search
34
- #
35
- # @return [Array<Resource::Artifact>]
36
- # a list of artifacts that match the query
37
- #
38
- def self.pattern_search(options = {})
39
- client = extract_client!(options)
40
- params = Util.slice(options, :pattern, :repo)
41
- pattern_search_parameter = { :pattern => "#{params[:repo]}:#{params[:pattern]}" }
42
- response = client.get('/api/search/pattern', pattern_search_parameter)
43
- return [] if response['files'].nil? || response['files'].empty?
44
-
45
- # A typical response:
46
- # {
47
- # "repoUri"=>"https:<artifactory endpoint>/<repo>",
48
- # "sourcePattern"=>"<repo>:<provided search pattern>",
49
- # "files"=>[<filename that matched pattern>, ...]
50
- # }
51
- #
52
- # Inserting '/api/storage' before the repo makes the 'from_url' call work correctly.
53
- #
54
- repo_uri = response['repoUri']
55
- unless repo_uri.include?('/api/storage/')
56
- # rubocop:disable Style/PercentLiteralDelimiters
57
- repo_uri.sub!(%r(/#{params[:repo]}$), "/api/storage/#{params[:repo]}")
58
- end
59
- response['files'].map do |file_path|
60
- from_url("#{repo_uri}/#{file_path}", client: client)
61
- end
62
- end
63
- end
64
- end
65
-
5
+ require 'packaging/artifactory/extensions'
66
6
 
67
7
  module Pkg
68
8
 
@@ -111,7 +51,6 @@ module Pkg
111
51
  def location_for(platform_tag)
112
52
  toplevel_repo = DEFAULT_REPO_TYPE
113
53
  repo_subdirectories = File.join(@repo_base, @project, @project_version)
114
- alternate_subdirectories = repo_subdirectories
115
54
 
116
55
  unless platform_tag == DEFAULT_REPO_TYPE
117
56
  format = Pkg::Platforms.package_format_for_tag(platform_tag)
@@ -122,20 +61,16 @@ module Pkg
122
61
  when 'rpm'
123
62
  toplevel_repo = 'rpm'
124
63
  repo_subdirectories = File.join(repo_subdirectories, "#{platform}-#{version}-#{architecture}")
125
- alternate_subdirectories = repo_subdirectories
126
64
  when 'deb'
127
65
  toplevel_repo = 'debian__local'
128
66
  repo_subdirectories = File.join(repo_subdirectories, "#{platform}-#{version}")
129
- alternate_subdirectories = File.join('pool', repo_subdirectories)
130
67
  when 'swix', 'dmg', 'svr4', 'ips'
131
68
  repo_subdirectories = File.join(repo_subdirectories, "#{platform}-#{version}-#{architecture}")
132
- alternate_subdirectories = repo_subdirectories
133
69
  when 'msi'
134
70
  repo_subdirectories = File.join(repo_subdirectories, "#{platform}-#{architecture}")
135
- alternate_subdirectories = repo_subdirectories
136
71
  end
137
72
 
138
- [toplevel_repo, repo_subdirectories, alternate_subdirectories]
73
+ [toplevel_repo, repo_subdirectories]
139
74
  end
140
75
 
141
76
  # @param platform_tag [String] The platform tag specific to the information
@@ -150,8 +85,8 @@ module Pkg
150
85
  end
151
86
  end
152
87
 
153
- repo_name, repo_subdirectories, alternate_subdirectories = location_for(platform_tag)
154
- full_artifactory_path = File.join(repo_name, alternate_subdirectories)
88
+ repo_name, repo_subdirectories = location_for(platform_tag)
89
+ full_artifactory_path = File.join(repo_name, repo_subdirectories)
155
90
 
156
91
  {
157
92
  platform: platform,
@@ -161,7 +96,6 @@ module Pkg
161
96
  package_format: package_format,
162
97
  repo_name: repo_name,
163
98
  repo_subdirectories: repo_subdirectories,
164
- alternate_subdirectories: alternate_subdirectories,
165
99
  full_artifactory_path: full_artifactory_path
166
100
  }
167
101
  end
@@ -235,7 +169,7 @@ module Pkg
235
169
  #
236
170
  # Currently we are including everything that would be included in the yaml
237
171
  # file that is generated at package build time.
238
- def deploy_properties(platform_tag)
172
+ def deploy_properties(platform_tag, file_name)
239
173
  data = platform_specific_data(platform_tag)
240
174
 
241
175
  # TODO This method should be returning the entire contents of the yaml
@@ -246,10 +180,15 @@ module Pkg
246
180
  #properties_hash = Pkg::Config.config_to_hash
247
181
  properties_hash = {}
248
182
  if data[:package_format] == 'deb'
183
+ architecture = data[:architecture]
184
+ # set arch correctly for noarch packages
185
+ if file_name =~ /_all\.deb$/
186
+ architecture = 'all'
187
+ end
249
188
  properties_hash.merge!({
250
189
  'deb.distribution' => data[:codename],
251
190
  'deb.component' => data[:repo_subdirectories],
252
- 'deb.architecture' => data[:architecture],
191
+ 'deb.architecture' => architecture,
253
192
  })
254
193
  end
255
194
  properties_hash
@@ -281,8 +220,8 @@ module Pkg
281
220
  headers = { "X-Checksum-Md5" => artifact_md5 }
282
221
  artifact.upload(
283
222
  data[:repo_name],
284
- File.join(data[:alternate_subdirectories], File.basename(package)),
285
- deploy_properties(platform_tag),
223
+ File.join(data[:repo_subdirectories], File.basename(package)),
224
+ deploy_properties(platform_tag, File.basename(package)),
286
225
  headers
287
226
  )
288
227
  rescue
@@ -408,18 +347,34 @@ module Pkg
408
347
  # Using the manifest provided by enterprise-dist, grab the appropropriate packages from artifactory based on md5sum
409
348
  # @param staging_directory [String] location to download packages to
410
349
  # @param manifest [File] JSON file containing information about what packages to download and the corresponding md5sums
411
- def download_packages(staging_directory, manifest)
350
+ # @param remote_path [String] Optional partial path on the remote host containing packages
351
+ # Used to specify which subdirectories packages will be downloaded from.
352
+ def download_packages(staging_directory, manifest, remote_path = '')
412
353
  check_authorization
413
354
  manifest.each do |dist, packages|
414
355
  puts "Grabbing the #{dist} packages from artifactory"
415
356
  packages.each do |name, info|
416
- artifact_to_download = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: ["rpm_enterprise__local", "debian_enterprise__local"]).first
357
+ filename = info['filename']
358
+ artifacts = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: ["rpm_enterprise__local", "debian_enterprise__local"], name: filename)
359
+ artifact_to_download = artifacts.select { |artifact| artifact.download_uri.include? remote_path }.first
360
+ # If we found matching artifacts, but not in the correct path, copy the artifact to the correct path
361
+ # This should help us keep repos up to date with the packages we are expecting to be there
362
+ # while helping us avoid 'what the hell, could not find package' errors
363
+ if artifact_to_download.nil? && !artifacts.empty?
364
+ artifact_to_copy = artifacts.first
365
+ copy_artifact(artifact_to_copy, artifact_to_copy.repo, "#{remote_path}/#{dist}/#{filename}")
366
+ artifacts = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: ["rpm_enterprise__local", "debian_enterprise__local"], name: filename)
367
+ artifact_to_download = artifacts.select { |artifact| artifact.download_uri.include? remote_path }.first
368
+ end
369
+
417
370
  if artifact_to_download.nil?
418
- filename = info["filename"] || info["name"]
419
- raise "Error: what the hell, could not find package #{filename} with md5sum #{info["md5"]}"
371
+ message = "Error: what the hell, could not find package #{filename} with md5sum #{info["md5"]}"
372
+ unless remote_path.empty?
373
+ message += " in #{remote_path}"
374
+ end
375
+ raise message
420
376
  else
421
377
  full_staging_path = "#{staging_directory}/#{dist}"
422
- filename = info['filename'] || File.basename(artifact_to_download.download_uri)
423
378
  puts "downloading #{artifact_to_download.download_uri} to #{File.join(full_staging_path, filename)}"
424
379
  artifact_to_download.download(full_staging_path, filename: filename)
425
380
  end
@@ -454,14 +409,19 @@ module Pkg
454
409
  # @param local_path [String] local path to file to upload
455
410
  # @param target_repo [String] repo on artifactory to upload to
456
411
  # @param target_path [String] path within target_repo to upload to
457
- def upload_file(local_path, target_repo, target_path)
412
+ # @param properties [Hash] Optional property names and values to assign the uploaded file
413
+ # For example, this would set both the 'cleanup.skip' and 'deb.component' properties:
414
+ # \{ "cleanup.skip" => true, "deb.component" => 'bionic' \}
415
+ # @param headers [Hash] Optional upload headers, most likely checksums, for the upload request
416
+ # "X-Checksum-Md5" and "X-Checksum-Sha1" are typical
417
+ def upload_file(local_path, target_repo, target_path, properties = {}, headers = {})
458
418
  fail "Error: Couldn't find file at #{local_path}." unless File.exist? local_path
459
419
  check_authorization
460
420
  artifact = Artifactory::Resource::Artifact.new(local_path: local_path)
461
421
  full_upload_path = File.join(target_path, File.basename(local_path))
462
422
  begin
463
423
  puts "Uploading #{local_path} to #{target_repo}/#{full_upload_path} . . ."
464
- artifact.upload(target_repo, full_upload_path)
424
+ artifact.upload(target_repo, full_upload_path, properties, headers)
465
425
  rescue Artifactory::Error::HTTPError => e
466
426
  fail "Error: Upload failed. Ensure path #{target_path} exists in the #{target_repo} repository."
467
427
  end
@@ -583,6 +543,33 @@ module Pkg
583
543
  end
584
544
  end
585
545
 
546
+ # Copy an artifact to a target repo/path
547
+ #
548
+ # @param artifact [Artifactory::Resource::Artifact] The artifact to be copied
549
+ # @param target_repo [String] The repository to copy the artifact to
550
+ # @param target_path [String] The path in the target repository to copy the artifact to
551
+ # @param target_debian_component [String] `deb.component` property to set on the copied artifact
552
+ # defaults to `Pkg::Paths.debian_component_from_path(target_path)`
553
+ def copy_artifact(artifact, target_repo, target_path, target_debian_component = nil)
554
+ filename = File.basename(artifact.download_uri)
555
+ artifactory_target_path = "#{target_repo}/#{target_path}"
556
+ puts "Copying #{artifact.download_uri} to #{artifactory_target_path}"
557
+ begin
558
+ artifact.copy(artifactory_target_path)
559
+ rescue Artifactory::Error::HTTPError
560
+ STDERR.puts "Could not copy #{artifactory_target_path}. Source and destination are the same. Skipping..."
561
+ end
562
+
563
+ if File.extname(filename) == '.deb'
564
+ target_debian_component ||= Pkg::Paths.debian_component_from_path(target_path)
565
+ copied_artifact_search = search_with_path(filename, target_repo, target_path)
566
+ fail "Error: what the hell, could not find just-copied package #{filename} under #{target_repo}/#{target_path}" if copied_artifact_search.empty?
567
+ copied_artifact = copied_artifact_search.first
568
+ properties = { 'deb.component' => target_debian_component }
569
+ copied_artifact.properties(properties)
570
+ end
571
+ end
572
+
586
573
  # When we cut a new PE branch, we need to copy the pe components into <pe_version>/{repos,feature,release}/<platform>
587
574
  # @param manifest [File] JSON file containing information about what packages to download and the corresponding md5sums
588
575
  # @param target_path [String] path on artifactory to copy components to, e.g. <pe_version>/release
@@ -591,26 +578,12 @@ module Pkg
591
578
  manifest.each do |dist, packages|
592
579
  puts "Copying #{dist} packages..."
593
580
  packages.each do |name, info|
594
- artifact = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: ["rpm_enterprise__local", "debian_enterprise__local"]).first
581
+ filename = info["filename"]
582
+ artifact = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: ["rpm_enterprise__local", "debian_enterprise__local"], name: filename).first
595
583
  if artifact.nil?
596
- filename = info["filename"] || info["name"]
597
584
  raise "Error: what the hell, could not find package #{filename} with md5sum #{info["md5"]}"
598
585
  end
599
- begin
600
- filename = info["filename"] || File.basename(artifact.download_uri)
601
- artifact_target_path = "#{artifact.repo}/#{target_path}/#{dist}/#{filename}"
602
- puts "Copying #{artifact.download_uri} to #{artifact_target_path}"
603
- artifact.copy(artifact_target_path)
604
- rescue Artifactory::Error::HTTPError
605
- STDERR.puts "Could not copy #{artifact_target_path}. Source and destination are the same. Skipping..."
606
- end
607
- if File.extname(filename) == '.deb'
608
- copied_artifact_search = Artifactory::Resource::Artifact.pattern_search(repo: 'debian_enterprise__local', pattern: "#{target_path}/*/#{filename}")
609
- fail "Error: what the hell, could not find just-copied package #{filename} under debian_enterprise__local/#{target_path}" if copied_artifact_search.nil?
610
- copied_artifact = copied_artifact_search.first
611
- properties = { 'deb.component' => Pkg::Paths.debian_component_from_path(target_path) }
612
- copied_artifact.properties(properties)
613
- end
586
+ copy_artifact(artifact, artifact.repo, "#{target_path}/#{dist}/#{filename}")
614
587
  end
615
588
  end
616
589
  end
@@ -639,7 +612,8 @@ module Pkg
639
612
  manifest.each do |dist, packages|
640
613
  packages.each do |package_name, info|
641
614
  next unless package_name == package
642
- artifacts = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: repos)
615
+ filename = info["filename"]
616
+ artifacts = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: repos, name: filename)
643
617
  artifacts.each do |artifact|
644
618
  next unless artifact.download_uri.include? remote_path
645
619
  puts "Removing reverted package #{artifact.download_uri}"
@@ -659,7 +633,7 @@ module Pkg
659
633
  Dir.foreach("#{tarball_path}/") do |pe_tarball|
660
634
  next if pe_tarball == '.' || pe_tarball == ".."
661
635
  md5 = Digest::MD5.file("#{tarball_path}/#{pe_tarball}").hexdigest
662
- artifacts_to_delete = Artifactory::Resource::Artifact.checksum_search(md5: md5, repos: pe_repo)
636
+ artifacts_to_delete = Artifactory::Resource::Artifact.checksum_search(md5: md5, repos: pe_repo, name: pe_tarball)
663
637
  next if artifacts_to_delete.nil?
664
638
  begin
665
639
  artifacts_to_delete.each do |artifact|
@@ -0,0 +1,94 @@
1
+ require 'artifactory'
2
+
3
+ module ArtifactoryExtensions
4
+ module ClassMethods
5
+ #
6
+ # Search for an artifact in a repo using an Ant-like pattern.
7
+ # Unlike many Artifactory searches, this one is restricted to a single
8
+ # repository.
9
+ #
10
+ # @example Search in a repository named 'foo_local' for an artifact in a directory containing
11
+ # the word "recent", named "artifact[0-9].txt"
12
+ # Artifact.pattern_search(pattern: '*recent*/artifact[0-9].txt',
13
+ # repo: 'foo_local')
14
+ #
15
+ # @param [Hash] options
16
+ # A hash of options, as follows:
17
+ #
18
+ # @option options [Artifactory::Client] :client
19
+ # the client object to make the request with
20
+ # @option options [String] :pattern
21
+ # the Ant-like pattern to use for finding artifacts within the repos. Note that the
22
+ # Ant pattern '**' is barred in this case by JFrog.
23
+ # @option options [String] :repo
24
+ # the repo to search
25
+ #
26
+ # @return [Array<Resource::Artifact>]
27
+ # a list of artifacts that match the query
28
+ #
29
+ def pattern_search(options = {})
30
+ client = extract_client!(options)
31
+ params = Util.slice(options, :pattern, :repo)
32
+ pattern_search_parameter = { :pattern => "#{params[:repo]}:#{params[:pattern]}" }
33
+ response = client.get('/api/search/pattern', pattern_search_parameter)
34
+ return [] if response['files'].nil? || response['files'].empty?
35
+
36
+ # A typical response:
37
+ # {
38
+ # "repoUri"=>"https:<artifactory endpoint>/<repo>",
39
+ # "sourcePattern"=>"<repo>:<provided search pattern>",
40
+ # "files"=>[<filename that matched pattern>, ...]
41
+ # }
42
+ #
43
+ # Inserting '/api/storage' before the repo makes the 'from_url' call work correctly.
44
+ #
45
+ repo_uri = response['repoUri']
46
+ unless repo_uri.include?('/api/storage/')
47
+ # rubocop:disable Style/PercentLiteralDelimiters
48
+ repo_uri.sub!(%r(/#{params[:repo]}$), "/api/storage/#{params[:repo]}")
49
+ end
50
+ response['files'].map do |file_path|
51
+ from_url("#{repo_uri}/#{file_path}", client: client)
52
+ end
53
+ end
54
+
55
+ # This adds the `exact_match` option to artifactory search, and defaults it
56
+ # to true. With `exact_match` set to `true` the artifact will only be
57
+ # returned if the name in the download uri matches the name we're trying to
58
+ # download
59
+ def search(options = {})
60
+ exact_match = options[:exact_match].nil? ? true : options[:exact_match]
61
+ artifacts = super
62
+
63
+ if exact_match
64
+ artifacts.select! { |artifact| File.basename(artifact.download_uri) == options[:name] }
65
+ end
66
+ artifacts
67
+ end
68
+
69
+ # This adds the `name` option to artifactory checksum search. It defaults to
70
+ # unset. If set, the artifact is only returned if the download uri matches
71
+ # the passed name
72
+ def checksum_search(options = {})
73
+ artifacts = super
74
+ if options[:name]
75
+ artifacts.select! { |artifact| File.basename(artifact.download_uri) == options[:name] }
76
+ end
77
+ artifacts
78
+ end
79
+ end
80
+
81
+ # needed to prepend class methods, see https://stackoverflow.com/questions/18683750/how-to-prepend-classmethods
82
+ def self.prepended(base)
83
+ class << base
84
+ prepend ClassMethods
85
+ end
86
+ end
87
+ end
88
+
89
+ module Artifactory
90
+ class Resource::Artifact
91
+ # use prepend instead of monkeypatching so we can call `super`
92
+ prepend ArtifactoryExtensions
93
+ end
94
+ end
@@ -70,15 +70,6 @@ module Pkg::Paths
70
70
  end
71
71
  end
72
72
 
73
- # Method to determine if files should be shipped to legacy or current path
74
- # structures. Any repo name matching /^puppet/ is a current repo, everything
75
- # else is should be shipped to legacy paths.
76
- #
77
- # @param repo_name The repo name to check
78
- def is_legacy_repo?(repo_name)
79
- repo_name !~ /^puppet/
80
- end
81
-
82
73
  # Method to determine the yum repo name. Maintains compatibility with legacy
83
74
  # projects, where `Pkg::Config.yum_repo_name` is set instead of
84
75
  # `Pkg::Config.repo_name`. Defaults to 'products' if nothing is set.
@@ -110,65 +101,83 @@ module Pkg::Paths
110
101
  return Pkg::Config.repo_link_target
111
102
  end
112
103
 
113
- # TODO: please please please clean this up
114
- # This is so terrible. I really dislike it. But in order to maintain backward
115
- # compatibility, we need to maintain these path differences between PC1 and
116
- # everything else. Once we stop shipping things to PC1, we can remove all the
117
- # PC1 specific cases. That's likely to not happen until the current LTS
118
- # (2016.4) is EOL'd. Hopefully also we do not choose to further change these
119
- # path structures, as it is no bueno.
120
- # --MAS 2017-08-16
121
- def artifacts_base_path_and_link_path(platform_tag, path_prefix = 'artifacts', nonfinal = false)
122
- platform, version, architecture = Pkg::Platforms.parse_platform_tag(platform_tag)
123
- package_format = Pkg::Platforms.package_format_for_tag(platform_tag)
104
+ # Construct a platform-dependent symlink target path.
105
+ def construct_base_path(path_data)
106
+ package_format = path_data[:package_format]
107
+ prefix = path_data[:prefix]
108
+ is_nonfinal = path_data[:is_nonfinal]
109
+ platform_name = path_data[:platform_name]
110
+ platform_tag = path_data[:platform_tag]
124
111
 
125
112
  case package_format
113
+ when 'deb'
114
+ debian_code_name = Pkg::Platforms.get_attribute(platform_tag, :codename)
115
+ return File.join(prefix, debian_code_name, apt_repo_name(is_nonfinal))
116
+ when 'dmg'
117
+ return File.join(prefix, 'mac', repo_name(is_nonfinal))
118
+ when 'msi'
119
+ return File.join(prefix, platform_name, repo_name(is_nonfinal))
126
120
  when 'rpm'
127
- if is_legacy_repo?(yum_repo_name(nonfinal))
128
- [File.join(path_prefix, platform, version, yum_repo_name(nonfinal)), nil]
129
- else
130
- [File.join(path_prefix, yum_repo_name(nonfinal)), link_name(nonfinal).nil? ? nil : File.join(path_prefix, link_name(nonfinal))]
131
- end
121
+ return File.join(prefix, yum_repo_name(is_nonfinal))
132
122
  when 'swix'
133
- if is_legacy_repo?(repo_name(nonfinal))
134
- [File.join(path_prefix, platform, version, repo_name(nonfinal)), nil]
135
- else
136
- [File.join(path_prefix, platform, repo_name(nonfinal)), link_name(nonfinal).nil? ? nil : File.join(path_prefix, platform, link_name(nonfinal))]
137
- end
123
+ return File.join(prefix, platform_name, repo_name(is_nonfinal))
124
+ when 'svr4', 'ips'
125
+ return File.join(prefix, 'solaris', repo_name(is_nonfinal))
126
+ else
127
+ raise "Error: Unknown package format '#{package_format}'"
128
+ end
129
+ end
130
+
131
+ # Construct a platform-dependent link path
132
+ def construct_link_path(path_data)
133
+ package_format = path_data[:package_format]
134
+ prefix = path_data[:prefix]
135
+ platform_name = path_data[:platform_name]
136
+ platform_tag = path_data[:platform_tag]
137
+ link = path_data[:link]
138
+
139
+ return nil if link.nil?
140
+
141
+ case package_format
142
+ when 'rpm'
143
+ return File.join(prefix, link)
144
+ when 'swix'
145
+ return File.join(prefix, platform_name, link)
138
146
  when 'deb'
139
- [File.join(path_prefix, Pkg::Platforms.get_attribute(platform_tag, :codename), apt_repo_name(nonfinal)),
140
- link_name(nonfinal).nil? ? nil : File.join(path_prefix, Pkg::Platforms.get_attribute(platform_tag, :codename), link_name(nonfinal))]
147
+ debian_code_name = Pkg::Platforms.get_attribute(platform_tag, :codename)
148
+ return File.join(prefix, debian_code_name, link)
141
149
  when 'svr4', 'ips'
142
- if is_legacy_repo?(repo_name(nonfinal))
143
- [File.join(path_prefix, 'solaris', repo_name(nonfinal), version), nil]
144
- else
145
- [File.join(path_prefix, 'solaris', repo_name(nonfinal)), link_name(nonfinal).nil? ? nil : File.join(path_prefix, 'solaris', link_name(nonfinal))]
146
- end
150
+ return File.join(prefix, 'solaris', link)
147
151
  when 'dmg'
148
- if is_legacy_repo?(repo_name(nonfinal))
149
- [File.join(path_prefix, 'mac', version, repo_name(nonfinal)), nil]
150
- else
151
- [File.join(path_prefix, 'mac', repo_name(nonfinal)), link_name(nonfinal).nil? ? nil : File.join(path_prefix, 'mac', link_name(nonfinal))]
152
- end
152
+ return File.join(prefix, 'mac', link)
153
153
  when 'msi'
154
- if is_legacy_repo?(repo_name(nonfinal))
155
- [File.join(path_prefix, 'windows'), nil]
156
- else
157
- [File.join(path_prefix, platform, repo_name(nonfinal)), link_name(nonfinal).nil? ? nil : File.join(path_prefix, platform, link_name(nonfinal))]
158
- end
154
+ return File.join(prefix, platform, link)
159
155
  else
160
- raise "Not sure where to find packages with a package format of '#{package_format}'"
156
+ raise "Error: Unknown package format '#{package_format}'"
161
157
  end
162
158
  end
163
159
 
164
- # TODO: please please please clean this up
165
- # This is so terrible. I really dislike it. But in order to maintain backward
166
- # compatibility, we need to maintain these path differences between PC1 and
167
- # everything else. Once we stop shipping things to PC1, we can remove all the
168
- # PC1 specific cases. That's likely to not happen until the current LTS
169
- # (2016.4) is EOL'd. Hopefully also we do not choose to further change these
170
- # path structures, as it is no bueno.
171
- # --MAS 2017-08-16
160
+ # Given platform information, create symlink target (base_path) and link path in the
161
+ # form of a 2-element array
162
+ def artifacts_base_path_and_link_path(platform_tag, prefix = 'artifacts', is_nonfinal = false)
163
+ platform_name, _ = Pkg::Platforms.parse_platform_tag(platform_tag)
164
+ package_format = Pkg::Platforms.package_format_for_tag(platform_tag)
165
+
166
+ path_data = {
167
+ is_nonfinal: is_nonfinal,
168
+ link: link_name(is_nonfinal),
169
+ package_format: package_format,
170
+ platform_name: platform_name,
171
+ platform_tag: platform_tag,
172
+ prefix: prefix
173
+ }
174
+
175
+ return [
176
+ construct_base_path(path_data),
177
+ construct_link_path(path_data)
178
+ ]
179
+ end
180
+
172
181
  def artifacts_path(platform_tag, path_prefix = 'artifacts', nonfinal = false)
173
182
  base_path, _ = artifacts_base_path_and_link_path(platform_tag, path_prefix, nonfinal)
174
183
  platform, version, architecture = Pkg::Platforms.parse_platform_tag(platform_tag)
@@ -176,31 +185,15 @@ module Pkg::Paths
176
185
 
177
186
  case package_format
178
187
  when 'rpm'
179
- if is_legacy_repo?(yum_repo_name(nonfinal))
180
- File.join(base_path, architecture)
181
- else
182
- File.join(base_path, platform, version, architecture)
183
- end
188
+ File.join(base_path, platform, version, architecture)
184
189
  when 'swix'
185
- if is_legacy_repo?(repo_name(nonfinal))
186
- File.join(base_path, architecture)
187
- else
188
- File.join(base_path, version, architecture)
189
- end
190
+ File.join(base_path, version, architecture)
190
191
  when 'deb'
191
192
  base_path
192
193
  when 'svr4', 'ips'
193
- if is_legacy_repo?(repo_name(nonfinal))
194
- base_path
195
- else
196
- File.join(base_path, version)
197
- end
194
+ File.join(base_path, version)
198
195
  when 'dmg'
199
- if is_legacy_repo?(repo_name(nonfinal))
200
- File.join(base_path, architecture)
201
- else
202
- File.join(base_path, version, architecture)
203
- end
196
+ File.join(base_path, version, architecture)
204
197
  when 'msi'
205
198
  base_path
206
199
  else
@@ -304,9 +297,18 @@ module Pkg::Paths
304
297
  end
305
298
 
306
299
  def debian_component_from_path(path)
307
- matches = path.match(/(\d+\.\d+)\/(\w+)/)
300
+ # substitute '.' and '/' since those aren't valid characters for debian components
301
+ matches = path.match(/([\d+\.\d+|master])\/(\w+)/)
302
+ regex_for_substitution = /[\.\/]/
308
303
  fail "Error: Could not determine Debian Component from path #{path}" if matches.nil?
309
- return matches[1] if matches[2] == 'repos'
310
- return matches[0]
304
+ base_component = matches[1]
305
+ component_qualifier = matches[2]
306
+ full_component = "#{base_component}/#{component_qualifier}"
307
+ unless regex_for_substitution.nil?
308
+ base_component.gsub!(regex_for_substitution, '_')
309
+ full_component.gsub!(regex_for_substitution, '_')
310
+ end
311
+ return base_component if component_qualifier == 'repos'
312
+ return full_component
311
313
  end
312
314
  end
@@ -47,26 +47,7 @@ module Pkg
47
47
  },
48
48
  },
49
49
 
50
- 'cumulus' => {
51
- '2.2' => {
52
- codename: 'cumulus',
53
- architectures: ['amd64'],
54
- source_architecture: 'source',
55
- package_format: 'deb',
56
- source_package_formats: DEBIAN_SOURCE_FORMATS,
57
- repo: true,
58
- },
59
- },
60
-
61
50
  'debian' => {
62
- '7' => {
63
- codename: 'wheezy',
64
- architectures: ['amd64', 'i386'],
65
- source_architecture: 'source',
66
- package_format: 'deb',
67
- source_package_formats: DEBIAN_SOURCE_FORMATS,
68
- repo: true,
69
- },
70
51
  '8' => {
71
52
  codename: 'jessie',
72
53
  architectures: ['amd64', 'i386', 'powerpc'],
@@ -103,7 +84,7 @@ module Pkg
103
84
  repo: true,
104
85
  },
105
86
  '6' => {
106
- architectures: ['x86_64', 'i386', 's390x'],
87
+ architectures: ['x86_64', 'i386'],
107
88
  source_architecture: 'SRPMS',
108
89
  package_format: 'rpm',
109
90
  source_package_formats: ['src.rpm'],
@@ -111,7 +92,7 @@ module Pkg
111
92
  repo: true,
112
93
  },
113
94
  '7' => {
114
- architectures: ['x86_64', 's390x', 'ppc64le', 'aarch64'],
95
+ architectures: ['x86_64', 'ppc64le', 'aarch64'],
115
96
  source_architecture: 'SRPMS',
116
97
  package_format: 'rpm',
117
98
  source_package_formats: ['src.rpm'],
@@ -137,78 +118,6 @@ module Pkg
137
118
  },
138
119
 
139
120
  'fedora' => {
140
- 'f25' => {
141
- architectures: ['x86_64', 'i386'],
142
- source_architecture: 'SRPMS',
143
- package_format: 'rpm',
144
- source_package_formats: ['src.rpm'],
145
- signature_format: 'v4',
146
- repo: true,
147
- },
148
- 'f26' => {
149
- architectures: ['x86_64'],
150
- source_architecture: 'SRPMS',
151
- package_format: 'rpm',
152
- source_package_formats: ['src.rpm'],
153
- signature_format: 'v4',
154
- repo: true,
155
- },
156
- 'f27' => {
157
- architectures: ['x86_64'],
158
- source_architecture: 'SRPMS',
159
- package_format: 'rpm',
160
- source_package_formats: ['src.rpm'],
161
- signature_format: 'v4',
162
- repo: true,
163
- },
164
- 'f28' => {
165
- architectures: ['x86_64'],
166
- source_architecture: 'SRPMS',
167
- package_format: 'rpm',
168
- source_package_formats: ['src.rpm'],
169
- signature_format: 'v4',
170
- repo: true,
171
- },
172
- '25' => {
173
- architectures: ['x86_64', 'i386'],
174
- source_architecture: 'SRPMS',
175
- package_format: 'rpm',
176
- source_package_formats: ['src.rpm'],
177
- signature_format: 'v4',
178
- repo: true,
179
- },
180
- '26' => {
181
- architectures: ['x86_64'],
182
- source_architecture: 'SRPMS',
183
- package_format: 'rpm',
184
- source_package_formats: ['src.rpm'],
185
- signature_format: 'v4',
186
- repo: true,
187
- },
188
- '27' => {
189
- architectures: ['x86_64'],
190
- source_architecture: 'SRPMS',
191
- package_format: 'rpm',
192
- source_package_formats: ['src.rpm'],
193
- signature_format: 'v4',
194
- repo: true,
195
- },
196
- '28' => {
197
- architectures: ['x86_64'],
198
- source_architecture: 'SRPMS',
199
- package_format: 'rpm',
200
- source_package_formats: ['src.rpm'],
201
- signature_format: 'v4',
202
- repo: true,
203
- },
204
- '29' => {
205
- architectures: ['x86_64'],
206
- source_architecture: 'SRPMS',
207
- package_format: 'rpm',
208
- source_package_formats: ['src.rpm'],
209
- signature_format: 'v4',
210
- repo: true,
211
- },
212
121
  '30' => {
213
122
  architectures: ['x86_64'],
214
123
  source_architecture: 'SRPMS',
@@ -228,26 +137,6 @@ module Pkg
228
137
  },
229
138
 
230
139
  'osx' => {
231
- '10.10' => {
232
- architectures: ['x86_64'],
233
- package_format: 'dmg',
234
- repo: false,
235
- },
236
- '10.11' => {
237
- architectures: ['x86_64'],
238
- package_format: 'dmg',
239
- repo: false,
240
- },
241
- '10.12' => {
242
- architectures: ['x86_64'],
243
- package_format: 'dmg',
244
- repo: false,
245
- },
246
- '10.13' => {
247
- architectures: ['x86_64'],
248
- package_format: 'dmg',
249
- repo: false,
250
- },
251
140
  '10.14' => {
252
141
  architectures: ['x86_64'],
253
142
  package_format: 'dmg',
@@ -273,7 +162,7 @@ module Pkg
273
162
 
274
163
  'sles' => {
275
164
  '11' => {
276
- architectures: ['x86_64', 'i386', 's390x'],
165
+ architectures: ['x86_64', 'i386'],
277
166
  source_architecture: 'SRPMS',
278
167
  package_format: 'rpm',
279
168
  source_package_formats: ['src.rpm'],
@@ -281,7 +170,7 @@ module Pkg
281
170
  repo: true,
282
171
  },
283
172
  '12' => {
284
- architectures: ['x86_64', 's390x', 'ppc64le'],
173
+ architectures: ['x86_64', 'ppc64le'],
285
174
  source_architecture: 'SRPMS',
286
175
  package_format: 'rpm',
287
176
  source_package_formats: ['src.rpm'],
@@ -344,6 +233,14 @@ module Pkg
344
233
  source_package_formats: DEBIAN_SOURCE_FORMATS,
345
234
  repo: true,
346
235
  },
236
+ '20.04' => {
237
+ codename: 'focal',
238
+ architectures: ['amd64'],
239
+ source_architecture: 'source',
240
+ package_format: 'deb',
241
+ source_package_formats: DEBIAN_SOURCE_FORMATS,
242
+ repo: true,
243
+ },
347
244
  },
348
245
 
349
246
  'windows' => {
@@ -31,10 +31,10 @@ module Pkg::Sign::Ips
31
31
  # - Sean P. McDonald
32
32
  #
33
33
  # We sign the entire repo
34
- sign_cmd = "sudo -E /usr/bin/pkgsign -c /root/signing/signing_cert_2018.pem \
34
+ sign_cmd = "sudo -E /usr/bin/pkgsign -c /root/signing/signing_cert_2020.pem \
35
35
  -i /root/signing/Thawte_SHA256_Code_Signing_CA.pem \
36
36
  -i /root/signing/Thawte_Primary_Root_CA.pem \
37
- -k /root/signing/signing_key_2018.pem \
37
+ -k /root/signing/signing_key_2020.pem \
38
38
  -s 'file://#{work_dir}/repo' '*'"
39
39
  puts "About to sign #{p5p} with #{sign_cmd} in #{work_dir}"
40
40
  Pkg::Util::Net.remote_ssh_cmd(ssh_host_string, sign_cmd.squeeze(' '))
@@ -21,6 +21,11 @@ describe 'artifactory.rb' do
21
21
  :repo_config => "../repo_configs/deb/pl-puppet-agent-f65f9efbb727c3d2d72d6799c0fc345a726f27b5-xenial.list",
22
22
  :additional_artifacts => ["./deb/xenial/PC1/puppet-agent-extras_5.3.1.34.gf65f9ef-1xenial_amd64.deb"],
23
23
  },
24
+ 'debian-10-amd64' => {
25
+ :artifact => "./deb/buster/PC1/puppetdb_5.3.1.34.gf65f9ef-1buster_all.deb",
26
+ :repo_config => "../repo_configs/deb/pl-puppetdb-f65f9efbb727c3d2d72d6799c0fc345a726f27b5-buster.list",
27
+ :additional_artifacts => ["./deb/buster/PC1/puppetdb-termini_5.3.1.34.gf65f9ef-1buster_all.deb"],
28
+ },
24
29
  'windows-2012-x86' => {
25
30
  :artifact => "./windows/puppet-agent-5.3.1.34-x86.msi",
26
31
  :repo_config => '',
@@ -36,10 +41,10 @@ describe 'artifactory.rb' do
36
41
  :repo_config => '',
37
42
  :additional_artifacts => ["./eos/4/PC1/i386/puppet-agent-extras-5.3.1.34.gf65f9ef-1.eos4.i386.swix"],
38
43
  },
39
- 'osx-10.12-x86_64' => {
40
- :artifact => "./apple/10.12/PC1/x86_64/puppet-agent-5.3.1.34.gf65f9ef-1.osx10.12.dmg",
44
+ 'osx-10.15-x86_64' => {
45
+ :artifact => "./apple/10.15/PC1/x86_64/puppet-agent-5.3.1.34.gf65f9ef-1.osx10.15.dmg",
41
46
  :repo_config => '',
42
- :additional_artifacts => ["./apple/10.12/PC1/x86_64/puppet-agent-extras-5.3.1.34.gf65f9ef-1.osx10.12.dmg"],
47
+ :additional_artifacts => ["./apple/10.15/PC1/x86_64/puppet-agent-extras-5.3.1.34.gf65f9ef-1.osx10.15.dmg"],
43
48
  },
44
49
  'solaris-10-sparc' => {
45
50
  :artifact => "./solaris/10/PC1/puppet-agent-5.3.1.34.gf65f9ef-1.sparc.pkg.gz",
@@ -64,6 +69,14 @@ describe 'artifactory.rb' do
64
69
  :package_name => 'path/to/a/xenial/package/puppet-agent_5.3.1.34.gf65f9ef-1xenial_amd64.deb',
65
70
  :all_package_names => ['puppet-agent_5.3.1.34.gf65f9ef-1xenial_amd64.deb', 'puppet-agent-extras_5.3.1.34.gf65f9ef-1xenial_amd64.deb']
66
71
  },
72
+ 'debian-10-amd64' => {
73
+ :toplevel_repo => 'debian__local',
74
+ :repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/debian-10",
75
+ :codename => 'buster',
76
+ :arch => 'all',
77
+ :package_name => 'path/to/a/buster/package/puppetdb_5.3.1.34.gf65f9ef-1buster_all.deb',
78
+ :all_package_names => ['puppetdb_5.3.1.34.gf65f9ef-1buster_all.deb', 'puppetdb-termini_5.3.1.34.gf65f9ef-1buster_all.deb']
79
+ },
67
80
  'windows-2012-x86' => {
68
81
  :toplevel_repo => 'generic',
69
82
  :repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/windows-x86",
@@ -82,11 +95,11 @@ describe 'artifactory.rb' do
82
95
  :package_name => 'path/to/an/eos/4/package/puppet-agent-5.3.1.34.gf65f9ef-1.eos4.i386.swix',
83
96
  :all_package_names => ['puppet-agent-5.3.1.34.gf65f9ef-1.eos4.i386.swix', 'puppet-agent-extras-5.3.1.34.gf65f9ef-1.eos4.i386.swix']
84
97
  },
85
- 'osx-10.12-x86_64' => {
98
+ 'osx-10.15-x86_64' => {
86
99
  :toplevel_repo => 'generic',
87
- :repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/osx-10.12-x86_64",
88
- :package_name => 'path/to/an/osx/10.12/package/puppet-agent-5.3.1.34.gf65f9ef-1.osx10.12.dmg',
89
- :all_package_names => ['puppet-agent-5.3.1.34.gf65f9ef-1.osx10.12.dmg', 'puppet-agent-extras-5.3.1.34.gf65f9ef-1.osx10.12.dmg']
100
+ :repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/osx-10.15-x86_64",
101
+ :package_name => 'path/to/an/osx/10.15/package/puppet-agent-5.3.1.34.gf65f9ef-1.osx10.15.dmg',
102
+ :all_package_names => ['puppet-agent-5.3.1.34.gf65f9ef-1.osx10.15.dmg', 'puppet-agent-extras-5.3.1.34.gf65f9ef-1.osx10.15.dmg']
90
103
  },
91
104
  'solaris-10-sparc' => {
92
105
  :toplevel_repo => 'generic',
@@ -112,7 +125,6 @@ describe 'artifactory.rb' do
112
125
  expect(artifact.location_for(platform_tag)).to match_array([
113
126
  platform_tag_data[:toplevel_repo],
114
127
  platform_tag_data[:repo_subdirectories],
115
- File.join('pool', platform_tag_data[:repo_subdirectories])
116
128
  ])
117
129
  end
118
130
  else
@@ -120,7 +132,6 @@ describe 'artifactory.rb' do
120
132
  expect(artifact.location_for(platform_tag)).to match_array([
121
133
  platform_tag_data[:toplevel_repo],
122
134
  platform_tag_data[:repo_subdirectories],
123
- platform_tag_data[:repo_subdirectories]
124
135
  ])
125
136
  end
126
137
  end
@@ -129,7 +140,6 @@ describe 'artifactory.rb' do
129
140
  expect(artifact.location_for('generic')).to match_array([
130
141
  'generic',
131
142
  File.join(default_repo_name, project, project_version),
132
- File.join(default_repo_name, project, project_version)
133
143
  ])
134
144
  end
135
145
  end
@@ -186,12 +196,13 @@ describe 'artifactory.rb' do
186
196
  describe '#deploy_properties' do
187
197
  it "returns the correct contents for the deploy properties for #{platform_tag}" do
188
198
  if platform_tag_data[:codename]
189
- expect(artifact.deploy_properties(platform_tag)).to include({
199
+ expect(artifact.deploy_properties(platform_tag, File.basename(platform_tag_data[:package_name]))).to include({
190
200
  'deb.distribution' => platform_tag_data[:codename],
191
- 'deb.component' => platform_tag_data[:repo_subdirectories]
201
+ 'deb.component' => platform_tag_data[:repo_subdirectories],
202
+ 'deb.architecture' => platform_tag_data[:arch]
192
203
  })
193
204
  else
194
- expect(artifact.deploy_properties(platform_tag)).not_to include({
205
+ expect(artifact.deploy_properties(platform_tag, File.basename(platform_tag_data[:package_name]))).not_to include({
195
206
  'deb.component' => platform_tag_data[:repo_subdirectories]
196
207
  })
197
208
  end
@@ -203,22 +203,20 @@ describe "Pkg::Config" do
203
203
  describe "#platform_data" do
204
204
  platform_tags = [
205
205
  'eos-4-i386',
206
- 'osx-10.12-x86_64',
206
+ 'osx-10.15-x86_64',
207
207
  'cisco-wrlinux-7-x86_64',
208
208
  'ubuntu-16.04-i386',
209
- 'cumulus-2.2-amd64',
210
- 'el-6-s390x',
209
+ 'el-6-x86_64',
211
210
  'el-7-ppc64le',
212
211
  'sles-12-x86_64',
213
212
  ]
214
213
 
215
214
  artifacts = \
216
215
  "./artifacts/eos/4/PC1/i386/puppet-agent-5.3.2-1.eos4.i386.swix\n" \
217
- "./artifacts/apple/10.12/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.osx10.12.dmg\n" \
216
+ "./artifacts/apple/10.15/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.osx10.15.dmg\n" \
218
217
  "./artifacts/cisco-wrlinux/7/PC1/x86_64/puppet-agent-5.3.2-1.cisco_wrlinux7.x86_64.rpm\n" \
219
218
  "./artifacts/deb/xenial/PC1/puppet-agent_5.3.2-1xenial_i386.deb\n" \
220
- "./artifacts/deb/cumulus/PC1/puppet-agent_5.3.2-1cumulus_amd64.deb\n" \
221
- "./artifacts/el/6/PC1/s390x/puppet-agent-5.3.2.658.gc79ef9a-1.el6.s390x.rpm\n" \
219
+ "./artifacts/el/6/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.el6.x86_64.rpm\n" \
222
220
  "./artifacts/el/7/PC1/ppc64le/puppet-agent-5.3.2-1.el7.ppc64le.rpm\n" \
223
221
  "./artifacts/sles/12/PC1/x86_64/puppet-agent-5.3.2-1.sles12.x86_64.rpm"
224
222
 
@@ -226,7 +224,7 @@ describe "Pkg::Config" do
226
224
  "./artifacts/aix/6.1/PC1/ppc/puppet-agent-5.3.2-1.aix6.1.ppc.rpm"
227
225
 
228
226
  fedora_artifacts = \
229
- "./artifacts/fedora/f25/PC1/x86_64/puppet-agent-5.3.2-1.fedoraf25.x86_64.rpm"
227
+ "./artifacts/fedora/31/PC1/x86_64/puppet-agent-5.3.2-1.fc31.x86_64.rpm"
230
228
 
231
229
  windows_artifacts = \
232
230
  "./artifacts/windows/puppet-agent-x64.msi\n" \
@@ -283,8 +281,8 @@ describe "Pkg::Config" do
283
281
  it "should not use 'f' in fedora platform tags" do
284
282
  allow(Pkg::Util::Net).to receive(:remote_ssh_cmd).and_return(fedora_artifacts, nil)
285
283
  data = Pkg::Config.platform_data
286
- expect(data).to include('fedora-25-x86_64')
287
- expect(data).not_to include('fedora-f25-x86_64')
284
+ expect(data).to include('fedora-31-x86_64')
285
+ expect(data).not_to include('fedora-f31-x86_64')
288
286
  end
289
287
 
290
288
  it "should collect packages whose extname differ from package_format" do
@@ -25,16 +25,15 @@ describe 'Pkg::Paths' do
25
25
  'pkg/ubuntu-16.04-amd64/puppet-agent_4.99.0-1xenial_amd64.deb' => 'ubuntu-16.04-amd64',
26
26
  'pkg/windows-x64/puppet-agent-4.99.0-x64.msi' => 'windows-2012-x64',
27
27
  'artifacts/el/6/products/x86_64/pe-r10k-2.5.4.3-1.el6.x86_64.rpm' => 'el-6-x86_64',
28
- 'pkg/deb/trusty/pe-r10k_2.5.4.3-1trusty_amd64.deb' => 'ubuntu-14.04-amd64',
29
28
  'pkg/pe/rpm/el-6-i386/pe-puppetserver-2017.3.0.3-1.el6.noarch.rpm' => 'el-6-i386',
29
+ 'pkg/deb/trusty/pe-r10k_2.5.4.3-1trusty_amd64.deb' => 'ubuntu-14.04-amd64',
30
30
  'pkg/pe/deb/xenial/pe-puppetserver_2017.3.0.3-1puppet1_all.deb' => 'ubuntu-16.04-amd64',
31
31
  'pkg/pe/deb/xenial/super-trusty-package_1.0.0-1puppet1_all.deb' => 'ubuntu-16.04-amd64',
32
- 'artifacts/deb/wheezy/PC1/puppetdb_4.3.1-1puppetlabs1_all.deb' => 'debian-7-amd64',
32
+ 'artifacts/deb/stretch/PC1/puppetdb_4.3.1-1puppetlabs1_all.deb' => 'debian-9-amd64',
33
33
  'pkg/el/7/PC1/x86_64/puppetdb-4.3.1-1.el7.noarch.rpm' => 'el-7-x86_64',
34
- 'pkg/apple/10.11/PC1/x86_64/puppet-agent-1.9.0-1.osx10.11.dmg' => 'osx-10.11-x86_64',
35
- 'artifacts/mac/10.11/PC1/x86_64/puppet-agent-1.9.0-1.osx10.11.dmg' => 'osx-10.11-x86_64',
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
36
  'artifacts/eos/4/PC1/i386/puppet-agent-1.9.0-1.eos4.i386.swix' => 'eos-4-i386',
37
- 'pkg/deb/cumulus/puppet5/puppet-agent_1.4.1.2904.g8023dd1-1cumulus_amd64.deb' => 'cumulus-2.2-amd64',
38
37
  'pkg/windows/puppet-agent-1.9.0-x86.msi' => 'windows-2012-x86',
39
38
  'artifacts/ubuntu-16.04-i386/puppetserver_5.0.1-0.1SNAPSHOT.2017.07.27T2346puppetlabs1.debian.tar.gz' => 'ubuntu-16.04-source',
40
39
  'http://saturn.puppetlabs.net/deb_repos/1234abcd/repos/apt/xenial' => 'ubuntu-16.04-amd64',
@@ -96,8 +95,8 @@ describe 'Pkg::Paths' do
96
95
  expect(Pkg::Paths.artifacts_path('el-7-x86_64')).to eq('artifacts/puppet5/el/7/x86_64')
97
96
  end
98
97
 
99
- it 'should be correct for trusty' do
100
- expect(Pkg::Paths.artifacts_path('ubuntu-14.04-amd64')).to eq('artifacts/trusty/puppet5')
98
+ it 'should be correct for bionic' do
99
+ expect(Pkg::Paths.artifacts_path('ubuntu-18.04-amd64')).to eq('artifacts/bionic/puppet5')
101
100
  end
102
101
 
103
102
  it 'should be correct for solaris 11' do
@@ -105,7 +104,7 @@ describe 'Pkg::Paths' do
105
104
  end
106
105
 
107
106
  it 'should be correct for osx' do
108
- expect(Pkg::Paths.artifacts_path('osx-10.10-x86_64')).to eq('artifacts/mac/puppet5/10.10/x86_64')
107
+ expect(Pkg::Paths.artifacts_path('osx-10.15-x86_64')).to eq('artifacts/mac/puppet5/10.15/x86_64')
109
108
  end
110
109
 
111
110
  it 'should be correct for windows' do
@@ -210,32 +209,6 @@ describe 'Pkg::Paths' do
210
209
  end
211
210
  end
212
211
 
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
238
-
239
212
  describe '#remote_repo_base' do
240
213
  before :each do
241
214
  allow(Pkg::Config).to receive(:yum_repo_path).and_return('foo')
@@ -250,7 +223,7 @@ describe 'Pkg::Paths' do
250
223
  expect(Pkg::Paths.remote_repo_base('ubuntu-18.04-amd64')).to eq('bar')
251
224
  end
252
225
  it 'returns nonfinal_yum_repo_path for nonfinal rpms' do
253
- expect(Pkg::Paths.remote_repo_base('fedora-29-x86_64', true)).to eq('foo-nightly')
226
+ expect(Pkg::Paths.remote_repo_base('fedora-31-x86_64', true)).to eq('foo-nightly')
254
227
  end
255
228
  it 'returns nonfinal_apt_repo_path for nonfinal debs' do
256
229
  expect(Pkg::Paths.remote_repo_base('debian-9-amd64', true)).to eq('bar-nightly')
@@ -304,7 +277,7 @@ describe 'Pkg::Paths' do
304
277
  expect(Pkg::Paths.release_package_link_path('debian-9-i386', true)).to eq("#{nonfinal_apt_repo_path}/#{nonfinal_repo_name}-release-stretch.deb")
305
278
  end
306
279
  it 'returns nil for package formats that do not have release packages' do
307
- expect(Pkg::Paths.release_package_link_path('osx-10.13-x86_64')).to eq(nil)
280
+ expect(Pkg::Paths.release_package_link_path('osx-10.15-x86_64')).to eq(nil)
308
281
  expect(Pkg::Paths.release_package_link_path('windows-2012-x86')).to eq(nil)
309
282
  end
310
283
  end
@@ -3,7 +3,7 @@ require 'spec_helper'
3
3
  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
- deb_platforms = ['cumulus', 'debian', 'ubuntu']
6
+ deb_platforms = ['debian', 'ubuntu']
7
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)
@@ -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', 'redhatfips', 'sles', 'solaris', 'ubuntu', 'windows', 'windowsfips']
22
+ platforms = ['aix', 'cisco-wrlinux', 'debian', 'el', 'eos', 'fedora', 'osx', 'redhatfips', 'sles', 'solaris', 'ubuntu', 'windows', 'windowsfips']
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 = ['bionic', 'buster', 'cosmic', 'cumulus', 'wheezy', 'jessie', 'stretch', 'trusty', 'xenial']
39
+ codenames = ['focal', 'bionic', 'buster', 'cosmic', 'jessie', 'stretch', 'trusty', 'xenial']
40
40
  expect(Pkg::Platforms.codenames).to match_array(codenames)
41
41
  end
42
42
  end
@@ -59,27 +59,27 @@ describe 'Pkg::Platforms' do
59
59
 
60
60
  describe '#arches_for_codename' do
61
61
  it 'should return an array of arches corresponding to a given codename' do
62
- expect(Pkg::Platforms.arches_for_codename('trusty')).to match_array(['i386', 'amd64'])
62
+ expect(Pkg::Platforms.arches_for_codename('xenial')).to match_array(['amd64', 'i386', 'ppc64el'])
63
63
  end
64
64
 
65
65
  it 'should be able to include source archietectures' do
66
- expect(Pkg::Platforms.arches_for_codename('trusty', true)).to match_array(['i386', 'amd64', 'source'])
66
+ expect(Pkg::Platforms.arches_for_codename('xenial', true)).to match_array(["amd64", "i386", "ppc64el", "source"])
67
67
  end
68
68
  end
69
69
 
70
70
  describe '#codename_to_tags' do
71
71
  it 'should return an array of platform tags corresponding to a given codename' do
72
- expect(Pkg::Platforms.codename_to_tags('trusty')).to match_array(['ubuntu-14.04-i386', 'ubuntu-14.04-amd64'])
72
+ expect(Pkg::Platforms.codename_to_tags('xenial')).to match_array(['ubuntu-16.04-i386', 'ubuntu-16.04-amd64', "ubuntu-16.04-ppc64el"])
73
73
  end
74
74
  end
75
75
 
76
76
  describe '#arches_for_platform_version' do
77
77
  it 'should return an array of arches for a given platform and version' do
78
- expect(Pkg::Platforms.arches_for_platform_version('sles', '11')).to match_array(['i386', 'x86_64', 's390x'])
78
+ expect(Pkg::Platforms.arches_for_platform_version('sles', '12')).to match_array(['x86_64', 'ppc64le'])
79
79
  end
80
80
 
81
81
  it 'should be able to include source architectures' do
82
- expect(Pkg::Platforms.arches_for_platform_version('sles', '11', true)).to match_array(['i386', 'x86_64', 's390x', 'SRPMS'])
82
+ expect(Pkg::Platforms.arches_for_platform_version('sles', '12', true)).to match_array(["SRPMS", "ppc64le", "x86_64"])
83
83
  end
84
84
  end
85
85
 
@@ -98,12 +98,12 @@ describe 'Pkg::Platforms' do
98
98
 
99
99
  describe '#platform_lookup' do
100
100
  it 'should return a hash of platform info' do
101
- expect(Pkg::Platforms.platform_lookup('osx-10.10-x86_64')).to be_instance_of(Hash)
101
+ expect(Pkg::Platforms.platform_lookup('osx-10.15-x86_64')).to be_instance_of(Hash)
102
102
  end
103
103
 
104
104
  it 'should include at least arch and package format keys' do
105
- expect(Pkg::Platforms.platform_lookup('osx-10.10-x86_64').keys).to include(:architectures)
106
- expect(Pkg::Platforms.platform_lookup('osx-10.10-x86_64').keys).to include(:package_format)
105
+ expect(Pkg::Platforms.platform_lookup('osx-10.15-x86_64').keys).to include(:architectures)
106
+ expect(Pkg::Platforms.platform_lookup('osx-10.15-x86_64').keys).to include(:package_format)
107
107
  end
108
108
  end
109
109
 
@@ -137,7 +137,7 @@ describe 'Pkg::Platforms' do
137
137
  'windows-2012' => ['windows', '2012', ''],
138
138
  'redhatfips-7-x86_64' => ['redhatfips', '7', 'x86_64'],
139
139
  'el-7-SRPMS' => ['el', '7', 'SRPMS'],
140
- 'ubuntu-14.04-source' => ['ubuntu', '14.04', 'source'],
140
+ 'ubuntu-16.04-source' => ['ubuntu', '16.04', 'source'],
141
141
  }
142
142
 
143
143
  fail_cases = [
@@ -12,7 +12,7 @@ describe 'Pkg::Retrieve' do
12
12
  'aix-6.1-power' => {:artifact => './aix/6.1/PC1/ppc/puppet-agent-5.3.2.155.gb25e649-1.aix6.1.ppc.rpm'},
13
13
  'el-7-x86_64' => {:artifact => './el/7/PC1/x86_64/puppet-agent-5.3.2.155.gb25e649-1.el7.x86_64.rpm'},
14
14
  'osx-10.11-x86_64' => {:artifact => './apple/10.11/PC1/x86_64/puppet-agent-5.3.2.155.gb25e649-1.osx10.11.dmg'},
15
- 'sles-11-s390x' => {:artifact => './sles/11/PC1/s390x/puppet-agent-5.3.2.155.gb25e649-1.sles11.s390x.rpm'},
15
+ 'sles-11-i386' => {:artifact => './sles/11/PC1/i386/puppet-agent-5.3.2.155.gb25e649-1.sles11.i386.rpm'},
16
16
  'solaris-10-sparc' => {:artifact => './solaris/10/PC1/puppet-agent-5.3.2.155.gb25e649-1.sparc.pkg.gz'},
17
17
  'ubuntu-16.04-amd64' => {:artifact => './deb/xenial/PC1/puppet-agent_5.3.2.155.gb25e649-1xenial_amd64.deb'},
18
18
  'windows-2012-x64' => {:artifact => './windows/puppet-agent-x64.msi'},
@@ -74,7 +74,6 @@ DOC
74
74
  ] }
75
75
  let(:v4_rpms) { [
76
76
  "#{rpm_directory}/el/7/PC1/aarch64/puppet-agent-5.5.3-1.el7.aarch64.rpm",
77
- "#{rpm_directory}/sles/12/PC1/s390x/puppet-agent-5.5.3-1.sles12.s390x.rpm",
78
77
  ] }
79
78
  let(:rpms) { rpms_not_to_sign + v3_rpms + v4_rpms }
80
79
  let(:already_signed_rpms) { [
@@ -43,21 +43,21 @@ describe '#Pkg::Util::Ship' do
43
43
  end
44
44
 
45
45
  local_pkgs = [
46
- 'pkg/deb/cumulus/puppet5/puppet-agent_1.4.1.2904.g8023dd1-1cumulus_amd64.deb',
47
- 'pkg/deb/wheezy/puppet5/puppet-agent_1.4.1.2904.g8023dd1-1wheezy_i386.deb',
46
+ 'pkg/deb/stretch/puppet5/puppet-agent_1.4.1.2904.g8023dd1-1stretch_i386.deb',
48
47
  'pkg/el/5/puppet5/x86_64/puppet-agent-1.4.1.2904.g8023dd1-1.el5.x86_64.rpm',
49
48
  'pkg/sles/11/puppet5/i386/puppet-agent-1.4.1.2904.g8023dd1-1.sles11.i386.rpm',
50
- 'pkg/mac/10.10/puppet5/x86_64/puppet-agent-1.4.1.2904.g8023dd1-1.osx10.10.dmg',
49
+ 'pkg/sles/12/puppet5/x86_64/puppet-agent-1.4.1.2904.g8023dd1-1.sles12.x86_64.rpm',
50
+ 'pkg/mac/10.15/puppet5/x86_64/puppet-agent-1.4.1.2904.g8023dd1-1.osx10.15.dmg',
51
51
  'pkg/eos/4/puppet5/i386/puppet-agent-1.4.1.2904.g8023dd1-1.eos4.i386.swix',
52
52
  'pkg/eos/4/puppet5/i386/puppet-agent-1.4.1.2904.g8023dd1-1.eos4.i386.swix.asc',
53
53
  'pkg/windows/puppet5/puppet-agent-1.4.1.2904.g8023dd1-x86.msi',
54
54
  ]
55
55
  new_pkgs = [
56
- 'pkg/cumulus/puppet5/puppet-agent_1.4.1.2904.g8023dd1-1cumulus_amd64.deb',
57
- 'pkg/wheezy/puppet5/puppet-agent_1.4.1.2904.g8023dd1-1wheezy_i386.deb',
56
+ 'pkg/stretch/puppet5/puppet-agent_1.4.1.2904.g8023dd1-1stretch_i386.deb',
58
57
  'pkg/puppet5/el/5/x86_64/puppet-agent-1.4.1.2904.g8023dd1-1.el5.x86_64.rpm',
59
58
  'pkg/puppet5/sles/11/i386/puppet-agent-1.4.1.2904.g8023dd1-1.sles11.i386.rpm',
60
- 'pkg/mac/puppet5/10.10/x86_64/puppet-agent-1.4.1.2904.g8023dd1-1.osx10.10.dmg',
59
+ 'pkg/puppet5/sles/12/x86_64/puppet-agent-1.4.1.2904.g8023dd1-1.sles12.x86_64.rpm',
60
+ 'pkg/mac/puppet5/10.15/x86_64/puppet-agent-1.4.1.2904.g8023dd1-1.osx10.15.dmg',
61
61
  'pkg/eos/puppet5/4/i386/puppet-agent-1.4.1.2904.g8023dd1-1.eos4.i386.swix',
62
62
  'pkg/eos/puppet5/4/i386/puppet-agent-1.4.1.2904.g8023dd1-1.eos4.i386.swix.asc',
63
63
  'pkg/windows/puppet5/puppet-agent-1.4.1.2904.g8023dd1-x86.msi',
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: packaging
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.57
4
+ version: 0.99.62
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-02-18 00:00:00.000000000 Z
11
+ date: 2020-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -107,6 +107,7 @@ files:
107
107
  - lib/packaging.rb
108
108
  - lib/packaging/archive.rb
109
109
  - lib/packaging/artifactory.rb
110
+ - lib/packaging/artifactory/extensions.rb
110
111
  - lib/packaging/config.rb
111
112
  - lib/packaging/config/params.rb
112
113
  - lib/packaging/deb.rb
@@ -245,27 +246,27 @@ specification_version: 4
245
246
  summary: Puppet Labs' packaging automation
246
247
  test_files:
247
248
  - spec/lib/packaging_spec.rb
249
+ - spec/lib/packaging/sign_spec.rb
248
250
  - spec/lib/packaging/artifactory_spec.rb
249
- - spec/lib/packaging/util/gpg_spec.rb
250
- - spec/lib/packaging/util/git_tag_spec.rb
251
- - spec/lib/packaging/util/git_spec.rb
252
- - spec/lib/packaging/util/os_spec.rb
253
- - spec/lib/packaging/util/execution_spec.rb
254
- - spec/lib/packaging/util/file_spec.rb
255
- - spec/lib/packaging/util/jenkins_spec.rb
256
- - spec/lib/packaging/util/version_spec.rb
257
- - spec/lib/packaging/util/ship_spec.rb
251
+ - spec/lib/packaging/deb_spec.rb
252
+ - spec/lib/packaging/platforms_spec.rb
253
+ - spec/lib/packaging/gem_spec.rb
254
+ - spec/lib/packaging/config_spec.rb
255
+ - spec/lib/packaging/retrieve_spec.rb
258
256
  - spec/lib/packaging/util/rake_utils_spec.rb
259
257
  - spec/lib/packaging/util/misc_spec.rb
258
+ - spec/lib/packaging/util/jenkins_spec.rb
260
259
  - spec/lib/packaging/util/net_spec.rb
261
- - spec/lib/packaging/gem_spec.rb
262
- - spec/lib/packaging/tar_spec.rb
260
+ - spec/lib/packaging/util/file_spec.rb
261
+ - spec/lib/packaging/util/git_tag_spec.rb
262
+ - spec/lib/packaging/util/execution_spec.rb
263
+ - spec/lib/packaging/util/gpg_spec.rb
264
+ - spec/lib/packaging/util/git_spec.rb
265
+ - spec/lib/packaging/util/ship_spec.rb
266
+ - spec/lib/packaging/util/version_spec.rb
267
+ - spec/lib/packaging/util/os_spec.rb
263
268
  - spec/lib/packaging/repo_spec.rb
264
- - spec/lib/packaging/retrieve_spec.rb
265
- - spec/lib/packaging/sign_spec.rb
266
- - spec/lib/packaging/rpm/repo_spec.rb
267
- - spec/lib/packaging/config_spec.rb
268
269
  - spec/lib/packaging/deb/repo_spec.rb
269
- - spec/lib/packaging/deb_spec.rb
270
- - spec/lib/packaging/platforms_spec.rb
270
+ - spec/lib/packaging/tar_spec.rb
271
271
  - spec/lib/packaging/paths_spec.rb
272
+ - spec/lib/packaging/rpm/repo_spec.rb