packaging 0.88.77
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 +7 -0
- data/LICENSE +17 -0
- data/README-Solaris.md +117 -0
- data/README.md +977 -0
- data/lib/packaging.rb +32 -0
- data/lib/packaging/archive.rb +126 -0
- data/lib/packaging/artifactory.rb +651 -0
- data/lib/packaging/artifactory/extensions.rb +94 -0
- data/lib/packaging/config.rb +492 -0
- data/lib/packaging/config/params.rb +387 -0
- data/lib/packaging/config/validations.rb +13 -0
- data/lib/packaging/deb.rb +28 -0
- data/lib/packaging/deb/repo.rb +264 -0
- data/lib/packaging/gem.rb +70 -0
- data/lib/packaging/metrics.rb +15 -0
- data/lib/packaging/nuget.rb +39 -0
- data/lib/packaging/paths.rb +376 -0
- data/lib/packaging/platforms.rb +507 -0
- data/lib/packaging/repo.rb +155 -0
- data/lib/packaging/retrieve.rb +75 -0
- data/lib/packaging/rpm.rb +5 -0
- data/lib/packaging/rpm/repo.rb +254 -0
- data/lib/packaging/sign.rb +8 -0
- data/lib/packaging/sign/deb.rb +9 -0
- data/lib/packaging/sign/dmg.rb +41 -0
- data/lib/packaging/sign/ips.rb +57 -0
- data/lib/packaging/sign/msi.rb +124 -0
- data/lib/packaging/sign/rpm.rb +115 -0
- data/lib/packaging/tar.rb +163 -0
- data/lib/packaging/util.rb +146 -0
- data/lib/packaging/util/date.rb +20 -0
- data/lib/packaging/util/execution.rb +85 -0
- data/lib/packaging/util/file.rb +125 -0
- data/lib/packaging/util/git.rb +174 -0
- data/lib/packaging/util/git_tags.rb +73 -0
- data/lib/packaging/util/gpg.rb +66 -0
- data/lib/packaging/util/jenkins.rb +95 -0
- data/lib/packaging/util/misc.rb +69 -0
- data/lib/packaging/util/net.rb +410 -0
- data/lib/packaging/util/os.rb +17 -0
- data/lib/packaging/util/platform.rb +40 -0
- data/lib/packaging/util/rake_utils.rb +112 -0
- data/lib/packaging/util/serialization.rb +19 -0
- data/lib/packaging/util/ship.rb +300 -0
- data/lib/packaging/util/tool.rb +41 -0
- data/lib/packaging/util/version.rb +334 -0
- data/spec/fixtures/config/ext/build_defaults.yaml +2 -0
- data/spec/fixtures/config/ext/project_data.yaml +2 -0
- data/spec/fixtures/configs/components/test_file.json +1 -0
- data/spec/fixtures/configs/components/test_file_2.json +0 -0
- data/spec/fixtures/configs/components/test_file_not_tagged.json +1 -0
- data/spec/fixtures/configs/components/test_file_wrong_ext.txt +0 -0
- data/spec/fixtures/configs/components/test_file_wrong_ext.wrong +0 -0
- data/spec/fixtures/util/pre_tasks.yaml +4 -0
- data/spec/lib/packaging/artifactory_spec.rb +221 -0
- data/spec/lib/packaging/config_spec.rb +576 -0
- data/spec/lib/packaging/deb/repo_spec.rb +157 -0
- data/spec/lib/packaging/deb_spec.rb +52 -0
- data/spec/lib/packaging/gem_spec.rb +86 -0
- data/spec/lib/packaging/paths_spec.rb +418 -0
- data/spec/lib/packaging/platforms_spec.rb +178 -0
- data/spec/lib/packaging/repo_spec.rb +135 -0
- data/spec/lib/packaging/retrieve_spec.rb +100 -0
- data/spec/lib/packaging/rpm/repo_spec.rb +133 -0
- data/spec/lib/packaging/sign_spec.rb +133 -0
- data/spec/lib/packaging/tar_spec.rb +116 -0
- data/spec/lib/packaging/util/execution_spec.rb +56 -0
- data/spec/lib/packaging/util/file_spec.rb +139 -0
- data/spec/lib/packaging/util/git_spec.rb +160 -0
- data/spec/lib/packaging/util/git_tag_spec.rb +36 -0
- data/spec/lib/packaging/util/gpg_spec.rb +64 -0
- data/spec/lib/packaging/util/jenkins_spec.rb +112 -0
- data/spec/lib/packaging/util/misc_spec.rb +31 -0
- data/spec/lib/packaging/util/net_spec.rb +259 -0
- data/spec/lib/packaging/util/os_spec.rb +31 -0
- data/spec/lib/packaging/util/rake_utils_spec.rb +70 -0
- data/spec/lib/packaging/util/ship_spec.rb +199 -0
- data/spec/lib/packaging/util/version_spec.rb +123 -0
- data/spec/lib/packaging_spec.rb +19 -0
- data/spec/spec_helper.rb +22 -0
- data/static_artifacts/PackageInfo.plist +3 -0
- data/tasks/00_utils.rake +214 -0
- data/tasks/30_metrics.rake +33 -0
- data/tasks/apple.rake +268 -0
- data/tasks/archive.rake +69 -0
- data/tasks/build.rake +12 -0
- data/tasks/clean.rake +5 -0
- data/tasks/config.rake +35 -0
- data/tasks/deb.rake +129 -0
- data/tasks/deb_repos.rake +28 -0
- data/tasks/deprecated.rake +130 -0
- data/tasks/doc.rake +20 -0
- data/tasks/education.rake +57 -0
- data/tasks/fetch.rake +60 -0
- data/tasks/gem.rake +159 -0
- data/tasks/jenkins.rake +538 -0
- data/tasks/jenkins_dynamic.rake +202 -0
- data/tasks/load_extras.rake +21 -0
- data/tasks/mock.rake +348 -0
- data/tasks/nightly_repos.rake +286 -0
- data/tasks/pe_deb.rake +12 -0
- data/tasks/pe_rpm.rake +13 -0
- data/tasks/pe_ship.rake +226 -0
- data/tasks/pe_sign.rake +13 -0
- data/tasks/pe_tar.rake +5 -0
- data/tasks/retrieve.rake +52 -0
- data/tasks/rpm.rake +66 -0
- data/tasks/rpm_repos.rake +29 -0
- data/tasks/ship.rake +692 -0
- data/tasks/sign.rake +154 -0
- data/tasks/tag.rake +8 -0
- data/tasks/tar.rake +28 -0
- data/tasks/update.rake +16 -0
- data/tasks/vanagon.rake +35 -0
- data/tasks/vendor_gems.rake +117 -0
- data/tasks/version.rake +33 -0
- data/tasks/z_data_dump.rake +65 -0
- data/templates/README +1 -0
- data/templates/downstream.xml.erb +47 -0
- data/templates/msi.xml.erb +197 -0
- data/templates/packaging.xml.erb +346 -0
- data/templates/repo.xml.erb +117 -0
- metadata +287 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe "Pkg::Deb::Repo" do
|
|
4
|
+
let(:wget) { "/opt/tools/bin/wget" }
|
|
5
|
+
let(:builds_server) { "saturn.puppetlabs.net" }
|
|
6
|
+
let(:project) { "deb_repos" }
|
|
7
|
+
let(:ref) { "1234abcd" }
|
|
8
|
+
let(:base_url) { "http://#{builds_server}/#{project}/#{ref}" }
|
|
9
|
+
let(:cows) { ["xenial", "jessie", "trusty", "stretch", ""] }
|
|
10
|
+
let(:wget_results) { cows.map {|cow| "#{base_url}/repos/apt/#{cow}" }.join("\n") }
|
|
11
|
+
let(:wget_garbage) { "\n and an index\nhttp://somethingelse.com/robots" }
|
|
12
|
+
let(:repo_configs) { cows.reject {|cow| cow.empty?}.map {|dist| "pkg/repo_configs/deb/pl-#{project}-#{ref}-#{dist}.list" } }
|
|
13
|
+
|
|
14
|
+
# Setup and tear down for the tests
|
|
15
|
+
around do |example|
|
|
16
|
+
orig_server = Pkg::Config.builds_server
|
|
17
|
+
orig_host = Pkg::Config.distribution_server
|
|
18
|
+
orig_project = Pkg::Config.project
|
|
19
|
+
orig_ref = Pkg::Config.ref
|
|
20
|
+
orig_repo_path = Pkg::Config.jenkins_repo_path
|
|
21
|
+
Pkg::Config.builds_server = builds_server
|
|
22
|
+
Pkg::Config.project = project
|
|
23
|
+
Pkg::Config.ref = ref
|
|
24
|
+
example.run
|
|
25
|
+
Pkg::Config.builds_server = orig_server
|
|
26
|
+
Pkg::Config.distribution_server = orig_host
|
|
27
|
+
Pkg::Config.project = orig_project
|
|
28
|
+
Pkg::Config.ref = orig_ref
|
|
29
|
+
Pkg::Config.jenkins_repo_path = orig_repo_path
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
describe "#generate_repo_configs" do
|
|
33
|
+
it "fails if wget isn't available" do
|
|
34
|
+
Pkg::Util::Tool.should_receive(:find_tool).with("wget", {:required => true}).and_raise(RuntimeError)
|
|
35
|
+
expect {Pkg::Deb::Repo.generate_repo_configs}.to raise_error(RuntimeError)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "warns if there are no deb repos available for the build" do
|
|
39
|
+
Pkg::Util::Tool.should_receive(:find_tool).with("wget", {:required => true}).and_return(wget)
|
|
40
|
+
Pkg::Util::Execution.should_receive(:capture3).with("#{wget} --spider -r -l 1 --no-parent #{base_url}/repos/apt/ 2>&1").and_raise(RuntimeError)
|
|
41
|
+
Pkg::Deb::Repo.should_receive(:warn).with("No debian repos available for #{project} at #{ref}.")
|
|
42
|
+
Pkg::Deb::Repo.generate_repo_configs
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
it "writes the expected repo configs to disk" do
|
|
46
|
+
Pkg::Util::Tool.should_receive(:find_tool).with("wget", {:required => true}).and_return(wget)
|
|
47
|
+
Pkg::Util::Execution.should_receive(:capture3).with("#{wget} --spider -r -l 1 --no-parent #{base_url}/repos/apt/ 2>&1").and_return(wget_results + wget_garbage)
|
|
48
|
+
FileUtils.should_receive(:mkdir_p).with("pkg/repo_configs/deb")
|
|
49
|
+
config = []
|
|
50
|
+
repo_configs.each_with_index do |repo_config, i|
|
|
51
|
+
config[i] = double(File)
|
|
52
|
+
File.should_receive(:open).with(repo_config, 'w').and_yield(config[i])
|
|
53
|
+
config[i].should_receive(:puts)
|
|
54
|
+
end
|
|
55
|
+
Pkg::Deb::Repo.generate_repo_configs
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe "#retrieve_repo_configs" do
|
|
60
|
+
it "fails if wget isn't available" do
|
|
61
|
+
Pkg::Util::Tool.should_receive(:find_tool).with("wget", {:required => true}).and_raise(RuntimeError)
|
|
62
|
+
expect {Pkg::Deb::Repo.generate_repo_configs}.to raise_error(RuntimeError)
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it "warns if there are no deb repos available for the build" do
|
|
66
|
+
Pkg::Util::Tool.should_receive(:find_tool).with("wget", {:required => true}).and_return(wget)
|
|
67
|
+
FileUtils.should_receive(:mkdir_p).with("pkg/repo_configs").and_return(true)
|
|
68
|
+
Pkg::Util::Execution.should_receive(:capture3).with("#{wget} -r -np -nH --cut-dirs 3 -P pkg/repo_configs --reject 'index*' #{base_url}/repo_configs/deb/").and_raise(RuntimeError)
|
|
69
|
+
expect {Pkg::Deb::Repo.retrieve_repo_configs}.to raise_error(RuntimeError, /Couldn't retrieve deb apt repo configs/)
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
describe "#repo_creation_command" do
|
|
74
|
+
let(:prefix) { "thing" }
|
|
75
|
+
let(:artifact_directory) { ["/a/b/c/xenial"] }
|
|
76
|
+
|
|
77
|
+
it "returns a command to make repos" do
|
|
78
|
+
command = Pkg::Deb::Repo.repo_creation_command(prefix, artifact_directory)
|
|
79
|
+
command.should match(/reprepro/)
|
|
80
|
+
command.should match(/#{prefix}/)
|
|
81
|
+
command.should match(/#{artifact_directory}/)
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
describe "#create_repos" do
|
|
86
|
+
let(:command) { "/usr/bin/make some repos" }
|
|
87
|
+
let(:artifact_directory) { "/tmp/dir/thing" }
|
|
88
|
+
let(:pkg_directories) { ['place/to/deb/xenial', 'other/deb/trusty'] }
|
|
89
|
+
|
|
90
|
+
it "generates repo configs remotely and then ships them" do
|
|
91
|
+
File.stub(:join) {artifact_directory}
|
|
92
|
+
Pkg::Repo.should_receive(:directories_that_contain_packages).and_return(pkg_directories)
|
|
93
|
+
Pkg::Repo.should_receive(:populate_repo_directory)
|
|
94
|
+
Pkg::Deb::Repo.should_receive(:repo_creation_command).and_return(command)
|
|
95
|
+
Pkg::Util::Net.should_receive(:remote_execute).with(Pkg::Config.distribution_server, command)
|
|
96
|
+
Pkg::Deb::Repo.should_receive(:generate_repo_configs)
|
|
97
|
+
Pkg::Deb::Repo.should_receive(:ship_repo_configs)
|
|
98
|
+
Pkg::Util::Net.should_receive(:remote_execute).with(Pkg::Config.distribution_server, "rm -f #{artifact_directory}/repos/.lock" )
|
|
99
|
+
Pkg::Deb::Repo.create_repos
|
|
100
|
+
end
|
|
101
|
+
end
|
|
102
|
+
|
|
103
|
+
describe "#ship_repo_configs" do
|
|
104
|
+
it "warns if there are no repo configs to ship" do
|
|
105
|
+
File.should_receive(:exist?).with("pkg/repo_configs/deb").and_return(true)
|
|
106
|
+
Pkg::Util::File.should_receive(:empty_dir?).with("pkg/repo_configs/deb").and_return(true)
|
|
107
|
+
Pkg::Deb::Repo.should_receive(:warn).with("No repo configs have been generated! Try pl:deb_repo_configs.")
|
|
108
|
+
Pkg::Deb::Repo.ship_repo_configs
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
it "ships repo configs to the build server" do
|
|
112
|
+
File.should_receive(:exist?).with("pkg/repo_configs/deb").and_return(true)
|
|
113
|
+
Pkg::Config.jenkins_repo_path = "/a/b/c/d"
|
|
114
|
+
Pkg::Config.distribution_server = "a.host.that.wont.exist"
|
|
115
|
+
repo_dir = "#{Pkg::Config.jenkins_repo_path}/#{Pkg::Config.project}/#{Pkg::Config.ref}/repo_configs/deb"
|
|
116
|
+
Pkg::Util::File.should_receive(:empty_dir?).with("pkg/repo_configs/deb").and_return(false)
|
|
117
|
+
Pkg::Util::RakeUtils.should_receive(:invoke_task).with("pl:fetch")
|
|
118
|
+
Pkg::Util::Net.should_receive(:remote_execute).with(Pkg::Config.distribution_server, "mkdir -p #{repo_dir}")
|
|
119
|
+
Pkg::Util::Execution.should_receive(:retry_on_fail).with(:times => 3)
|
|
120
|
+
Pkg::Deb::Repo.ship_repo_configs
|
|
121
|
+
end
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
describe "#sign_repos" do
|
|
125
|
+
it "fails without reprepro" do
|
|
126
|
+
Pkg::Util::Tool.should_receive(:find_tool).with('reprepro', {:required => true}).and_raise(RuntimeError)
|
|
127
|
+
expect { Pkg::Deb::Repo.sign_repos }.to raise_error(RuntimeError)
|
|
128
|
+
end
|
|
129
|
+
|
|
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
|
+
dists = cows.reject { |cow| cow.empty? }
|
|
135
|
+
distfiles = {}
|
|
136
|
+
Pkg::Util::File.should_receive(:directories).with("repos/apt").and_return(dists)
|
|
137
|
+
|
|
138
|
+
# Let the keychain command happen if find_tool('keychain') finds it
|
|
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")
|
|
146
|
+
|
|
147
|
+
dists.each do |dist|
|
|
148
|
+
distfiles[dist] = double
|
|
149
|
+
Dir.should_receive(:chdir).with("repos/apt/#{dist}").and_yield
|
|
150
|
+
File.should_receive(:open).with("conf/distributions", "w").and_yield(distfiles[dist])
|
|
151
|
+
distfiles[dist].should_receive(:puts)
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
Pkg::Deb::Repo.sign_repos
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# -*- ruby -*-
|
|
2
|
+
require 'spec_helper'
|
|
3
|
+
require 'packaging/deb'
|
|
4
|
+
|
|
5
|
+
describe 'deb.rb' do
|
|
6
|
+
describe "#set_cow_envs" do
|
|
7
|
+
before(:each) do
|
|
8
|
+
reset_env(["DIST", "ARCH", "PE_VER", "BUILDMIRROR"])
|
|
9
|
+
Pkg::Config.deb_build_mirrors = nil
|
|
10
|
+
Pkg::Config.build_pe = nil
|
|
11
|
+
Pkg::Config.pe_version = nil
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
after(:all) do
|
|
15
|
+
reset_env(["DIST", "ARCH", "PE_VER", "BUILDMIRROR"])
|
|
16
|
+
Pkg::Config.deb_build_mirrors = nil
|
|
17
|
+
Pkg::Config.build_pe = nil
|
|
18
|
+
Pkg::Config.pe_version = nil
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
it "should always set DIST and ARCH correctly" do
|
|
22
|
+
Pkg::Deb.send(:set_cow_envs, "base-wheezy-i386.cow")
|
|
23
|
+
ENV["DIST"].should eq("wheezy")
|
|
24
|
+
ENV["ARCH"].should eq("i386")
|
|
25
|
+
ENV["PE_VER"].should be_nil
|
|
26
|
+
ENV["BUILDMIRROR"].should be_nil
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
it "should set BUILDMIRROR if Pkg::Config.deb_build_mirrors is set" do
|
|
30
|
+
Pkg::Config.deb_build_mirrors = ["deb http://pl-build-tools.delivery.puppetlabs.net/debian __DIST__ main", "deb http://debian.is.awesome/wait no it is not"]
|
|
31
|
+
Pkg::Deb.send(:set_cow_envs, "base-wheezy-i386.cow")
|
|
32
|
+
ENV["DIST"].should eq("wheezy")
|
|
33
|
+
ENV["ARCH"].should eq("i386")
|
|
34
|
+
ENV["PE_VER"].should be_nil
|
|
35
|
+
ENV["BUILDMIRROR"].should eq("deb http://pl-build-tools.delivery.puppetlabs.net/debian wheezy main | deb http://debian.is.awesome/wait no it is not")
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
it "should set PE_VER if Pkg::Config.build_pe is truthy" do
|
|
39
|
+
Pkg::Config.build_pe = true
|
|
40
|
+
Pkg::Config.pe_version = "3.2"
|
|
41
|
+
Pkg::Deb.send(:set_cow_envs, "base-wheezy-i386.cow")
|
|
42
|
+
ENV["DIST"].should eq("wheezy")
|
|
43
|
+
ENV["ARCH"].should eq("i386")
|
|
44
|
+
ENV["PE_VER"].should eq("3.2")
|
|
45
|
+
ENV["BUILDMIRROR"].should be_nil
|
|
46
|
+
end
|
|
47
|
+
|
|
48
|
+
it "should fail on a badly formatted cow" do
|
|
49
|
+
expect { Pkg::Deb.send(:set_cow_envs, "wheezy-i386") }.to raise_error(RuntimeError)
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'Pkg::Gem' do
|
|
4
|
+
describe '#shipped_to_rubygems?' do
|
|
5
|
+
let(:gem_data) {
|
|
6
|
+
[
|
|
7
|
+
{"authors"=>"Puppet Labs",
|
|
8
|
+
"built_at"=>"2018-12-17T00:00:00.000Z",
|
|
9
|
+
"created_at"=>"2018-12-18T17:31:50.852Z",
|
|
10
|
+
"description"=>"Puppet, an automated configuration management tool",
|
|
11
|
+
"downloads_count"=>32750,
|
|
12
|
+
"metadata"=>{},
|
|
13
|
+
"number"=>"6.1.0",
|
|
14
|
+
"summary"=>"Puppet, an automated configuration management tool",
|
|
15
|
+
"platform"=>"ruby",
|
|
16
|
+
"rubygems_version"=>"> 1.3.1",
|
|
17
|
+
"ruby_version"=>">= 2.3.0",
|
|
18
|
+
"prerelease"=>false,
|
|
19
|
+
"licenses"=>[],
|
|
20
|
+
"requirements"=>[],
|
|
21
|
+
"sha"=>"71ecec1f554cd7a7f23abf1523e4f0f15fb8ddbc973201234d0cc2a889566373"},
|
|
22
|
+
{"authors"=>"Puppet Labs",
|
|
23
|
+
"built_at"=>"2019-01-14T00:00:00.000Z",
|
|
24
|
+
"created_at"=>"2019-01-15T15:25:25.183Z",
|
|
25
|
+
"description"=>"Puppet, an automated configuration management tool",
|
|
26
|
+
"downloads_count"=>540,
|
|
27
|
+
"metadata"=>{},
|
|
28
|
+
"number"=>"6.0.5",
|
|
29
|
+
"summary"=>"Puppet, an automated configuration management tool",
|
|
30
|
+
"platform"=>"ruby",
|
|
31
|
+
"rubygems_version"=>"> 1.3.1",
|
|
32
|
+
"ruby_version"=>">= 2.3.0",
|
|
33
|
+
"prerelease"=>false,
|
|
34
|
+
"licenses"=>[],
|
|
35
|
+
"requirements"=>[],
|
|
36
|
+
"sha"=>"76811bcf4c5ab75470dd6ae5eea552347767748bd80136cac74261336b208916"},
|
|
37
|
+
{"authors"=>"Puppet Labs",
|
|
38
|
+
"built_at"=>"2018-10-31T00:00:00.000Z",
|
|
39
|
+
"created_at"=>"2018-11-01T17:07:19.274Z",
|
|
40
|
+
"description"=>"Puppet, an automated configuration management tool",
|
|
41
|
+
"downloads_count"=>71808,
|
|
42
|
+
"metadata"=>{},
|
|
43
|
+
"number"=>"6.0.4",
|
|
44
|
+
"summary"=>"Puppet, an automated configuration management tool",
|
|
45
|
+
"platform"=>"ruby",
|
|
46
|
+
"rubygems_version"=>"> 1.3.1",
|
|
47
|
+
"ruby_version"=>">= 2.3.0",
|
|
48
|
+
"prerelease"=>false,
|
|
49
|
+
"licenses"=>[],
|
|
50
|
+
"requirements"=>[],
|
|
51
|
+
"sha"=>"203e8b529d37260115ab7e804e607dde5e543144331b40c3c4a77c2d33445026"},
|
|
52
|
+
{"authors"=>"Puppet Labs",
|
|
53
|
+
"built_at"=>"2018-10-31T00:00:00.000Z",
|
|
54
|
+
"created_at"=>"2018-11-01T17:07:10.268Z",
|
|
55
|
+
"description"=>"Puppet, an automated configuration management tool",
|
|
56
|
+
"downloads_count"=>1179,
|
|
57
|
+
"metadata"=>{},
|
|
58
|
+
"number"=>"6.0.4",
|
|
59
|
+
"summary"=>"Puppet, an automated configuration management tool",
|
|
60
|
+
"platform"=>"x86-mingw32",
|
|
61
|
+
"rubygems_version"=>"> 1.3.1",
|
|
62
|
+
"ruby_version"=>">= 2.3.0",
|
|
63
|
+
"prerelease"=>false,
|
|
64
|
+
"licenses"=>[],
|
|
65
|
+
"requirements"=>[],
|
|
66
|
+
"sha"=>"e57ef7d537aaf66343615d7413d1ff759cc2b6ae95cc90514dd8f3caf0f08cb1"}
|
|
67
|
+
]
|
|
68
|
+
}
|
|
69
|
+
it 'returns true if gem version has already been shipped' do
|
|
70
|
+
allow(JSON).to receive(:parse).and_return(gem_data)
|
|
71
|
+
expect(Pkg::Gem.shipped_to_rubygems?('puppet', '6.0.5', 'ruby')).to be true
|
|
72
|
+
end
|
|
73
|
+
it 'returns false if the platform doesn\'t match' do
|
|
74
|
+
allow(JSON).to receive(:parse).and_return(gem_data)
|
|
75
|
+
expect(Pkg::Gem.shipped_to_rubygems?('puppet', '6.0.5', 'x64-mingw32')).to be false
|
|
76
|
+
end
|
|
77
|
+
it 'returns false if gem version has not already been shipped' do
|
|
78
|
+
allow(JSON).to receive(:parse).and_return(gem_data)
|
|
79
|
+
expect(Pkg::Gem.shipped_to_rubygems?('puppet', '6.0.9', 'ruby')).to be false
|
|
80
|
+
end
|
|
81
|
+
it 'returns false if gem is not found at all on rubygems' do
|
|
82
|
+
expect { Pkg::Gem.shipped_to_rubygems?('totally-not-a-real-gem', '9.9.9', 'ruby') }.to_not raise_error
|
|
83
|
+
expect(Pkg::Gem.shipped_to_rubygems?('totally-not-a-real-gem', '9.9.9', 'ruby')).to be false
|
|
84
|
+
end
|
|
85
|
+
end
|
|
86
|
+
end
|
|
@@ -0,0 +1,418 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'Pkg::Paths' do
|
|
4
|
+
describe '#arch_from_artifact_path' do
|
|
5
|
+
arch_transformations = {
|
|
6
|
+
['pkg/el-8-x86_64/puppet-agent-6.9.0-1.el8.x86_64.rpm', 'el', '8'] => 'x86_64',
|
|
7
|
+
['pkg/el/8/puppet6/aarch64/puppet-agent-6.5.0.3094.g16b6fa6f-1.el8.aarch64.rpm', 'el', '8'] => 'aarch64',
|
|
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
|
+
|
|
12
|
+
['artifacts/ubuntu-16.04-i386/puppetserver_5.0.1-0.1SNAPSHOT.2017.07.27T2346puppetlabs1.debian.tar.gz', 'ubuntu', '16.04'] => 'source',
|
|
13
|
+
['artifacts/deb/jessie/PC1/puppetserver_5.0.1.master.orig.tar.gz', 'debian', '8'] => 'source',
|
|
14
|
+
['artifacts/el/6/PC1/SRPMS/puppetserver-5.0.1.master-0.1SNAPSHOT.2017.08.18T0951.el6.src.rpm', 'el', '6'] => 'SRPMS'
|
|
15
|
+
}
|
|
16
|
+
arch_transformations.each do |path_array, arch|
|
|
17
|
+
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)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
describe '#tag_from_artifact_path' do
|
|
25
|
+
path_tranformations = {
|
|
26
|
+
'pkg/el-7-x86_64/puppet-agent-5.5.22-1.el8.x86_64.rpm' => 'el-7-x86_64',
|
|
27
|
+
'pkg/ubuntu-20.04-amd64/puppet-agent_5.5.22-1xenial_amd64.deb' => 'ubuntu-20.04-amd64',
|
|
28
|
+
'pkg/windows/puppet-agent-5.5.22-x86.msi' => 'windows-2012-x86',
|
|
29
|
+
'artifacts/el/6/products/x86_64/pe-r10k-2.5.4.3-1.el6.x86_64.rpm' => 'el-6-x86_64',
|
|
30
|
+
'pkg/pe/rpm/el-6-i386/pe-puppetserver-2017.3.0.3-1.el6.noarch.rpm' => 'el-6-i386',
|
|
31
|
+
'pkg/deb/bionic/pe-r10k_3.5.2.0-1bionic_amd64.deb' => 'ubuntu-18.04-amd64',
|
|
32
|
+
'pkg/deb/buster/pe-r10k_3.5.2.0-1buster_amd64.deb' => 'debian-10-amd64',
|
|
33
|
+
'pkg/pe/deb/bionic/pe-puppetserver_2019.8.2.32-1bionic_all.deb' => 'ubuntu-18.04-amd64',
|
|
34
|
+
'artifacts/deb/focal/puppet6/puppetdb_6.13.0-1focal_all.deb' => 'ubuntu-20.04-amd64',
|
|
35
|
+
'pkg/apple/10.15/puppet6/x86_64/puppet-agent-6.19.0-1.osx10.15.dmg' => 'osx-10.15-x86_64',
|
|
36
|
+
'pkg/apple/11/puppet6/x86_64/puppet-agent-6.19.0-1.osx11.dmg' => 'osx-11-x86_64',
|
|
37
|
+
'pkg/windows/puppet-agent-1.9.0-x86.msi' => 'windows-2012-x86',
|
|
38
|
+
'pkg/pe/rpm/el-6-i386/pe-puppetserver-2017.3.0.3-1.el6.src.rpm' => 'el-6-SRPMS',
|
|
39
|
+
'pkg/pe/deb/xenial/pe-puppetserver_2017.3.0.3-1puppet1.orig.tar.gz' => 'ubuntu-16.04-source',
|
|
40
|
+
'pkg/puppet-agent-5.1.0.79.g782e03c.gem' => nil,
|
|
41
|
+
'pkg/puppet-agent-5.1.0.7.g782e03c.tar.gz' => nil,
|
|
42
|
+
}
|
|
43
|
+
path_tranformations.each do |pre, post|
|
|
44
|
+
it "should correctly return '#{post}' when given #{pre}" do
|
|
45
|
+
expect(Pkg::Paths.tag_from_artifact_path(pre)).to eq(post)
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
failure_cases = [
|
|
50
|
+
'pkg/pe/deb/preice',
|
|
51
|
+
'pkg/el-4-x86_64',
|
|
52
|
+
'a/package/that/sucks.rpm',
|
|
53
|
+
]
|
|
54
|
+
failure_cases.each do |fail_path|
|
|
55
|
+
it "should fail gracefully if given '#{fail_path}'" do
|
|
56
|
+
expect { Pkg::Paths.tag_from_artifact_path(fail_path) }.to raise_error
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
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
|
+
it 'should return repo_name for final version' do
|
|
68
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('FUTURE-puppet7')
|
|
69
|
+
expect(Pkg::Paths.repo_name).to eq('FUTURE-puppet7')
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it 'should be empty string if repo_name is not set for final version' do
|
|
73
|
+
allow(Pkg::Config).to receive(:repo_name).and_return(nil)
|
|
74
|
+
expect(Pkg::Paths.repo_name).to eq('')
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
it 'should return nonfinal_repo_name for non-final version' do
|
|
78
|
+
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return('puppet6-nightly')
|
|
79
|
+
expect(Pkg::Paths.repo_name(true)).to eq('puppet6-nightly')
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
it 'should fail if nonfinal_repo_name is not set for non-final version' do
|
|
83
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
|
84
|
+
allow(Pkg::Config).to receive(:nonfinal_repo_name).and_return(nil)
|
|
85
|
+
expect { Pkg::Paths.repo_name(true) }.to raise_error
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
describe '#artifacts_path' do
|
|
90
|
+
context 'all puppet versions' do
|
|
91
|
+
before :each do
|
|
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
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
context 'for puppet 6 and prior' do
|
|
103
|
+
before :each do
|
|
104
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
|
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
|
|
121
|
+
|
|
122
|
+
it 'should be correct for osx' do
|
|
123
|
+
expect(Pkg::Paths.artifacts_path('osx-10.15-x86_64'))
|
|
124
|
+
.to eq('artifacts/mac/puppet6/10.15/x86_64')
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
it 'should be correct for osx11' do
|
|
128
|
+
expect(Pkg::Paths.artifacts_path('osx-11-x86_64'))
|
|
129
|
+
.to eq('artifacts/mac/puppet6/11/x86_64')
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
it 'should be correct for windows' do
|
|
133
|
+
expect(Pkg::Paths.artifacts_path('windows-2012-x64'))
|
|
134
|
+
.to eq('artifacts/windows/puppet6')
|
|
135
|
+
end
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
context 'after puppet 7 apt changes' do
|
|
139
|
+
before :each do
|
|
140
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('FUTURE-puppet7')
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
it 'should be correct for bionic' do
|
|
144
|
+
expect(Pkg::Paths.artifacts_path('ubuntu-18.04-amd64'))
|
|
145
|
+
.to eq('artifacts/FUTURE-puppet7/bionic')
|
|
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')
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
describe '#repo_path' do
|
|
155
|
+
before :each do
|
|
156
|
+
allow(Pkg::Config).to receive(:repo_name).and_return('puppet6')
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
it 'should be correct' do
|
|
160
|
+
expect(Pkg::Paths.repo_path('el-7-x86_64')).to eq('repos/puppet6/el/7/x86_64')
|
|
161
|
+
end
|
|
162
|
+
|
|
163
|
+
it 'should work on all current platforms' do
|
|
164
|
+
Pkg::Platforms.platform_tags.each do |tag|
|
|
165
|
+
expect { Pkg::Paths.repo_path(tag) }.not_to raise_error
|
|
166
|
+
end
|
|
167
|
+
end
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
describe '#repo_config_path' do
|
|
171
|
+
it 'should construct rpm/deb-specific repo configs' do
|
|
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/)
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
it 'should work on all current platforms' do
|
|
184
|
+
Pkg::Platforms.platform_tags.each do |tag|
|
|
185
|
+
expect { Pkg::Paths.repo_config_path(tag) }.not_to raise_error
|
|
186
|
+
end
|
|
187
|
+
end
|
|
188
|
+
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
|
+
end
|