packaging 0.99.60 → 0.99.65

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0e8b1e8d8c9808cdd80c79e28d6519f13081ca834e0d4acd248172266bfed78e
4
- data.tar.gz: e7bfb31ff88466e0b4f5a56869c5be06345a1973f573ec3c95bcde7379b007ca
3
+ metadata.gz: 8e2d980f6d0a3108046057e9a0637b58547bd2e68a16ab3004f9d08f7536b2c7
4
+ data.tar.gz: 2ac12f3edd599dfbfa9a4af501e833a12685a1efd31c17a9f176af7197aba79f
5
5
  SHA512:
6
- metadata.gz: 0717a42c7027cf767466e0cd86f0e69c1f9b4e69be18152016015de39f11f011fd905ceba6b948661f2290b2a23da2aaf50aa867b6c3238d79eb00a8e130cfd1
7
- data.tar.gz: 28511e75d267dccd1a2d5d022729f46002d0847d2ea62a656882f3b9d1f4d73342d0d15cf9cb926c961704f316419a6c05b3fba930cc0d5ad332ae084c76fe67
6
+ metadata.gz: a6bbad34de17a6da0e1168dafc780fb6a1eedd3106cc04493aa6d0c21839852a01f3b9be33dbae817e7d0c483cb446b96a991efe2aca3b7f6ebd9ad3eb8b82d4
7
+ data.tar.gz: 7d2d02b9039b9be3eff34fa066b573e5b7adb82e5515aaf23fa08ea72badada429229005c9ac58116daf1bf2c4ed132f9a1618db8eb1798b5581589cf13a2019
@@ -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
@@ -286,7 +220,7 @@ module Pkg
286
220
  headers = { "X-Checksum-Md5" => artifact_md5 }
287
221
  artifact.upload(
288
222
  data[:repo_name],
289
- File.join(data[:alternate_subdirectories], File.basename(package)),
223
+ File.join(data[:repo_subdirectories], File.basename(package)),
290
224
  deploy_properties(platform_tag, File.basename(package)),
291
225
  headers
292
226
  )
@@ -420,21 +354,20 @@ module Pkg
420
354
  manifest.each do |dist, packages|
421
355
  puts "Grabbing the #{dist} packages from artifactory"
422
356
  packages.each do |name, info|
423
- artifacts = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: ["rpm_enterprise__local", "debian_enterprise__local"])
357
+ filename = info['filename']
358
+ artifacts = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: ["rpm_enterprise__local", "debian_enterprise__local"], name: filename)
424
359
  artifact_to_download = artifacts.select { |artifact| artifact.download_uri.include? remote_path }.first
425
360
  # If we found matching artifacts, but not in the correct path, copy the artifact to the correct path
426
361
  # This should help us keep repos up to date with the packages we are expecting to be there
427
362
  # while helping us avoid 'what the hell, could not find package' errors
428
363
  if artifact_to_download.nil? && !artifacts.empty?
429
364
  artifact_to_copy = artifacts.first
430
- filename = info['filename'] || File.basename(artifact_to_copy.download_uri)
431
365
  copy_artifact(artifact_to_copy, artifact_to_copy.repo, "#{remote_path}/#{dist}/#{filename}")
432
- artifacts = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: ["rpm_enterprise__local", "debian_enterprise__local"])
366
+ artifacts = Artifactory::Resource::Artifact.checksum_search(md5: "#{info["md5"]}", repos: ["rpm_enterprise__local", "debian_enterprise__local"], name: filename)
433
367
  artifact_to_download = artifacts.select { |artifact| artifact.download_uri.include? remote_path }.first
434
368
  end
435
369
 
436
370
  if artifact_to_download.nil?
437
- filename = info["filename"] || name
438
371
  message = "Error: what the hell, could not find package #{filename} with md5sum #{info["md5"]}"
439
372
  unless remote_path.empty?
440
373
  message += " in #{remote_path}"
@@ -442,7 +375,6 @@ module Pkg
442
375
  raise message
443
376
  else
444
377
  full_staging_path = "#{staging_directory}/#{dist}"
