packaging 0.99.16 → 0.99.17

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
  SHA1:
3
- metadata.gz: ba40288bf9de9dbf2c4c11bedf8f93e2087c13e4
4
- data.tar.gz: 789a3b029228ac1fb9315b90c88885c5a0062ccb
3
+ metadata.gz: d2879d7a20f5285bdc8f4a9f07819692dcfa8e89
4
+ data.tar.gz: f8ecc83a7b786126738ed1e467b5fb2bfb688d38
5
5
  SHA512:
6
- metadata.gz: cf2d7f7ce4a5fb50fe3d69255f329ada8a4df3a8a6a96f396e9e5fc2a99a144ef4cc00f857a198b529e4ee1f715f697cbab0aee5c93723ec957b8671c742e32f
7
- data.tar.gz: 9c6cb8d484ae4bbc673502f23c914207868054c41a0763929a7dce7cb9a0f0bcaa0d06a42d6689ed445ffeb920ebe427522dd40ece7b46069f5f273f2b87c964
6
+ metadata.gz: f0a75e30fb5cc80265632db2e97d51c309d3482248f5d0e59a6097f1f8f34bb812e4a5b3217a6614b17a7853a127c0251738695ae51d530744d96559539adea2
7
+ data.tar.gz: ca2bfcaccb9caf985c6e5dec61e8c35dfa80a40dd978229c3e2de39f244aa90257a89f0a6b442eacf0ace689bd5df868aeaf6b944c1db27cfa7359505c456185
@@ -103,12 +103,9 @@ module Pkg::Paths
103
103
  return Pkg::Config.repo_name || Pkg::Config.apt_repo_name || 'main'
104
104
  end
105
105
 
106
- def link_name
107
- if Pkg::Util::Version.final?
108
- Pkg::Config.repo_link_target || nil
109
- else
110
- Pkg::Config.nonfinal_repo_link_target || nil
111
- end
106
+ def link_name(nonfinal = false)
107
+ return Pkg::Config.nonfinal_repo_link_target if nonfinal
108
+ return Pkg::Config.repo_link_target
112
109
  end
113
110
 
114
111
  # TODO: please please please clean this up
@@ -128,34 +125,34 @@ module Pkg::Paths
128
125
  if is_legacy_repo?(yum_repo_name(nonfinal))
129
126
  [File.join(path_prefix, platform, version, yum_repo_name(nonfinal)), nil]
130
127
  else
131
- [File.join(path_prefix, yum_repo_name(nonfinal)), link_name.nil? ? nil : File.join(path_prefix, link_name)]
128
+ [File.join(path_prefix, yum_repo_name(nonfinal)), link_name(nonfinal).nil? ? nil : File.join(path_prefix, link_name(nonfinal))]
132
129
  end
133
130
  when 'swix'
134
131
  if is_legacy_repo?(repo_name(nonfinal))
135
132
  [File.join(path_prefix, platform, version, repo_name(nonfinal)), nil]
136
133
  else
137
- [File.join(path_prefix, platform, repo_name(nonfinal)), link_name.nil? ? nil : File.join(path_prefix, platform, link_name)]
134
+ [File.join(path_prefix, platform, repo_name(nonfinal)), link_name(nonfinal).nil? ? nil : File.join(path_prefix, platform, link_name(nonfinal))]
138
135
  end
139
136
  when 'deb'
140
137
  [File.join(path_prefix, Pkg::Platforms.get_attribute(platform_tag, :codename), apt_repo_name(nonfinal)),
141
- link_name.nil? ? nil : File.join(path_prefix, Pkg::Platforms.get_attribute(platform_tag, :codename), link_name)]
138
+ link_name(nonfinal).nil? ? nil : File.join(path_prefix, Pkg::Platforms.get_attribute(platform_tag, :codename), link_name(nonfinal))]
142
139
  when 'svr4', 'ips'
143
140
  if is_legacy_repo?(repo_name(nonfinal))
144
141
  [File.join(path_prefix, 'solaris', repo_name(nonfinal), version), nil]
145
142
  else
146
- [File.join(path_prefix, 'solaris', repo_name(nonfinal)), link_name.nil? ? nil : File.join(path_prefix, 'solaris', link_name)]
143
+ [File.join(path_prefix, 'solaris', repo_name(nonfinal)), link_name(nonfinal).nil? ? nil : File.join(path_prefix, 'solaris', link_name(nonfinal))]
147
144
  end
148
145
  when 'dmg'
149
146
  if is_legacy_repo?(repo_name(nonfinal))
150
147
  [File.join(path_prefix, 'mac', version, repo_name(nonfinal)), nil]
151
148
  else
152
- [File.join(path_prefix, 'mac', repo_name(nonfinal)), link_name.nil? ? nil : File.join(path_prefix, 'mac', link_name)]
149
+ [File.join(path_prefix, 'mac', repo_name(nonfinal)), link_name(nonfinal).nil? ? nil : File.join(path_prefix, 'mac', link_name(nonfinal))]
153
150
  end
154
151
  when 'msi'
155
152
  if is_legacy_repo?(repo_name(nonfinal))
156
153
  [File.join(path_prefix, 'windows'), nil]
157
154
  else
