packaging 0.88.77 → 0.99.0
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 +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
@@ -3,8 +3,8 @@ require 'spec_helper'
|
|
3
3
|
describe 'Pkg::Platforms' do
|
4
4
|
describe '#by_package_format' do
|
5
5
|
it 'should return an array of platforms that use a given format' do
|
6
|
-
deb_platforms = ['debian', 'ubuntu']
|
7
|
-
rpm_platforms = ['aix', 'el', 'fedora', '
|
6
|
+
deb_platforms = ['cumulus', 'debian', 'ubuntu']
|
7
|
+
rpm_platforms = ['aix', 'cisco-wrlinux', 'el', 'fedora', 'redhat-fips', 'sles']
|
8
8
|
expect(Pkg::Platforms.by_package_format('deb')).to match_array(deb_platforms)
|
9
9
|
expect(Pkg::Platforms.by_package_format('rpm')).to match_array(rpm_platforms)
|
10
10
|
end
|
@@ -12,21 +12,21 @@ 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', 'debian', 'el', 'fedora', 'osx', '
|
22
|
+
platforms = ['aix', 'cisco-wrlinux', 'cumulus', 'debian', 'el', 'eos', 'fedora', 'osx', 'redhat-fips', 'sles', 'solaris', 'ubuntu', 'windows']
|
23
23
|
expect(Pkg::Platforms.supported_platforms).to match_array(platforms)
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
27
27
|
describe '#versions_for_platform' do
|
28
28
|
it 'should return all supported versions for a given platform' do
|
29
|
-
expect(Pkg::Platforms.versions_for_platform('el')).to match_array(['5', '6', '7'
|
29
|
+
expect(Pkg::Platforms.versions_for_platform('el')).to match_array(['5', '6', '7'])
|
30
30
|
end
|
31
31
|
|
32
32
|
it 'should raise an error if given a nonexistent platform' do
|
@@ -36,7 +36,7 @@ describe 'Pkg::Platforms' do
|
|
36
36
|
|
37
37
|
describe '#codenames' do
|
38
38
|
it 'should return all codenames for a given platform' do
|
39
|
-
codenames = ['
|
39
|
+
codenames = ['cumulus', 'wheezy', 'jessie', 'stretch', 'trusty', 'xenial']
|
40
40
|
expect(Pkg::Platforms.codenames).to match_array(codenames)
|
41
41
|
end
|
42
42
|
end
|
@@ -59,27 +59,19 @@ describe 'Pkg::Platforms' do
|
|
59
59
|
|
60
60
|
describe '#arches_for_codename' do
|
61
61
|
it 'should return an array of arches corresponding to a given codename' do
|
62
|
-
expect(Pkg::Platforms.arches_for_codename('
|
63
|
-
end
|
64
|
-
|
65
|
-
it 'should be able to include source archietectures' do
|
66
|
-
expect(Pkg::Platforms.arches_for_codename('xenial', true)).to match_array(["amd64", "i386", "ppc64el", "source"])
|
62
|
+
expect(Pkg::Platforms.arches_for_codename('trusty')).to match_array(['i386', 'amd64'])
|
67
63
|
end
|
68
64
|
end
|
69
65
|
|
70
66
|
describe '#codename_to_tags' do
|
71
67
|
it 'should return an array of platform tags corresponding to a given codename' do
|
72
|
-
expect(Pkg::Platforms.codename_to_tags('
|
68
|
+
expect(Pkg::Platforms.codename_to_tags('trusty')).to match_array(['ubuntu-14.04-i386', 'ubuntu-14.04-amd64'])
|
73
69
|
end
|
74
70
|
end
|
75
71
|
|
76
72
|
describe '#arches_for_platform_version' do
|
77
73
|
it 'should return an array of arches for a given platform and version' do
|
78
|
-
expect(Pkg::Platforms.arches_for_platform_version('sles', '
|
79
|
-
end
|
80
|
-
|
81
|
-
it 'should be able to include source architectures' do
|
82
|
-
expect(Pkg::Platforms.arches_for_platform_version('sles', '12', true)).to match_array(["SRPMS", "ppc64le", "x86_64"])
|
74
|
+
expect(Pkg::Platforms.arches_for_platform_version('sles', '11')).to match_array(['i386', 'x86_64', 's390x'])
|
83
75
|
end
|
84
76
|
end
|
85
77
|
|
@@ -97,16 +89,14 @@ describe 'Pkg::Platforms' do
|
|
97
89
|
end
|
98
90
|
|
99
91
|
describe '#platform_lookup' do
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
end
|
109
|
-
end
|
92
|
+
it 'should return a hash of platform info' do
|
93
|
+
expect(Pkg::Platforms.platform_lookup('osx-10.10-x86_64')).to be_instance_of(Hash)
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'should include at least arch and package format keys' do
|
97
|
+
expect(Pkg::Platforms.platform_lookup('osx-10.10-x86_64').keys).to include(:architectures)
|
98
|
+
expect(Pkg::Platforms.platform_lookup('osx-10.10-x86_64').keys).to include(:package_format)
|
99
|
+
end
|
110
100
|
end
|
111
101
|
|
112
102
|
describe '#get_attribute' do
|
@@ -115,7 +105,7 @@ describe 'Pkg::Platforms' do
|
|
115
105
|
end
|
116
106
|
|
117
107
|
it 'fails with a reasonable error when specified attribute is not defined' do
|
118
|
-
expect { Pkg::Platforms.get_attribute('
|
108
|
+
expect { Pkg::Platforms.get_attribute('eos-4-i386', :signature_format) }.to raise_error(/doesn't have information/)
|
119
109
|
end
|
120
110
|
end
|
121
111
|
|
@@ -129,15 +119,14 @@ describe 'Pkg::Platforms' do
|
|
129
119
|
test_cases = {
|
130
120
|
'debian-9-amd64' => ['debian', '9', 'amd64'],
|
131
121
|
'windows-2012-x86' => ['windows', '2012', 'x86'],
|
132
|
-
'windowsfips-2012-x64' => ['windowsfips', '2012', 'x64'],
|
133
122
|
'el-7-x86_64' => ['el', '7', 'x86_64'],
|
123
|
+
'cisco-wrlinux-7-x86_64' => ['cisco-wrlinux', '7', 'x86_64'],
|
124
|
+
'cisco-wrlinux-7' => ['cisco-wrlinux', '7', ''],
|
134
125
|
'el-6' => ['el', '6', ''],
|
135
126
|
'xenial-amd64' => ['ubuntu', '16.04', 'amd64'],
|
136
127
|
'xenial' => ['ubuntu', '16.04', ''],
|
137
128
|
'windows-2012' => ['windows', '2012', ''],
|
138
|
-
'
|
139
|
-
'el-7-SRPMS' => ['el', '7', 'SRPMS'],
|
140
|
-
'ubuntu-16.04-source' => ['ubuntu', '16.04', 'source'],
|
129
|
+
'redhat-fips-7-x86_64' => ['redhat-fips', '7', 'x86_64'],
|
141
130
|
}
|
142
131
|
|
143
132
|
fail_cases = [
|
@@ -147,8 +136,6 @@ describe 'Pkg::Platforms' do
|
|
147
136
|
'windows-x86',
|
148
137
|
'el-7-notarch',
|
149
138
|
'debian-7-x86_64',
|
150
|
-
'el-7-source',
|
151
|
-
'debian-7-SRPMS',
|
152
139
|
]
|
153
140
|
|
154
141
|
test_cases.each do |platform_tag, results|
|
@@ -163,16 +150,4 @@ describe 'Pkg::Platforms' do
|
|
163
150
|
end
|
164
151
|
end
|
165
152
|
end
|
166
|
-
|
167
|
-
describe '#generic_platform_tag' do
|
168
|
-
it 'fails for unsupported platforms' do
|
169
|
-
expect { Pkg::Platforms.generic_platform_tag('butts') }.to raise_error
|
170
|
-
end
|
171
|
-
|
172
|
-
it 'returns a supported platform tag containing the supplied platform' do
|
173
|
-
Pkg::Platforms.supported_platforms.each do |platform|
|
174
|
-
expect(Pkg::Platforms.platform_tags).to include(Pkg::Platforms.generic_platform_tag(platform))
|
175
|
-
end
|
176
|
-
end
|
177
|
-
end
|
178
153
|
end
|
@@ -16,45 +16,46 @@ describe "#Pkg::Repo" do
|
|
16
16
|
allow(Pkg::Util::File).to receive(:empty_dir?).and_return(false)
|
17
17
|
allow(Pkg::Util::Execution).to receive(:capture3)
|
18
18
|
|
19
|
-
expect(Dir).to receive(:chdir).with(
|
19
|
+
expect(Dir).to receive(:chdir).with("pkg").and_yield
|
20
|
+
expect(Dir).to receive(:chdir).with("project/1.1.1").and_yield
|
20
21
|
Pkg::Repo.create_signed_repo_archive("/path", "project-debian-6-i386", "version")
|
21
22
|
end
|
22
23
|
|
23
|
-
it
|
24
|
-
allow(Pkg::Util::Tool).to receive(:check_tool).and_return(
|
25
|
-
allow(Dir).to receive(:chdir).with(
|
24
|
+
it "should use a ref if ref is specified as versioning" do
|
25
|
+
allow(Pkg::Util::Tool).to receive(:check_tool).and_return("tarcommand")
|
26
|
+
allow(Dir).to receive(:chdir).with("pkg").and_yield
|
26
27
|
allow(Pkg::Util::File).to receive(:empty_dir?).and_return(false)
|
27
28
|
allow(Pkg::Util::Execution).to receive(:capture3)
|
28
29
|
|
29
|
-
expect(Pkg::Config).to receive(:project).and_return(
|
30
|
-
expect(Pkg::Config).to receive(:ref).and_return(
|
31
|
-
expect(Dir).to receive(:chdir).with(
|
32
|
-
Pkg::Repo.create_signed_repo_archive(
|
30
|
+
expect(Pkg::Config).to receive(:project).and_return("project")
|
31
|
+
expect(Pkg::Config).to receive(:ref).and_return("AAAAAAAAAAAAAAA")
|
32
|
+
expect(Dir).to receive(:chdir).with("project/AAAAAAAAAAAAAAA").and_yield
|
33
|
+
Pkg::Repo.create_signed_repo_archive("/path", "project-debian-6-i386", "ref")
|
33
34
|
end
|
34
35
|
|
35
|
-
it
|
36
|
-
allow(Pkg::Util::Tool).to receive(:check_tool).and_return(
|
37
|
-
allow(Dir).to receive(:chdir).with(
|
36
|
+
it "should use dot versions if version is specified as versioning" do
|
37
|
+
allow(Pkg::Util::Tool).to receive(:check_tool).and_return("tarcommand")
|
38
|
+
allow(Dir).to receive(:chdir).with("pkg").and_yield
|
38
39
|
allow(Pkg::Util::File).to receive(:empty_dir?).and_return(false)
|
39
40
|
allow(Pkg::Util::Execution).to receive(:capture3)
|
40
41
|
|
41
|
-
expect(Pkg::Config).to receive(:project).and_return(
|
42
|
-
expect(Pkg::Util::Version).to receive(:dot_version).and_return(
|
43
|
-
expect(Dir).to receive(:chdir).with(
|
44
|
-
Pkg::Repo.create_signed_repo_archive(
|
42
|
+
expect(Pkg::Config).to receive(:project).and_return("project")
|
43
|
+
expect(Pkg::Util::Version).to receive(:dot_version).and_return("1.1.1")
|
44
|
+
expect(Dir).to receive(:chdir).with("project/1.1.1").and_yield
|
45
|
+
Pkg::Repo.create_signed_repo_archive("/path", "project-debian-6-i386", "version")
|
45
46
|
end
|
46
47
|
|
47
|
-
it
|
48
|
-
allow(Pkg::Util::Tool).to receive(:check_tool).and_return(
|
49
|
-
allow(Pkg::Config).to receive(:project).and_return(
|
50
|
-
allow(Pkg::Util::Version).to receive(:dot_version).and_return(
|
48
|
+
it "should fail if ENV['FAIL_ON_MISSING_TARGET'] is true and empty_dir? is also true" do
|
49
|
+
allow(Pkg::Util::Tool).to receive(:check_tool).and_return("tarcommand")
|
50
|
+
allow(Pkg::Config).to receive(:project).and_return("project")
|
51
|
+
allow(Pkg::Util::Version).to receive(:dot_version).and_return("1.1.1")
|
51
52
|
allow(Pkg::Util::Execution).to receive(:capture3)
|
52
|
-
allow(Dir).to receive(:chdir).with(
|
53
|
-
allow(Dir).to receive(:chdir).with(
|
53
|
+
allow(Dir).to receive(:chdir).with("pkg").and_yield
|
54
|
+
allow(Dir).to receive(:chdir).with("project/1.1.1").and_yield
|
54
55
|
allow(Pkg::Util::File).to receive(:empty_dir?).and_return(true)
|
55
|
-
ENV['FAIL_ON_MISSING_TARGET'] =
|
56
|
+
ENV['FAIL_ON_MISSING_TARGET'] = "true"
|
56
57
|
|
57
|
-
expect{Pkg::Repo.create_signed_repo_archive(
|
58
|
+
expect{Pkg::Repo.create_signed_repo_archive("/path", "project-debian-6-i386", "version")}.to raise_error(RuntimeError, "ERROR: missing packages under /path")
|
58
59
|
end
|
59
60
|
|
60
61
|
it "should only warn if ENV['FAIL_ON_MISSING_TARGET'] is false and empty_dir? is true" do
|
@@ -62,74 +63,35 @@ describe "#Pkg::Repo" do
|
|
62
63
|
allow(Pkg::Config).to receive(:project).and_return("project")
|
63
64
|
allow(Pkg::Util::Version).to receive(:dot_version).and_return("1.1.1")
|
64
65
|
allow(Pkg::Util::Execution).to receive(:capture3)
|
65
|
-
allow(Dir).to receive(:chdir).with("pkg
|
66
|
+
allow(Dir).to receive(:chdir).with("pkg").and_yield
|
67
|
+
allow(Dir).to receive(:chdir).with("project/1.1.1").and_yield
|
66
68
|
allow(Pkg::Util::File).to receive(:empty_dir?).and_return(true)
|
67
69
|
ENV['FAIL_ON_MISSING_TARGET'] = "false"
|
68
70
|
|
69
71
|
expect{Pkg::Repo.create_signed_repo_archive("/path", "project-debian-6-i386", "version")}.not_to raise_error
|
70
72
|
end
|
71
73
|
|
72
|
-
it
|
73
|
-
allow(Pkg::Util::Tool).to receive(:check_tool).and_return(
|
74
|
-
allow(Pkg::Config).to receive(:project).and_return(
|
75
|
-
allow(Pkg::Util::Version).to receive(:dot_version).and_return(
|
76
|
-
allow(Dir).to receive(:chdir).with(
|
74
|
+
it "should invoke tar correctly" do
|
75
|
+
allow(Pkg::Util::Tool).to receive(:check_tool).and_return("tarcommand")
|
76
|
+
allow(Pkg::Config).to receive(:project).and_return("project")
|
77
|
+
allow(Pkg::Util::Version).to receive(:dot_version).and_return("1.1.1")
|
78
|
+
allow(Dir).to receive(:chdir).with("pkg").and_yield
|
79
|
+
allow(Dir).to receive(:chdir).with("project/1.1.1").and_yield
|
77
80
|
allow(Pkg::Util::File).to receive(:empty_dir?).and_return(false)
|
78
81
|
|
79
|
-
expect(Pkg::Util::Execution).to receive(:capture3).with(
|
80
|
-
Pkg::Repo.create_signed_repo_archive(
|
82
|
+
expect(Pkg::Util::Execution).to receive(:capture3).with("tarcommand --owner=0 --group=0 --create --gzip --file repos/project-debian-6-i386.tar.gz /path")
|
83
|
+
Pkg::Repo.create_signed_repo_archive("/path", "project-debian-6-i386", "version")
|
81
84
|
end
|
82
85
|
end
|
83
86
|
|
84
|
-
describe
|
85
|
-
it
|
87
|
+
describe "#create_signed_repo_archive" do
|
88
|
+
it "should invoke create_signed_repo_archive correctly for multiple entries in platform_repos" do
|
86
89
|
allow(Pkg::Config).to receive(:platform_repos).and_return(platform_repo_stub)
|
87
|
-
allow(Pkg::Config).to receive(:project).and_return('project')
|
88
|
-
allow(Pkg::Util::Version).to receive(:dot_version).and_return('1.1.1')
|
89
|
-
allow(Dir).to receive(:chdir).with('pkg/project/1.1.1').and_yield
|
90
|
-
|
91
|
-
expect(Pkg::Repo).to receive(:create_signed_repo_archive).with('repos/el/4/**/i386', 'project-el-4-i386', 'version')
|
92
|
-
expect(Pkg::Repo).to receive(:create_signed_repo_archive).with('repos/el/5/**/i386', 'project-el-5-i386', 'version')
|
93
|
-
expect(Pkg::Repo).to receive(:create_signed_repo_archive).with('repos/el/6/**/i386', 'project-el-6-i386', 'version')
|
94
|
-
|
95
|
-
allow(Pkg::Util::Execution).to receive(:capture3)
|
96
|
-
Pkg::Repo.create_all_repo_archives('project', 'version')
|
97
|
-
end
|
98
|
-
end
|
99
|
-
|
100
|
-
describe "#argument_required?" do
|
101
|
-
let(:repo_command) { "some command with __REPO_PATH__ but not repo name or anything" }
|
102
|
-
let(:required_arg) { 'repo_path' }
|
103
|
-
let(:optional_arg) { 'repo_name' }
|
104
|
-
|
105
|
-
it 'should return true if command requires arg' do
|
106
|
-
expect(Pkg::Repo.argument_required?(required_arg, repo_command)).to be_true
|
107
|
-
end
|
108
|
-
|
109
|
-
it 'should return false if command does not need arg' do
|
110
|
-
expect(Pkg::Repo.argument_required?(optional_arg, repo_command)).to be_false
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe "#update_repo" do
|
115
|
-
let(:remote_host) { 'weth.delivery.puppetlabs.net' }
|
116
|
-
let(:repo_command) { "some command with __REPO_NAME__ and __REPO_PATH__ and stuff" }
|
117
|
-
let(:repo_name) { 'puppet5' }
|
118
|
-
let(:repo_path) { '/opt/repository/apt' }
|
119
|
-
let(:apt_releases) { ['stretch', 'trusty', 'xenial'] }
|
120
|
-
|
121
|
-
before(:each) do
|
122
|
-
allow(Pkg::Util::Gpg).to receive(:key)
|
123
|
-
allow(Pkg::Config).to receive(:apt_releases).and_return(apt_releases)
|
124
|
-
end
|
125
|
-
|
126
|
-
it 'should fail if required params are nil' do
|
127
|
-
expect{ Pkg::Repo.update_repo(remote_host, repo_command, { :repo_path => repo_path }) }.to raise_error(RuntimeError, /Missing required argument 'repo_name'/)
|
128
|
-
end
|
129
90
|
|
130
|
-
|
131
|
-
expect(Pkg::
|
132
|
-
Pkg::Repo.
|
91
|
+
expect(Pkg::Repo).to receive(:create_signed_repo_archive).with("repos/el/4/**/i386", "project-el-4-i386", "version")
|
92
|
+
expect(Pkg::Repo).to receive(:create_signed_repo_archive).with("repos/el/5/**/i386", "project-el-5-i386", "version")
|
93
|
+
expect(Pkg::Repo).to receive(:create_signed_repo_archive).with("repos/el/6/**/i386", "project-el-6-i386", "version")
|
94
|
+
Pkg::Repo.create_all_repo_archives("project", "version")
|
133
95
|
end
|
134
96
|
end
|
135
97
|
end
|
@@ -7,19 +7,18 @@ describe 'Pkg::Retrieve' do
|
|
7
7
|
remote_target = 'repos'
|
8
8
|
project = 'puppet-agent'
|
9
9
|
ref = 'b25e64984dd505391f248fe5501ad81e2645b6d2'
|
10
|
-
foss_platforms = ['el-7-x86_64', 'ubuntu-16.04-amd64', 'osx-10.
|
10
|
+
foss_platforms = ['el-7-x86_64', 'ubuntu-16.04-amd64', 'osx-10.11-x86_64', 'windows-2012-x64']
|
11
11
|
platform_data = {:platform_data => {
|
12
|
-
'aix-
|
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
|
-
'osx-10.
|
15
|
-
'
|
16
|
-
'sles-11-i386' => {:artifact => './sles/11/PC1/i386/puppet-agent-5.3.2.155.gb25e649-1.sles11.i386.rpm'},
|
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'},
|
17
16
|
'solaris-10-sparc' => {:artifact => './solaris/10/PC1/puppet-agent-5.3.2.155.gb25e649-1.sparc.pkg.gz'},
|
18
17
|
'ubuntu-16.04-amd64' => {:artifact => './deb/xenial/PC1/puppet-agent_5.3.2.155.gb25e649-1xenial_amd64.deb'},
|
19
18
|
'windows-2012-x64' => {:artifact => './windows/puppet-agent-x64.msi'},
|
20
19
|
}}
|
21
|
-
build_url = "builds.delivery.puppetlabs.net/#{project}/#{ref}
|
22
|
-
build_path = "/opt/jenkins-builds/#{project}/#{ref}
|
20
|
+
build_url = "builds.delivery.puppetlabs.net/#{project}/#{ref}"
|
21
|
+
build_path = "/opt/jenkins-builds/#{project}/#{ref}"
|
23
22
|
|
24
23
|
before :each do
|
25
24
|
allow(Pkg::Config).to receive(:project).and_return(project)
|
@@ -29,44 +28,6 @@ describe 'Pkg::Retrieve' do
|
|
29
28
|
allow(Pkg::Util::Serialization).to receive(:load_yaml).and_return(platform_data)
|
30
29
|
end
|
31
30
|
|
32
|
-
describe '#default_wget_command' do
|
33
|
-
let(:options) { [
|
34
|
-
"--quiet",
|
35
|
-
"--recursive",
|
36
|
-
"--no-parent",
|
37
|
-
"--no-host-directories",
|
38
|
-
"--level=0",
|
39
|
-
"--cut-dirs=3",
|
40
|
-
"--directory-prefix=#{local_target}",
|
41
|
-
"--reject='index*",
|
42
|
-
] }
|
43
|
-
before :each do
|
44
|
-
allow(Pkg::Util::Tool).to receive(:check_tool).with('wget').and_return('wget')
|
45
|
-
end
|
46
|
-
context 'when no options passed' do
|
47
|
-
it 'should include default options' do
|
48
|
-
options.each do |option|
|
49
|
-
expect(Pkg::Retrieve.default_wget_command(local_target, build_url)).to include(option)
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
53
|
-
context 'when options are passed' do
|
54
|
-
it 'should add to existing options' do
|
55
|
-
options.push('--convert-links')
|
56
|
-
options.each do |option|
|
57
|
-
expect(Pkg::Retrieve.default_wget_command(local_target, build_url, {'convert-links' => true})).to include(option)
|
58
|
-
end
|
59
|
-
end
|
60
|
-
it 'should replace default values' do
|
61
|
-
options.push('--level=1').delete('--level=0')
|
62
|
-
expect(Pkg::Retrieve.default_wget_command(local_target, build_url, {'level' => 1})).to_not include('--level=0')
|
63
|
-
options.each do |option|
|
64
|
-
expect(Pkg::Retrieve.default_wget_command(local_target, build_url, {'level' => 1})).to include(option)
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
31
|
describe '#foss_only_retrieve' do
|
71
32
|
it 'should fail without foss_platforms' do
|
72
33
|
allow(Pkg::Config).to receive(:foss_platforms).and_return(nil)
|
@@ -87,13 +48,13 @@ describe 'Pkg::Retrieve' do
|
|
87
48
|
describe '#retrieve_all' do
|
88
49
|
it 'should try to use wget first' do
|
89
50
|
expect(Pkg::Retrieve).to receive(:default_wget)
|
90
|
-
Pkg::Retrieve.retrieve_all(build_url, build_path, local_target)
|
51
|
+
Pkg::Retrieve.retrieve_all(build_url, build_path, remote_target, local_target)
|
91
52
|
end
|
92
53
|
|
93
54
|
it 'should use rsync if wget is not found' do
|
94
55
|
allow(Pkg::Util::Tool).to receive(:find_tool).with('wget').and_return(nil)
|
95
56
|
expect(Pkg::Util::Net).to receive(:rsync_from)
|
96
|
-
Pkg::Retrieve.retrieve_all(build_url, build_path, local_target)
|
57
|
+
Pkg::Retrieve.retrieve_all(build_url, build_path, remote_target, local_target)
|
97
58
|
end
|
98
59
|
end
|
99
60
|
end
|
@@ -102,10 +102,10 @@ describe "Pkg::Rpm::Repo" do
|
|
102
102
|
Pkg::Repo.should_receive(:directories_that_contain_packages).and_return(pkg_directories)
|
103
103
|
Pkg::Repo.should_receive(:populate_repo_directory)
|
104
104
|
Pkg::Rpm::Repo.should_receive(:repo_creation_command).and_return(command)
|
105
|
-
Pkg::Util::Net.should_receive(:
|
105
|
+
Pkg::Util::Net.should_receive(:remote_ssh_cmd).with(Pkg::Config.distribution_server, command)
|
106
106
|
Pkg::Rpm::Repo.should_receive(:generate_repo_configs)
|
107
107
|
Pkg::Rpm::Repo.should_receive(:ship_repo_configs)
|
108
|
-
Pkg::Util::Net.should_receive(:
|
108
|
+
Pkg::Util::Net.should_receive(:remote_ssh_cmd).with(Pkg::Config.distribution_server, "rm -f #{artifact_directory}/repos/.lock" )
|
109
109
|
Pkg::Rpm::Repo.create_remote_repos
|
110
110
|
end
|
111
111
|
end
|
@@ -124,8 +124,8 @@ describe "Pkg::Rpm::Repo" do
|
|
124
124
|
Pkg::Config.distribution_server = "a.host.that.wont.exist"
|
125
125
|
repo_dir = "#{Pkg::Config.jenkins_repo_path}/#{Pkg::Config.project}/#{Pkg::Config.ref}/repo_configs/rpm"
|
126
126
|
Pkg::Util::File.should_receive(:empty_dir?).with("pkg/repo_configs/rpm").and_return(false)
|
127
|
-
Pkg::
|
128
|
-
Pkg::Util::Net.should_receive(:
|
127
|
+
Pkg::Rpm::Repo.should_receive(:invoke_task).with("pl:fetch")
|
128
|
+
Pkg::Util::Net.should_receive(:remote_ssh_cmd).with(Pkg::Config.distribution_server, "mkdir -p #{repo_dir}")
|
129
129
|
Pkg::Util::Execution.should_receive(:retry_on_fail).with(:times => 3)
|
130
130
|
Pkg::Rpm::Repo.ship_repo_configs
|
131
131
|
end
|
@@ -20,44 +20,34 @@ describe "tar.rb" do
|
|
20
20
|
"#{PROJECT_ROOT}/ext/debian/changelog.erb"
|
21
21
|
]
|
22
22
|
end
|
23
|
-
before(:each) do
|
24
|
-
Pkg::Config.config_from_hash(
|
25
|
-
{
|
26
|
-
:templates => templates,
|
27
|
-
:project => project,
|
28
|
-
:version => version,
|
29
|
-
:files => files,
|
30
|
-
:project_root => PROJECT_ROOT,
|
31
|
-
:packaging_root => "ext/packaging"
|
32
|
-
})
|
33
|
-
end
|
34
|
-
|
35
|
-
describe '#initialize' do
|
36
|
-
it 'should always mark ext/packaging and pkg directories as excluded files' do
|
37
|
-
Pkg::Config.tar_excludes = ['foo']
|
38
|
-
expect(Pkg::Tar.new.excludes).to eql(['foo', 'pkg', 'ext/packaging'])
|
39
|
-
|
40
|
-
Pkg::Config.tar_excludes = []
|
41
|
-
expect(Pkg::Tar.new.excludes).to eql(['pkg', 'ext/packaging'])
|
42
|
-
end
|
43
|
-
|
44
|
-
it 'should archive the entire project directory by default' do
|
45
|
-
Pkg::Config.files = nil
|
46
|
-
expect(Pkg::Tar.new.files).to eql(Dir.glob('*'))
|
47
|
-
end
|
48
|
-
|
49
|
-
it 'should archive the user-specified list of files' do
|
50
|
-
expect(Pkg::Tar.new.files).to eql(files)
|
51
|
-
end
|
52
|
-
end
|
53
23
|
|
54
24
|
describe "#expand_templates" do
|
55
25
|
it "should be invoked when Pkg::Config.templates is set" do
|
26
|
+
Pkg::Config.config_from_hash(
|
27
|
+
{
|
28
|
+
:templates => templates,
|
29
|
+
:project => project,
|
30
|
+
:version => version,
|
31
|
+
:files => files,
|
32
|
+
:project_root => PROJECT_ROOT,
|
33
|
+
:packaging_root => "ext/packaging"
|
34
|
+
})
|
35
|
+
|
56
36
|
Pkg::Tar.any_instance.should_receive(:expand_templates)
|
57
37
|
Pkg::Tar.new
|
58
38
|
end
|
59
39
|
|
60
40
|
it "packaging templates should be filtered and paths should be expanded" do
|
41
|
+
Pkg::Config.config_from_hash(
|
42
|
+
{
|
43
|
+
:templates => templates,
|
44
|
+
:project => project,
|
45
|
+
:version => version,
|
46
|
+
:files => files,
|
47
|
+
:project_root => PROJECT_ROOT,
|
48
|
+
:packaging_root => "ext/packaging"
|
49
|
+
})
|
50
|
+
|
61
51
|
templates.each do |temp|
|
62
52
|
if temp.is_a?(String)
|
63
53
|
Dir.stub(:glob).with(File.join(PROJECT_ROOT, temp)).and_return(File.join(PROJECT_ROOT, temp))
|
@@ -72,11 +62,17 @@ describe "tar.rb" do
|
|
72
62
|
end
|
73
63
|
|
74
64
|
describe "#template" do
|
75
|
-
before(:each) do
|
76
|
-
Pkg::Config.templates = expanded_templates
|
77
|
-
end
|
78
|
-
|
79
65
|
it "should handle hashes and strings correctly" do
|
66
|
+
Pkg::Config.config_from_hash(
|
67
|
+
{
|
68
|
+
:templates => expanded_templates,
|
69
|
+
:project => project,
|
70
|
+
:version => version,
|
71
|
+
:files => files,
|
72
|
+
:project_root => PROJECT_ROOT,
|
73
|
+
:packaging_root => "ext/packaging"
|
74
|
+
})
|
75
|
+
|
80
76
|
# Set up correct stubs and expectations
|
81
77
|
expanded_templates.each do |temp|
|
82
78
|
if temp.is_a?(String)
|
@@ -96,6 +92,16 @@ describe "tar.rb" do
|
|
96
92
|
end
|
97
93
|
|
98
94
|
it "should raise an error if the template source can't be found" do
|
95
|
+
Pkg::Config.config_from_hash(
|
96
|
+
{
|
97
|
+
:templates => expanded_templates,
|
98
|
+
:project => project,
|
99
|
+
:version => version,
|
100
|
+
:files => files,
|
101
|
+
:project_root => PROJECT_ROOT,
|
102
|
+
:packaging_root => "ext/packaging"
|
103
|
+
})
|
104
|
+
|
99
105
|
# Set up correct stubs and expectations
|
100
106
|
expanded_templates.each do |temp|
|
101
107
|
if temp.is_a?(String)
|
@@ -17,7 +17,7 @@ describe "Pkg::Util::Git_tag" do
|
|
17
17
|
|
18
18
|
context "branch?" do
|
19
19
|
it "sets ref type as a branch when passed a branch" do
|
20
|
-
git_tag = Pkg::Util::Git_tag.new("git://github.com/puppetlabs/leatherman.git", "
|
20
|
+
git_tag = Pkg::Util::Git_tag.new("git://github.com/puppetlabs/leatherman.git", "master")
|
21
21
|
expect(git_tag.branch?).to eq(true)
|
22
22
|
end
|
23
23
|
end
|
@@ -24,7 +24,7 @@ describe "Pkg::Util::Gpg" do
|
|
24
24
|
|
25
25
|
describe '#kill_keychain' do
|
26
26
|
it "doesn't reload the keychain if already loaded" do
|
27
|
-
Pkg::Util::Gpg.instance_variable_set("@keychain_loaded",
|
27
|
+
Pkg::Util::Gpg.instance_variable_set("@keychain_loaded", TRUE)
|
28
28
|
Pkg::Util::Gpg.should_receive(:kill_keychain).never
|
29
29
|
Pkg::Util::Gpg.should_receive(:start_keychain).never
|
30
30
|
Pkg::Util::Gpg.load_keychain
|