445
- filename = info['filename'] || File.basename(artifact_to_download.download_uri)
446
378
  puts "downloading #{artifact_to_download.download_uri} to #{File.join(full_staging_path, filename)}"
447
379
  artifact_to_download.download(full_staging_path, filename: filename)
448
380
  end
@@ -599,7 +531,7 @@ module Pkg
599
531
  # @param target_path [String] path copy tarballs to, assumes same repo
600
532
  def copy_final_pe_tarballs(pe_version, repo, remote_path, target_path)
601
533
  check_authorization
602
- final_tarballs = Artifactory::Resource::Artifact.search(name: pe_version, repos: repo)
534
+ final_tarballs = Artifactory::Resource::Artifact.search(name: pe_version, repos: repo, exact_match: false)
603
535
  final_tarballs.each do |artifact|
604
536
  next unless artifact.download_uri.include? remote_path
605
537
  next if artifact.download_uri.include? "-rc"
@@ -646,12 +578,11 @@ module Pkg
646
578
  manifest.each do |dist, packages|
647
579
  puts "Copying #{dist} packages..."
648
580
  packages.each do |name, info|
649
- 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
650
583
  if artifact.nil?
651
- filename = info["filename"] || name
652
584
  raise "Error: what the hell, could not find package #{filename} with md5sum #{info["md5"]}"
653
585
  end
654
- filename = info["filename"] || File.basename(artifact.download_uri)
655
586
  copy_artifact(artifact, artifact.repo, "#{target_path}/#{dist}/#{filename}")
656
587
  end
657
588
  end
@@ -681,7 +612,8 @@ module Pkg
681
612
  manifest.each do |dist, packages|
682
613
  packages.each do |package_name, info|
683
614
  next unless package_name == package
684
- 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)
685
617
  artifacts.each do |artifact|
686
618
  next unless artifact.download_uri.include? remote_path
687
619
  puts "Removing reverted package #{artifact.download_uri}"
@@ -701,7 +633,7 @@ module Pkg
701
633
  Dir.foreach("#{tarball_path}/") do |pe_tarball|
702
634
  next if pe_tarball == '.' || pe_tarball == ".."
703
635
  md5 = Digest::MD5.file("#{tarball_path}/#{pe_tarball}").hexdigest
704
- 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)
705
637
  next if artifacts_to_delete.nil?
706
638
  begin
707
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 = Artifactory::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
@@ -109,6 +109,14 @@ module Pkg
109
109
  }
110
110
  },
111
111
 
112
+ 'eos' => {
113
+ '4' => {
114
+ architectures: ['i386'],
115
+ package_format: 'swix',
116
+ repo: false,
117
+ },
118
+ },
119
+
112
120
  'fedora' => {
113
121
  '30' => {
114
122
  architectures: ['x86_64'],
@@ -129,6 +137,11 @@ module Pkg
129
137
  },
130
138
 
131
139
  'osx' => {
140
+ '10.13' => {
141
+ architectures: ['x86_64'],
142
+ package_format: 'dmg',
143
+ repo: false,
144
+ },
132
145
  '10.14' => {
133
146
  architectures: ['x86_64'],
134
147
  package_format: 'dmg',
@@ -36,6 +36,11 @@ describe 'artifactory.rb' do
36
36
  :repo_config => '',
37
37
  :additional_artifacts => ["./windowsfips/puppet-agent-extras-5.3.1.34-x64.msi"],
38
38
  },
39
+ 'eos-4-i386' => {
40
+ :artifact => "./eos/4/PC1/i386/puppet-agent-5.3.1.34.gf65f9ef-1.eos4.i386.swix",
41
+ :repo_config => '',
42
+ :additional_artifacts => ["./eos/4/PC1/i386/puppet-agent-extras-5.3.1.34.gf65f9ef-1.eos4.i386.swix"],
43
+ },
39
44
  'osx-10.15-x86_64' => {
40
45
  :artifact => "./apple/10.15/PC1/x86_64/puppet-agent-5.3.1.34.gf65f9ef-1.osx10.15.dmg",
41
46
  :repo_config => '',
@@ -84,6 +89,12 @@ describe 'artifactory.rb' do
84
89
  :package_name => 'path/to/a/windowsfips/package/puppet-agent-5.3.1.34-x64.msi',
85
90
  :all_package_names => ['puppet-agent-5.3.1.34-x64.msi','puppet-agent-extras-5.3.1.34-x64.msi']
86
91
  },
92
+ 'eos-4-i386' => {
93
+ :toplevel_repo => 'generic',
94
+ :repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/eos-4-i386",
95
+ :package_name => 'path/to/an/eos/4/package/puppet-agent-5.3.1.34.gf65f9ef-1.eos4.i386.swix',
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']
97
+ },
87
98
  'osx-10.15-x86_64' => {
88
99
  :toplevel_repo => 'generic',
89
100
  :repo_subdirectories => "#{default_repo_name}/#{project}/#{project_version}/osx-10.15-x86_64",
@@ -114,7 +125,6 @@ describe 'artifactory.rb' do
114
125
  expect(artifact.location_for(platform_tag)).to match_array([
115
126
  platform_tag_data[:toplevel_repo],
116
127
  platform_tag_data[:repo_subdirectories],
117
- File.join('pool', platform_tag_data[:repo_subdirectories])
118
128
  ])
119
129
  end
120
130
  else
@@ -122,7 +132,6 @@ describe 'artifactory.rb' do
122
132
  expect(artifact.location_for(platform_tag)).to match_array([
123
133
  platform_tag_data[:toplevel_repo],
124
134
  platform_tag_data[:repo_subdirectories],
125
- platform_tag_data[:repo_subdirectories]
126
135
  ])
127
136
  end
128
137
  end
@@ -131,7 +140,6 @@ describe 'artifactory.rb' do
131
140
  expect(artifact.location_for('generic')).to match_array([
132
141
  'generic',
133
142
  File.join(default_repo_name, project, project_version),
134
- File.join(default_repo_name, project, project_version)
135
143
  ])
136
144
  end
137
145
  end
@@ -202,6 +202,7 @@ describe "Pkg::Config" do
202
202
 
203
203
  describe "#platform_data" do
204
204
  platform_tags = [
205
+ 'eos-4-i386',
205
206
  'osx-10.15-x86_64',
206
207
  'cisco-wrlinux-7-x86_64',
207
208
  'ubuntu-16.04-i386',
@@ -211,6 +212,7 @@ describe "Pkg::Config" do
211
212
  ]
212
213
 
213
214
  artifacts = \
215
+ "./artifacts/eos/4/PC1/i386/puppet-agent-5.3.2-1.eos4.i386.swix\n" \
214
216
  "./artifacts/apple/10.15/PC1/x86_64/puppet-agent-5.3.2.658.gc79ef9a-1.osx10.15.dmg\n" \
215
217
  "./artifacts/cisco-wrlinux/7/PC1/x86_64/puppet-agent-5.3.2-1.cisco_wrlinux7.x86_64.rpm\n" \
216
218
  "./artifacts/deb/xenial/PC1/puppet-agent_5.3.2-1xenial_i386.deb\n" \
@@ -33,6 +33,7 @@ describe 'Pkg::Paths' do
33
33
  'pkg/el/7/PC1/x86_64/puppetdb-4.3.1-1.el7.noarch.rpm' => 'el-7-x86_64',
34
34
  'pkg/apple/10.14/PC1/x86_64/puppet-agent-1.9.0-1.osx10.14.dmg' => 'osx-10.14-x86_64',
35
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',
36
37
  'pkg/windows/puppet-agent-1.9.0-x86.msi' => 'windows-2012-x86',
37
38
  'artifacts/ubuntu-16.04-i386/puppetserver_5.0.1-0.1SNAPSHOT.2017.07.27T2346puppetlabs1.debian.tar.gz' => 'ubuntu-16.04-source',
38
39
  'http://saturn.puppetlabs.net/deb_repos/1234abcd/repos/apt/xenial' => 'ubuntu-16.04-amd64',
@@ -208,32 +209,6 @@ describe 'Pkg::Paths' do
208
209
  end
209
210
  end
210
211
 
211
- describe '#is_legacy_repo?' do
212
- it 'returns true for empty strings' do
213
- expect(Pkg::Paths.is_legacy_repo?('')).to be_true
214
- end
215
-
216
- it 'returns true for PC1' do
217
- expect(Pkg::Paths.is_legacy_repo?('PC1')).to be_true
218
- end
219
-
220
- it 'returns true for foopuppetbar' do
221
- expect(Pkg::Paths.is_legacy_repo?('foopuppetbar')).to be_true
222
- end
223
-
224
- it 'returns false for puppet5' do
225
- expect(Pkg::Paths.is_legacy_repo?('puppet5')).to be_false
226
- end
227
-
228
- it 'returns false for puppet8-nightly' do
229
- expect(Pkg::Paths.is_legacy_repo?('puppet8-nightly')).to be_false
230
- end
231
-
232
- it 'returns false for puppet' do
233
- expect(Pkg::Paths.is_legacy_repo?('puppet')).to be_false
234
- end
235
- end
236
-
237
212
  describe '#remote_repo_base' do
238
213
  before :each do
239
214
  allow(Pkg::Config).to receive(:yum_repo_path).and_return('foo')
@@ -12,14 +12,14 @@ describe 'Pkg::Platforms' do
12
12
 
13
13
  describe '#formats' do
14
14
  it 'should return all package formats' do
15
- fmts = ['rpm', 'deb', 'dmg', 'svr4', 'ips', 'msi']
15
+ fmts = ['rpm', 'deb', 'swix', 'dmg', 'svr4', 'ips', 'msi']
16
16
  expect(Pkg::Platforms.formats).to match_array(fmts)
17
17
  end
18
18
  end
19
19
 
20
20
  describe '#supported_platforms' do
21
21
  it 'should return all supported platforms' do
22
- platforms = ['aix', 'cisco-wrlinux', 'debian', 'el', '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
@@ -113,7 +113,7 @@ describe 'Pkg::Platforms' do
113
113
  end
114
114
 
115
115
  it 'fails with a reasonable error when specified attribute is not defined' do
116
- expect { Pkg::Platforms.get_attribute('osx-10.15-x86_64', :signature_format) }.to raise_error(/doesn't have information/)
116
+ expect { Pkg::Platforms.get_attribute('eos-4-i386', :signature_format) }.to raise_error(/doesn't have information/)
117
117
  end
118
118
  end
119
119
 
@@ -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'},
@@ -8,6 +8,15 @@ describe '#Pkg::Util::Ship' do
8
8
  'pkg/windowsfips/puppet5/puppet-agent-1.4.1.2904.g8023dd1-x64.msi',
9
9
  'pkg/windowsfips/puppet5/puppet-agent-x64.msi'
10
10
  ]
11
+ swix_pkgs = [
12
+ 'pkg/eos/puppet5/4/i386/puppet-agent-1.4.1.2904.g8023dd1-1.eos4.i386.swix',
13
+ 'pkg/eos/puppet5/4/i386/puppet-agent-1.4.1.2904.g8023dd1-1.eos4.i386.swix.asc',
14
+ ]
15
+
16
+ it 'returns an array of packages found on the filesystem' do
17
+ allow(Dir).to receive(:glob).with('pkg/**/*.swix*').and_return(swix_pkgs)
18
+ expect(Pkg::Util::Ship.collect_packages(['pkg/**/*.swix*'])).to eq(swix_pkgs)
19
+ end
11
20
 
12
21
  describe 'define excludes' do
13
22
  before :each do
@@ -39,6 +48,8 @@ local_pkgs = [
39
48
  'pkg/sles/11/puppet5/i386/puppet-agent-1.4.1.2904.g8023dd1-1.sles11.i386.rpm',
40
49
  'pkg/sles/12/puppet5/x86_64/puppet-agent-1.4.1.2904.g8023dd1-1.sles12.x86_64.rpm',
41
50
  'pkg/mac/10.15/puppet5/x86_64/puppet-agent-1.4.1.2904.g8023dd1-1.osx10.15.dmg',
51
+ 'pkg/eos/4/puppet5/i386/puppet-agent-1.4.1.2904.g8023dd1-1.eos4.i386.swix',
52
+ 'pkg/eos/4/puppet5/i386/puppet-agent-1.4.1.2904.g8023dd1-1.eos4.i386.swix.asc',
42
53
  'pkg/windows/puppet5/puppet-agent-1.4.1.2904.g8023dd1-x86.msi',
43
54
  ]
44
55
  new_pkgs = [
@@ -47,6 +58,8 @@ new_pkgs = [
47
58
  'pkg/puppet5/sles/11/i386/puppet-agent-1.4.1.2904.g8023dd1-1.sles11.i386.rpm',
48
59
  'pkg/puppet5/sles/12/x86_64/puppet-agent-1.4.1.2904.g8023dd1-1.sles12.x86_64.rpm',
49
60
  'pkg/mac/puppet5/10.15/x86_64/puppet-agent-1.4.1.2904.g8023dd1-1.osx10.15.dmg',
61
+ 'pkg/eos/puppet5/4/i386/puppet-agent-1.4.1.2904.g8023dd1-1.eos4.i386.swix',
62
+ 'pkg/eos/puppet5/4/i386/puppet-agent-1.4.1.2904.g8023dd1-1.eos4.i386.swix.asc',
50
63
  'pkg/windows/puppet5/puppet-agent-1.4.1.2904.g8023dd1-x86.msi',
51
64
  ]
52
65
 
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.60
4
+ version: 0.99.65
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-04-01 00:00:00.000000000 Z
11
+ date: 2020-06-22 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
@@ -244,28 +245,28 @@ signing_key:
244
245
  specification_version: 4
245
246
  summary: Puppet Labs' packaging automation
246
247
  test_files:
247
- - spec/lib/packaging_spec.rb
248
- - spec/lib/packaging/config_spec.rb
249
- - spec/lib/packaging/retrieve_spec.rb
248
+ - spec/lib/packaging/sign_spec.rb
249
+ - spec/lib/packaging/paths_spec.rb
250
250
  - spec/lib/packaging/repo_spec.rb
251
- - spec/lib/packaging/tar_spec.rb
252
- - spec/lib/packaging/rpm/repo_spec.rb
253
251
  - spec/lib/packaging/deb_spec.rb
254
- - spec/lib/packaging/sign_spec.rb
255
252
  - spec/lib/packaging/deb/repo_spec.rb
256
- - spec/lib/packaging/util/net_spec.rb
257
- - spec/lib/packaging/util/ship_spec.rb
258
- - spec/lib/packaging/util/gpg_spec.rb
259
- - spec/lib/packaging/util/file_spec.rb
253
+ - spec/lib/packaging/gem_spec.rb
254
+ - spec/lib/packaging/artifactory_spec.rb
255
+ - spec/lib/packaging/tar_spec.rb
256
+ - spec/lib/packaging/util/version_spec.rb
257
+ - spec/lib/packaging/util/execution_spec.rb
260
258
  - spec/lib/packaging/util/os_spec.rb
259
+ - spec/lib/packaging/util/ship_spec.rb
261
260
  - spec/lib/packaging/util/git_spec.rb
262
- - spec/lib/packaging/util/git_tag_spec.rb
263
261
  - spec/lib/packaging/util/rake_utils_spec.rb
262
+ - spec/lib/packaging/util/net_spec.rb
263
+ - spec/lib/packaging/util/file_spec.rb
264
264
  - spec/lib/packaging/util/jenkins_spec.rb
265
- - spec/lib/packaging/util/execution_spec.rb
266
- - spec/lib/packaging/util/version_spec.rb
267
265
  - spec/lib/packaging/util/misc_spec.rb
266
+ - spec/lib/packaging/util/git_tag_spec.rb
267
+ - spec/lib/packaging/util/gpg_spec.rb
268
+ - spec/lib/packaging/rpm/repo_spec.rb
269
+ - spec/lib/packaging/retrieve_spec.rb
268
270
  - spec/lib/packaging/platforms_spec.rb
269
- - spec/lib/packaging/gem_spec.rb
270
- - spec/lib/packaging/paths_spec.rb
271
- - spec/lib/packaging/artifactory_spec.rb
271
+ - spec/lib/packaging/config_spec.rb
272
+ - spec/lib/packaging_spec.rb