158
- [File.join(path_prefix, 'windows', repo_name(nonfinal)), link_name.nil? ? nil : File.join(path_prefix, 'windows', link_name)]
155
+ [File.join(path_prefix, 'windows', repo_name(nonfinal)), link_name(nonfinal).nil? ? nil : File.join(path_prefix, 'windows', link_name(nonfinal))]
159
156
  end
160
157
  else
161
158
  raise "Not sure where to find packages with a package format of '#{package_format}'"
@@ -268,4 +265,21 @@ module Pkg::Paths
268
265
  raise "Not sure what to do with a package format of '#{package_format}'"
269
266
  end
270
267
  end
268
+
269
+ def release_package_link_path(platform_tag, nonfinal = false)
270
+ platform, version, arch = Pkg::Platforms.parse_platform_tag(platform_tag)
271
+ package_format = Pkg::Platforms.package_format_for_tag(platform_tag)
272
+ case package_format
273
+ when 'rpm'
274
+ base_path = nonfinal ? Pkg::Config.nonfinal_yum_repo_path : Pkg::Config.yum_repo_path
275
+ return File.join(base_path, "#{repo_name(nonfinal)}-release-#{platform}-#{version}.noarch.rpm")
276
+ when 'deb'
277
+ base_path = nonfinal ? Pkg::Config.nonfinal_apt_repo_path : Pkg::Config.apt_repo_path
278
+ codename = Pkg::Platforms.codename_for_platform_version(platform, version)
279
+ return File.join(base_path, "#{repo_name(nonfinal)}-release-#{codename}.deb")
280
+ else
281
+ warn "No release packages for package format '#{package_format}', skipping . . ."
282
+ return nil
283
+ end
284
+ end
271
285
  end
@@ -130,7 +130,7 @@ module Pkg::Util::Net
130
130
  raise(ArgumentError, "Cannot sync between two remote hosts") if
131
131
  options[:origin_host] && options[:target_host]
132
132
 
133
- raise(ArgumentError, "Cannot sync path '#{origin}' to itself") unless
133
+ raise(ArgumentError, "Cannot sync path '#{origin}' because both origin_host and target_host are nil. Perhaps you need to set TEAM=release ?") unless
134
134
  options[:origin_host] || options[:target_host]
135
135
 
136
136
  cmd = %W(
@@ -235,4 +235,37 @@ describe 'Pkg::Paths' do
235
235
  expect(Pkg::Paths.is_legacy_repo?('puppet')).to be_false
236
236
  end
237
237
  end
238
+
239
+ describe '#release_package_link_path' do
240
+ repo_name = 'puppet6'
241
+ nonfinal_repo_name = 'puppet6-nightly'
242
+ yum_repo_path = '/opt/repository/yum'
243
+ apt_repo_path = '/opt/repository/apt'
244
+ nonfinal_yum_repo_path = '/opt/repository-nightlies/yum'
245
+ nonfinal_apt_repo_path = '/opt/repository-nightlies/apt'
246
+ before :each do
247
+ allow(Pkg::Config).to receive(:repo_name).and_return(repo_name)
248
+ allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nonfinal_repo_name)
249
+ allow(Pkg::Config).to receive(:yum_repo_path).and_return(yum_repo_path)
250
+ allow(Pkg::Config).to receive(:apt_repo_path).and_return(apt_repo_path)
251
+ allow(Pkg::Config).to receive(:nonfinal_yum_repo_path).and_return(nonfinal_yum_repo_path)
252
+ allow(Pkg::Config).to receive(:nonfinal_apt_repo_path).and_return(nonfinal_apt_repo_path)
253
+ end
254
+ it 'returns the appropriate link path for rpm release packages' do
255
+ expect(Pkg::Paths.release_package_link_path('sles-12-ppc64le')).to eq("#{yum_repo_path}/#{repo_name}-release-sles-12.noarch.rpm")
256
+ end
257
+ it 'returns the appropriate link path for deb release packages' do
258
+ expect(Pkg::Paths.release_package_link_path('ubuntu-16.04-amd64')).to eq("#{apt_repo_path}/#{repo_name}-release-xenial.deb")
259
+ end
260
+ it 'returns the appropriate link path for nonfinal rpm release packages' do
261
+ expect(Pkg::Paths.release_package_link_path('el-7-x86_64', true)).to eq("#{nonfinal_yum_repo_path}/#{nonfinal_repo_name}-release-el-7.noarch.rpm")
262
+ end
263
+ it 'returns the appropriate link path for nonfinal deb release packages' do
264
+ expect(Pkg::Paths.release_package_link_path('debian-9-i386', true)).to eq("#{nonfinal_apt_repo_path}/#{nonfinal_repo_name}-release-stretch.deb")
265
+ end
266
+ it 'returns nil for package formats that do not have release packages' do
267
+ expect(Pkg::Paths.release_package_link_path('osx-10.13-x86_64')).to eq(nil)
268
+ expect(Pkg::Paths.release_package_link_path('windows-2012-x86')).to eq(nil)
269
+ end
270
+ end
238
271
  end
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.16
4
+ version: 0.99.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-10-17 00:00:00.000000000 Z
11
+ date: 2018-11-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec