packaging 0.88.77 → 0.99.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +128 -74
- data/lib/packaging/artifactory.rb +60 -433
- data/lib/packaging/config/params.rb +7 -28
- data/lib/packaging/config.rb +50 -150
- data/lib/packaging/deb/repo.rb +19 -20
- data/lib/packaging/gem.rb +83 -41
- data/lib/packaging/ips.rb +57 -0
- data/lib/packaging/msi.rb +89 -0
- data/lib/packaging/nuget.rb +1 -1
- data/lib/packaging/osx.rb +36 -0
- data/lib/packaging/paths.rb +87 -225
- data/lib/packaging/platforms.rb +416 -443
- data/lib/packaging/repo.rb +22 -122
- data/lib/packaging/retrieve.rb +7 -36
- data/lib/packaging/rpm/repo.rb +8 -5
- data/lib/packaging/tar.rb +0 -9
- data/lib/packaging/util/date.rb +0 -5
- data/lib/packaging/util/execution.rb +2 -2
- data/lib/packaging/util/git.rb +1 -1
- data/lib/packaging/util/gpg.rb +1 -5
- data/lib/packaging/util/net.rb +37 -79
- data/lib/packaging/util/rake_utils.rb +0 -1
- data/lib/packaging/util/ship.rb +13 -142
- data/lib/packaging/util/tool.rb +1 -1
- data/lib/packaging/util/version.rb +0 -8
- data/lib/packaging/util.rb +2 -2
- data/lib/packaging.rb +3 -3
- data/spec/fixtures/config/params.yaml +2 -0
- data/spec/lib/packaging/artifactory_spec.rb +16 -66
- data/spec/lib/packaging/config_spec.rb +29 -49
- data/spec/lib/packaging/deb/repo_spec.rb +7 -16
- data/spec/lib/packaging/paths_spec.rb +56 -321
- data/spec/lib/packaging/platforms_spec.rb +21 -46
- data/spec/lib/packaging/repo_spec.rb +40 -78
- data/spec/lib/packaging/retrieve_spec.rb +8 -47
- data/spec/lib/packaging/rpm/repo_spec.rb +4 -4
- data/spec/lib/packaging/tar_spec.rb +40 -34
- data/spec/lib/packaging/util/git_tag_spec.rb +1 -1
- data/spec/lib/packaging/util/gpg_spec.rb +1 -1
- data/spec/lib/packaging/util/net_spec.rb +15 -35
- data/spec/lib/packaging/util/ship_spec.rb +63 -145
- data/spec/spec_helper.rb +14 -0
- data/tasks/00_utils.rake +6 -4
- data/tasks/apple.rake +0 -2
- data/tasks/config.rake +0 -5
- data/tasks/education.rake +5 -5
- data/tasks/fetch.rake +14 -17
- data/tasks/gem.rake +121 -134
- data/tasks/jenkins.rake +7 -51
- data/tasks/nightly_repos.rake +69 -20
- data/tasks/pe_ship.rake +11 -16
- data/tasks/retrieve.rake +6 -13
- data/tasks/ship.rake +256 -196
- data/tasks/sign.rake +135 -63
- data/tasks/tar.rake +6 -0
- data/templates/packaging.xml.erb +7 -9
- data/templates/repo.xml.erb +3 -6
- metadata +27 -80
- data/lib/packaging/archive.rb +0 -126
- data/lib/packaging/artifactory/extensions.rb +0 -94
- data/lib/packaging/config/validations.rb +0 -13
- data/lib/packaging/metrics.rb +0 -15
- data/lib/packaging/sign/deb.rb +0 -9
- data/lib/packaging/sign/dmg.rb +0 -41
- data/lib/packaging/sign/ips.rb +0 -57
- data/lib/packaging/sign/msi.rb +0 -124
- data/lib/packaging/sign/rpm.rb +0 -115
- data/lib/packaging/sign.rb +0 -8
- data/spec/lib/packaging/gem_spec.rb +0 -86
- data/spec/lib/packaging/sign_spec.rb +0 -133
- data/tasks/archive.rake +0 -69
@@ -92,10 +92,10 @@ describe "Pkg::Deb::Repo" do
|
|
92
92
|
Pkg::Repo.should_receive(:directories_that_contain_packages).and_return(pkg_directories)
|
93
93
|
Pkg::Repo.should_receive(:populate_repo_directory)
|
94
94
|
Pkg::Deb::Repo.should_receive(:repo_creation_command).and_return(command)
|
95
|
-
Pkg::Util::Net.should_receive(:
|
95
|
+
Pkg::Util::Net.should_receive(:remote_ssh_cmd).with(Pkg::Config.distribution_server, command)
|
96
96
|
Pkg::Deb::Repo.should_receive(:generate_repo_configs)
|
97
97
|
Pkg::Deb::Repo.should_receive(:ship_repo_configs)
|
98
|
-
Pkg::Util::Net.should_receive(:
|
98
|
+
Pkg::Util::Net.should_receive(:remote_ssh_cmd).with(Pkg::Config.distribution_server, "rm -f #{artifact_directory}/repos/.lock" )
|
99
99
|
Pkg::Deb::Repo.create_repos
|
100
100
|
end
|
101
101
|
end
|
@@ -114,8 +114,8 @@ describe "Pkg::Deb::Repo" do
|
|
114
114
|
Pkg::Config.distribution_server = "a.host.that.wont.exist"
|
115
115
|
repo_dir = "#{Pkg::Config.jenkins_repo_path}/#{Pkg::Config.project}/#{Pkg::Config.ref}/repo_configs/deb"
|
116
116
|
Pkg::Util::File.should_receive(:empty_dir?).with("pkg/repo_configs/deb").and_return(false)
|
117
|
-
Pkg::
|
118
|
-
Pkg::Util::Net.should_receive(:
|
117
|
+
Pkg::Deb::Repo.should_receive(:invoke_task).with("pl:fetch")
|
118
|
+
Pkg::Util::Net.should_receive(:remote_ssh_cmd).with(Pkg::Config.distribution_server, "mkdir -p #{repo_dir}")
|
119
119
|
Pkg::Util::Execution.should_receive(:retry_on_fail).with(:times => 3)
|
120
120
|
Pkg::Deb::Repo.ship_repo_configs
|
121
121
|
end
|
@@ -128,21 +128,12 @@ describe "Pkg::Deb::Repo" do
|
|
128
128
|
end
|
129
129
|
|
130
130
|
it "makes a repo for each dist" do
|
131
|
-
# stub out start_keychain to prevent actual keychain starts.
|
132
|
-
Pkg::Util::Gpg.stub(:start_keychain)
|
133
|
-
|
134
131
|
dists = cows.reject { |cow| cow.empty? }
|
135
132
|
distfiles = {}
|
133
|
+
reprepro = "/bin/reprepro"
|
136
134
|
Pkg::Util::File.should_receive(:directories).with("repos/apt").and_return(dists)
|
137
|
-
|
138
|
-
#
|
139
|
-
keychain_command = "/usr/bin/keychain -k mine"
|
140
|
-
allow(Pkg::Util::Execution).to receive(:capture3) { keychain_command }
|
141
|
-
|
142
|
-
# Enforce reprepro
|
143
|
-
reprepro_command = "/bin/reprepro"
|
144
|
-
Pkg::Util::Tool.should_receive(:check_tool).with("reprepro").and_return(reprepro_command)
|
145
|
-
Pkg::Util::Execution.should_receive(:capture3).at_least(1).times.with("#{reprepro_command} -vvv --confdir ./conf --dbdir ./db --basedir ./ export")
|
135
|
+
Pkg::Util::Tool.should_receive(:check_tool).with("reprepro").and_return(reprepro)
|
136
|
+
Pkg::Util::Execution.should_receive(:capture3).at_least(1).times.with("#{reprepro} -vvv --confdir ./conf --dbdir ./db --basedir ./ export")
|
146
137
|
|
147
138
|
dists.each do |dist|
|
148
139
|
distfiles[dist] = double
|
@@ -3,38 +3,43 @@ require 'spec_helper'
|
|
3
3
|
describe 'Pkg::Paths' do
|
4
4
|
describe '#arch_from_artifact_path' do
|
5
5
|
arch_transformations = {
|
6
|
-
['
|
7
|
-
['pkg/el/
|
8
|
-
['artifacts/fedora/32/puppet6/x86_64/puppet-agent-6.9.0-1.fc30.x86_64.rpm', 'fedora', '32'] => 'x86_64',
|
9
|
-
['pkg/ubuntu-16.04-amd64/puppet-agent_4.99.0-1xenial_amd64.deb', 'ubuntu', '16.04'] => 'amd64',
|
10
|
-
['artifacts/deb/focal/puppet6/puppet-agent_6.5.0.3094.g16b6fa6f-1focal_arm64.deb', 'ubuntu', '20.04'] => 'aarch64',
|
11
|
-
|
6
|
+
['artifacts/aix/6.1/PC1/ppc/puppet-agent-5.1.0.79.g782e03c-1.aix6.1.ppc.rpm', 'aix', '6.1'] => 'power',
|
7
|
+
['pkg/el-7-x86_64/puppet-agent-4.99.0-1.el7.x86_64.rpm', 'el', '7'] => 'x86_64',
|
12
8
|
['artifacts/ubuntu-16.04-i386/puppetserver_5.0.1-0.1SNAPSHOT.2017.07.27T2346puppetlabs1.debian.tar.gz', 'ubuntu', '16.04'] => 'source',
|
9
|
+
['http://saturn.puppetlabs.net/deb_repos/1234abcd/repos/apt/xenial', 'ubuntu', '16.04'] => 'i386',
|
10
|
+
['pkg/ubuntu-16.04-amd64/puppet-agent_4.99.0-1xenial_amd64.deb', 'ubuntu', '16.04'] => 'amd64',
|
13
11
|
['artifacts/deb/jessie/PC1/puppetserver_5.0.1.master.orig.tar.gz', 'debian', '8'] => 'source',
|
14
12
|
['artifacts/el/6/PC1/SRPMS/puppetserver-5.0.1.master-0.1SNAPSHOT.2017.08.18T0951.el6.src.rpm', 'el', '6'] => 'SRPMS'
|
15
13
|
}
|
16
14
|
arch_transformations.each do |path_array, arch|
|
17
15
|
it "should correctly return #{arch} for #{path_array[0]}" do
|
18
|
-
expect(Pkg::Paths.arch_from_artifact_path(path_array[1], path_array[2], path_array[0]))
|
19
|
-
.to eq(arch)
|
16
|
+
expect(Pkg::Paths.arch_from_artifact_path(path_array[1], path_array[2], path_array[0])).to eq(arch)
|
20
17
|
end
|
21
18
|
end
|
22
19
|
end
|
23
20
|
|
24
21
|
describe '#tag_from_artifact_path' do
|
25
22
|
path_tranformations = {
|
26
|
-
'
|
27
|
-
'pkg/
|
28
|
-
'pkg/
|
23
|
+
'artifacts/aix/6.1/PC1/ppc/puppet-agent-5.1.0.79.g782e03c-1.aix6.1.ppc.rpm' => 'aix-6.1-power',
|
24
|
+
'pkg/el-7-x86_64/puppet-agent-4.99.0-1.el7.x86_64.rpm' => 'el-7-x86_64',
|
25
|
+
'pkg/ubuntu-16.04-amd64/puppet-agent_4.99.0-1xenial_amd64.deb' => 'ubuntu-16.04-amd64',
|
26
|
+
'pkg/windows-x64/puppet-agent-4.99.0-x64.msi' => 'windows-2012-x64',
|
29
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',
|
30
29
|
'pkg/pe/rpm/el-6-i386/pe-puppetserver-2017.3.0.3-1.el6.noarch.rpm' => 'el-6-i386',
|
31
|
-
'pkg/deb/
|
32
|
-
'pkg/deb/
|
33
|
-
'
|
34
|
-
'
|
35
|
-
'pkg/apple/10.
|
36
|
-
'
|
30
|
+
'pkg/pe/deb/xenial/pe-puppetserver_2017.3.0.3-1puppet1_all.deb' => 'ubuntu-16.04-i386',
|
31
|
+
'pkg/pe/deb/xenial/super-trusty-package_1.0.0-1puppet1_all.deb' => 'ubuntu-16.04-i386',
|
32
|
+
'artifacts/deb/wheezy/PC1/puppetdb_4.3.1-1puppetlabs1_all.deb' => 'debian-7-i386',
|
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',
|
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',
|
37
38
|
'pkg/windows/puppet-agent-1.9.0-x86.msi' => 'windows-2012-x86',
|
39
|
+
'artifacts/ubuntu-16.04-i386/puppetserver_5.0.1-0.1SNAPSHOT.2017.07.27T2346puppetlabs1.debian.tar.gz' => 'ubuntu-16.04-source',
|
40
|
+
'http://saturn.puppetlabs.net/deb_repos/1234abcd/repos/apt/xenial' => 'ubuntu-16.04-i386',
|
41
|
+
'http://builds.puppetlabs.lan/puppet-agent/0ce4e6a0448366e01537323bbab77f834d7035c7/repos/el/6/PC1/x86_64/' => 'el-6-x86_64',
|
42
|
+
'http://builds.puppetlabs.lan/puppet-agent/0ce4e6a0448366e01537323bbab77f834d7035c7/repos/el/6/PC1/x86_64/' => 'el-6-x86_64',
|
38
43
|
'pkg/pe/rpm/el-6-i386/pe-puppetserver-2017.3.0.3-1.el6.src.rpm' => 'el-6-SRPMS',
|
39
44
|
'pkg/pe/deb/xenial/pe-puppetserver_2017.3.0.3-1puppet1.orig.tar.gz' => 'ubuntu-16.04-source',
|
40
45
|
'pkg/puppet-agent-5.1.0.79.g782e03c.gem' => nil,
|
@@ -59,105 +64,72 @@ describe 'Pkg::Paths' do
|
|
59
64
|
end
|
60
65
|
|
61
66
|
describe '#repo_name' do
|
62
|
-
it 'should return repo_name for final version' do
|
63
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
64
|
-
expect(Pkg::Paths.repo_name).to eq('puppet6')
|
65
|
-
end
|
66
67
|
|
67
68
|
it 'should return repo_name for final version' do
|
68
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('
|
69
|
-
|
69
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
|
70
|
+
allow(Pkg::Util::Version).to receive(:final?).and_return(true)
|
71
|
+
expect(Pkg::Paths.repo_name).to eq('puppet5')
|
70
72
|
end
|
71
73
|
|
72
74
|
it 'should be empty string if repo_name is not set for final version' do
|
73
75
|
allow(Pkg::Config).to receive(:repo_name).and_return(nil)
|
76
|
+
allow(Pkg::Util::Version).to receive(:final?).and_return(true)
|
74
77
|
expect(Pkg::Paths.repo_name).to eq('')
|
75
78
|
end
|
76
79
|
|
77
80
|
it 'should return nonfinal_repo_name for non-final version' do
|
78
|
-
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('
|
79
|
-
|
81
|
+
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('puppet5-nightly')
|
82
|
+
allow(Pkg::Util::Version).to receive(:final?).and_return(false)
|
83
|
+
expect(Pkg::Paths.repo_name).to eq('puppet5-nightly')
|
80
84
|
end
|
81
85
|
|
82
|
-
it 'should
|
83
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('
|
86
|
+
it 'should return repo_name if nonfinal_repo_name is not set for non-final version' do
|
87
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('puppet5')
|
84
88
|
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nil)
|
85
|
-
|
89
|
+
allow(Pkg::Util::Version).to receive(:final?).and_return(false)
|
90
|
+
expect(Pkg::Paths.repo_name).to eq('puppet5')
|
86
91
|
end
|
87
92
|
end
|
88
93
|
|
89
94
|
describe '#artifacts_path' do
|
90
|
-
|
91
|
-
|
92
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
93
|
-
end
|
94
|
-
|
95
|
-
it 'should work on all current platforms' do
|
96
|
-
Pkg::Platforms.platform_tags.each do |tag|
|
97
|
-
expect { Pkg::Paths.artifacts_path(tag) }.not_to raise_error
|
98
|
-
end
|
99
|
-
end
|
95
|
+
before :each do
|
96
|
+
allow(Pkg::Paths).to receive(:repo_name).and_return('puppet5')
|
100
97
|
end
|
101
98
|
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
end
|
106
|
-
|
107
|
-
it 'should be correct for el7' do
|
108
|
-
expect(Pkg::Paths.artifacts_path('el-7-x86_64'))
|
109
|
-
.to eq('artifacts/puppet6/el/7/x86_64')
|
110
|
-
end
|
111
|
-
|
112
|
-
it 'should be correct for bionic' do
|
113
|
-
expect(Pkg::Paths.artifacts_path('ubuntu-18.04-amd64'))
|
114
|
-
.to eq('artifacts/bionic/puppet6')
|
115
|
-
end
|
116
|
-
|
117
|
-
it 'should be correct for solaris 11' do
|
118
|
-
expect(Pkg::Paths.artifacts_path('solaris-11-sparc'))
|
119
|
-
.to eq('artifacts/solaris/puppet6/11')
|
120
|
-
end
|
99
|
+
it 'should be correct for el7' do
|
100
|
+
expect(Pkg::Paths.artifacts_path('el-7-x86_64')).to eq('artifacts/puppet5/el/7/x86_64')
|
101
|
+
end
|
121
102
|
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
end
|
103
|
+
it 'should be correct for trusty' do
|
104
|
+
expect(Pkg::Paths.artifacts_path('ubuntu-14.04-amd64')).to eq('artifacts/trusty/puppet5')
|
105
|
+
end
|
126
106
|
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end
|
107
|
+
it 'should be correct for solaris 11' do
|
108
|
+
expect(Pkg::Paths.artifacts_path('solaris-11-sparc')).to eq('artifacts/solaris/puppet5/11')
|
109
|
+
end
|
131
110
|
|
132
|
-
|
133
|
-
|
134
|
-
.to eq('artifacts/windows/puppet6')
|
135
|
-
end
|
111
|
+
it 'should be correct for osx' do
|
112
|
+
expect(Pkg::Paths.artifacts_path('osx-10.10-x86_64')).to eq('artifacts/mac/puppet5/10.10/x86_64')
|
136
113
|
end
|
137
114
|
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
end
|
115
|
+
it 'should be correct for windows' do
|
116
|
+
expect(Pkg::Paths.artifacts_path('windows-2012-x64')).to eq('artifacts/windows/puppet5')
|
117
|
+
end
|
142
118
|
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
end
|
147
|
-
it 'should be correct for focal' do
|
148
|
-
expect(Pkg::Paths.artifacts_path('ubuntu-20.04-amd64'))
|
149
|
-
.to eq('artifacts/FUTURE-puppet7/focal')
|
119
|
+
it 'should work on all current platforms' do
|
120
|
+
Pkg::Platforms.platform_tags.each do |tag|
|
121
|
+
expect { Pkg::Paths.artifacts_path(tag) }.not_to raise_error
|
150
122
|
end
|
151
123
|
end
|
152
124
|
end
|
153
125
|
|
154
126
|
describe '#repo_path' do
|
155
127
|
before :each do
|
156
|
-
allow(Pkg::
|
128
|
+
allow(Pkg::Paths).to receive(:repo_name).and_return('puppet5')
|
157
129
|
end
|
158
130
|
|
159
131
|
it 'should be correct' do
|
160
|
-
expect(Pkg::Paths.repo_path('el-7-x86_64')).to eq('repos/
|
132
|
+
expect(Pkg::Paths.repo_path('el-7-x86_64')).to eq('repos/puppet5/el/7/x86_64')
|
161
133
|
end
|
162
134
|
|
163
135
|
it 'should work on all current platforms' do
|
@@ -168,16 +140,8 @@ describe 'Pkg::Paths' do
|
|
168
140
|
end
|
169
141
|
|
170
142
|
describe '#repo_config_path' do
|
171
|
-
it 'should
|
172
|
-
expect(Pkg::Paths.repo_config_path('el-7-x86_64'))
|
173
|
-
.to eq('repo_configs/rpm/*el-7-x86_64*.repo')
|
174
|
-
expect(Pkg::Paths.repo_config_path('ubuntu-18.04-amd64'))
|
175
|
-
.to eq('repo_configs/deb/*bionic*.list')
|
176
|
-
end
|
177
|
-
|
178
|
-
it 'should raise a RuntimeError with unfamilar repo configs' do
|
179
|
-
expect { Pkg::Paths.repo_config_path('bogus') }
|
180
|
-
.to raise_error(/Could not verify that 'bogus' is a valid tag/)
|
143
|
+
it 'should be correct' do
|
144
|
+
expect(Pkg::Paths.repo_config_path('el-7-x86_64')).to eq('repo_configs/rpm/*el-7-x86_64*.repo')
|
181
145
|
end
|
182
146
|
|
183
147
|
it 'should work on all current platforms' do
|
@@ -186,233 +150,4 @@ describe 'Pkg::Paths' do
|
|
186
150
|
end
|
187
151
|
end
|
188
152
|
end
|
189
|
-
|
190
|
-
describe '#apt_repo_name' do
|
191
|
-
it 'should return `Pkg::Config.repo_name` if set' do
|
192
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
193
|
-
allow(Pkg::Config).to receive(:apt_repo_name).and_return('stuff')
|
194
|
-
expect(Pkg::Paths.apt_repo_name).to eq('puppet6')
|
195
|
-
end
|
196
|
-
|
197
|
-
it 'should return `Pkg::Config.apt_repo_name` if `Pkg::Config.repo_name` is not set' do
|
198
|
-
allow(Pkg::Config).to receive(:repo_name).and_return(nil)
|
199
|
-
allow(Pkg::Config).to receive(:apt_repo_name).and_return('puppet6')
|
200
|
-
expect(Pkg::Paths.apt_repo_name).to eq('puppet6')
|
201
|
-
end
|
202
|
-
|
203
|
-
it 'should return \'main\' if nothing is set' do
|
204
|
-
allow(Pkg::Config).to receive(:repo_name).and_return(nil)
|
205
|
-
allow(Pkg::Config).to receive(:apt_repo_name).and_return(nil)
|
206
|
-
expect(Pkg::Paths.apt_repo_name).to eq('main')
|
207
|
-
end
|
208
|
-
|
209
|
-
it 'should return nonfinal_repo_name for nonfinal version' do
|
210
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('FUTURE-puppet7')
|
211
|
-
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('FUTURE-puppet7-nightly')
|
212
|
-
expect(Pkg::Paths.apt_repo_name(true)).to eq('FUTURE-puppet7-nightly')
|
213
|
-
end
|
214
|
-
|
215
|
-
it 'should fail if nonfinal_repo_name is not set for non-final version' do
|
216
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('FUTURE-puppet7')
|
217
|
-
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nil)
|
218
|
-
expect { Pkg::Paths.apt_repo_name(true) }.to raise_error
|
219
|
-
end
|
220
|
-
end
|
221
|
-
|
222
|
-
describe '#yum_repo_name' do
|
223
|
-
it 'should return `Pkg::Config.repo_name` if set' do
|
224
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
225
|
-
allow(Pkg::Config).to receive(:yum_repo_name).and_return('stuff')
|
226
|
-
expect(Pkg::Paths.yum_repo_name).to eq('puppet6')
|
227
|
-
end
|
228
|
-
|
229
|
-
it 'should return `Pkg::Config.yum_repo_name` if `Pkg::Config.repo_name` is not set' do
|
230
|
-
allow(Pkg::Config).to receive(:repo_name).and_return(nil)
|
231
|
-
allow(Pkg::Config).to receive(:yum_repo_name).and_return('FUTURE-puppet7')
|
232
|
-
expect(Pkg::Paths.yum_repo_name).to eq('FUTURE-puppet7')
|
233
|
-
end
|
234
|
-
|
235
|
-
it 'should return \'products\' if nothing is set' do
|
236
|
-
allow(Pkg::Config).to receive(:repo_name).and_return(nil)
|
237
|
-
allow(Pkg::Config).to receive(:yum_repo_name).and_return(nil)
|
238
|
-
expect(Pkg::Paths.yum_repo_name).to eq('products')
|
239
|
-
end
|
240
|
-
|
241
|
-
it 'should return nonfinal_repo_name for nonfinal version' do
|
242
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('FUTURE-puppet7')
|
243
|
-
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('FUTURE-puppet7-nightly')
|
244
|
-
expect(Pkg::Paths.yum_repo_name(true)).to eq('FUTURE-puppet7-nightly')
|
245
|
-
end
|
246
|
-
|
247
|
-
it 'should fail if nonfinal_repo_name is not set for non-final version' do
|
248
|
-
allow(Pkg::Config).to receive(:repo_name).and_return('FUTURE-puppet7')
|
249
|
-
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nil)
|
250
|
-
expect { Pkg::Paths.yum_repo_name(true) }.to raise_error
|
251
|
-
end
|
252
|
-
end
|
253
|
-
|
254
|
-
describe '#remote_repo_base' do
|
255
|
-
fake_yum_repo_path = '/fake/yum'
|
256
|
-
fake_yum_nightly_repo_path = '/fake/yum-nightly'
|
257
|
-
fake_apt_repo_path = '/fake/apt'
|
258
|
-
fake_apt_nightly_repo_path = '/fake/apt-nightly'
|
259
|
-
|
260
|
-
before :each do
|
261
|
-
allow(Pkg::Config).to receive(:yum_repo_path).and_return(fake_yum_repo_path)
|
262
|
-
allow(Pkg::Config).to receive(:apt_repo_path).and_return(fake_apt_repo_path)
|
263
|
-
allow(Pkg::Config).to receive(:dmg_path).and_return('/opt/downloads/mac')
|
264
|
-
allow(Pkg::Config).to receive(:nonfinal_yum_repo_path).and_return(fake_yum_nightly_repo_path)
|
265
|
-
allow(Pkg::Config).to receive(:nonfinal_apt_repo_path).and_return(fake_apt_nightly_repo_path)
|
266
|
-
end
|
267
|
-
it 'returns yum_repo_path for rpms' do
|
268
|
-
expect(Pkg::Paths.remote_repo_base('el-7-x86_64'))
|
269
|
-
.to eq(fake_yum_repo_path)
|
270
|
-
end
|
271
|
-
it 'returns apt_repo_path for debs' do
|
272
|
-
expect(Pkg::Paths.remote_repo_base('ubuntu-18.04-amd64'))
|
273
|
-
.to eq(fake_apt_repo_path)
|
274
|
-
end
|
275
|
-
it 'returns nonfinal_yum_repo_path for nonfinal rpms' do
|
276
|
-
expect(Pkg::Paths.remote_repo_base('fedora-31-x86_64', nonfinal: true))
|
277
|
-
.to eq(fake_yum_nightly_repo_path)
|
278
|
-
end
|
279
|
-
it 'returns nonfinal_apt_repo_path for nonfinal debs' do
|
280
|
-
expect(Pkg::Paths.remote_repo_base('debian-9-amd64', nonfinal: true))
|
281
|
-
.to eq(fake_apt_nightly_repo_path)
|
282
|
-
end
|
283
|
-
it 'fails if neither tag nor package_format is provided' do
|
284
|
-
expect { Pkg::Paths.remote_repo_base }
|
285
|
-
.to raise_error(/Pkg::Paths.remote_repo_base must have/)
|
286
|
-
end
|
287
|
-
|
288
|
-
it 'returns /opt/downloads if the path is /opt/downloads/<something>' do
|
289
|
-
expect(Pkg::Paths.remote_repo_base(package_format: 'dmg')).to eq('/opt/downloads')
|
290
|
-
end
|
291
|
-
|
292
|
-
it 'fails for all other package formats' do
|
293
|
-
expect { Pkg::Paths.remote_repo_base('solaris-11-i386') }
|
294
|
-
.to raise_error(/Can't determine remote repo base path/)
|
295
|
-
end
|
296
|
-
end
|
297
|
-
|
298
|
-
describe '#apt_package_base_path' do
|
299
|
-
it 'fails for non-debian platforms' do
|
300
|
-
expect { Pkg::Paths.apt_package_base_path('el-7-x86_64', 'puppet6', 'puppet-agent') }
|
301
|
-
.to raise_error(/Can't determine path for non-debian platform/)
|
302
|
-
end
|
303
|
-
|
304
|
-
context 'for puppet 6 and prior' do
|
305
|
-
it 'returns the approprate apt repo path' do
|
306
|
-
allow(Pkg::Paths).to receive(:remote_repo_base).and_return('/opt/repository/apt')
|
307
|
-
expect(Pkg::Paths.apt_package_base_path('ubuntu-18.04-amd64', 'puppet6', 'puppet-agent'))
|
308
|
-
.to eq('/opt/repository/apt/pool/bionic/puppet6/p/puppet-agent')
|
309
|
-
expect(Pkg::Paths.apt_package_base_path('debian-9-amd64', 'puppet6', 'bolt-server'))
|
310
|
-
.to eq('/opt/repository/apt/pool/stretch/puppet6/b/bolt-server')
|
311
|
-
|
312
|
-
|
313
|
-
end
|
314
|
-
it 'returns the appropriate nonfinal repo path' do
|
315
|
-
allow(Pkg::Paths).to receive(:remote_repo_base).and_return('/opt/repository-nightlies/apt')
|
316
|
-
expect(Pkg::Paths.apt_package_base_path('ubuntu-18.04-amd64', 'puppet6-nightly',
|
317
|
-
'puppet-agent', true))
|
318
|
-
.to eq('/opt/repository-nightlies/apt/pool/bionic/puppet6-nightly/p/puppet-agent')
|
319
|
-
expect(Pkg::Paths.apt_package_base_path('debian-10-amd64', 'puppet6-nightly',
|
320
|
-
'pdk', true))
|
321
|
-
.to eq('/opt/repository-nightlies/apt/pool/buster/puppet6-nightly/p/pdk')
|
322
|
-
end
|
323
|
-
end
|
324
|
-
|
325
|
-
context 'for puppet 7 and after' do
|
326
|
-
it 'returns the approprate apt repo path' do
|
327
|
-
allow(Pkg::Paths).to receive(:remote_repo_base).and_return('/opt/repository/apt')
|
328
|
-
expect(Pkg::Paths.apt_package_base_path('ubuntu-18.04-amd64', 'FUTURE-puppet7', 'puppet-agent'))
|
329
|
-
.to eq('/opt/repository/apt/FUTURE-puppet7/pool/bionic/p/puppet-agent')
|
330
|
-
expect(Pkg::Paths.apt_package_base_path('ubuntu-20.04-amd64', 'FUTURE-puppet7', 'puppet-agent'))
|
331
|
-
.to eq('/opt/repository/apt/FUTURE-puppet7/pool/focal/p/puppet-agent')
|
332
|
-
end
|
333
|
-
it 'returns the appropriate nonfinal repo path' do
|
334
|
-
allow(Pkg::Paths).to receive(:remote_repo_base).and_return('/opt/repository-nightlies/apt')
|
335
|
-
expect(Pkg::Paths.apt_package_base_path('debian-10-amd64', 'FUTURE-puppet7-nightly', 'pdk', true))
|
336
|
-
.to eq('/opt/repository-nightlies/apt/FUTURE-puppet7-nightly/pool/buster/p/pdk')
|
337
|
-
end
|
338
|
-
end
|
339
|
-
end
|
340
|
-
|
341
|
-
describe '#release_package_link_path' do
|
342
|
-
context 'for puppet 6' do
|
343
|
-
repo_name = 'puppet6'
|
344
|
-
nonfinal_repo_name = 'puppet6-nightly'
|
345
|
-
yum_repo_path = '/opt/repository/yum'
|
346
|
-
apt_repo_path = '/opt/repository/apt'
|
347
|
-
nonfinal_yum_repo_path = '/opt/repository-nightlies/yum'
|
348
|
-
nonfinal_apt_repo_path = '/opt/repository-nightlies/apt'
|
349
|
-
before :each do
|
350
|
-
allow(Pkg::Config).to receive(:repo_name).and_return(repo_name)
|
351
|
-
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nonfinal_repo_name)
|
352
|
-
allow(Pkg::Config).to receive(:yum_repo_path).and_return(yum_repo_path)
|
353
|
-
allow(Pkg::Config).to receive(:apt_repo_path).and_return(apt_repo_path)
|
354
|
-
allow(Pkg::Config).to receive(:nonfinal_yum_repo_path).and_return(nonfinal_yum_repo_path)
|
355
|
-
allow(Pkg::Config).to receive(:nonfinal_apt_repo_path).and_return(nonfinal_apt_repo_path)
|
356
|
-
end
|
357
|
-
it 'returns the appropriate link path for rpm release packages' do
|
358
|
-
expect(Pkg::Paths.release_package_link_path('sles-12-ppc64le'))
|
359
|
-
.to eq("#{yum_repo_path}/#{repo_name}-release-sles-12.noarch.rpm")
|
360
|
-
end
|
361
|
-
it 'returns the appropriate link path for deb release packages' do
|
362
|
-
expect(Pkg::Paths.release_package_link_path('ubuntu-16.04-amd64'))
|
363
|
-
.to eq("#{apt_repo_path}/#{repo_name}-release-xenial.deb")
|
364
|
-
end
|
365
|
-
it 'returns the appropriate link path for nonfinal rpm release packages' do
|
366
|
-
expect(Pkg::Paths.release_package_link_path('el-7-x86_64', true))
|
367
|
-
.to eq("#{nonfinal_yum_repo_path}/#{nonfinal_repo_name}-release-el-7.noarch.rpm")
|
368
|
-
end
|
369
|
-
it 'returns the appropriate link path for nonfinal deb release packages' do
|
370
|
-
expect(Pkg::Paths.release_package_link_path('debian-9-i386', true))
|
371
|
-
.to eq("#{nonfinal_apt_repo_path}/#{nonfinal_repo_name}-release-stretch.deb")
|
372
|
-
end
|
373
|
-
it 'returns nil for package formats that do not have release packages' do
|
374
|
-
expect(Pkg::Paths.release_package_link_path('osx-10.15-x86_64')).to eq(nil)
|
375
|
-
expect(Pkg::Paths.release_package_link_path('osx-11-x86_64')).to eq(nil)
|
376
|
-
expect(Pkg::Paths.release_package_link_path('windows-2012-x86')).to eq(nil)
|
377
|
-
end
|
378
|
-
end
|
379
|
-
|
380
|
-
context 'for puppet 7' do
|
381
|
-
repo_name = 'FUTURE-puppet7'
|
382
|
-
nonfinal_repo_name = 'FUTURE-puppet7-nightly'
|
383
|
-
yum_repo_path = '/opt/repository/yum'
|
384
|
-
apt_repo_path = '/opt/repository/apt'
|
385
|
-
nonfinal_yum_repo_path = '/opt/repository-nightlies/yum'
|
386
|
-
nonfinal_apt_repo_path = '/opt/repository-nightlies/apt'
|
387
|
-
before :each do
|
388
|
-
allow(Pkg::Config).to receive(:repo_name).and_return(repo_name)
|
389
|
-
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nonfinal_repo_name)
|
390
|
-
allow(Pkg::Config).to receive(:yum_repo_path).and_return(yum_repo_path)
|
391
|
-
allow(Pkg::Config).to receive(:apt_repo_path).and_return(apt_repo_path)
|
392
|
-
allow(Pkg::Config).to receive(:nonfinal_yum_repo_path).and_return(nonfinal_yum_repo_path)
|
393
|
-
allow(Pkg::Config).to receive(:nonfinal_apt_repo_path).and_return(nonfinal_apt_repo_path)
|
394
|
-
end
|
395
|
-
it 'returns the appropriate link path for rpm release packages' do
|
396
|
-
expect(Pkg::Paths.release_package_link_path('sles-12-ppc64le'))
|
397
|
-
.to eq("#{yum_repo_path}/#{repo_name}-release-sles-12.noarch.rpm")
|
398
|
-
end
|
399
|
-
it 'returns the appropriate link path for deb release packages' do
|
400
|
-
expect(Pkg::Paths.release_package_link_path('ubuntu-20.04-amd64'))
|
401
|
-
.to eq("#{apt_repo_path}/#{repo_name}-release-focal.deb")
|
402
|
-
end
|
403
|
-
it 'returns the appropriate link path for nonfinal rpm release packages' do
|
404
|
-
expect(Pkg::Paths.release_package_link_path('el-8-x86_64', true))
|
405
|
-
.to eq("#{nonfinal_yum_repo_path}/#{nonfinal_repo_name}-release-el-8.noarch.rpm")
|
406
|
-
end
|
407
|
-
it 'returns the appropriate link path for nonfinal deb release packages' do
|
408
|
-
expect(Pkg::Paths.release_package_link_path('debian-10-i386', true))
|
409
|
-
.to eq("#{nonfinal_apt_repo_path}/#{nonfinal_repo_name}-release-buster.deb")
|
410
|
-
end
|
411
|
-
it 'returns nil for package formats that do not have release packages' do
|
412
|
-
expect(Pkg::Paths.release_package_link_path('osx-10.15-x86_64')).to eq(nil)
|
413
|
-
expect(Pkg::Paths.release_package_link_path('osx-11-x86_64')).to eq(nil)
|
414
|
-
expect(Pkg::Paths.release_package_link_path('windows-2012-x86')).to eq(nil)
|
415
|
-
end
|
416
|
-
end
|
417
|
-
end
|
418
153
|
end
|