omnibus 5.4.0 → 5.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -3
- data/CHANGELOG.md +21 -0
- data/Gemfile +8 -5
- data/README.md +3 -1
- data/Rakefile +20 -13
- data/appveyor.yml +4 -3
- data/bin/omnibus +3 -3
- data/features/commands/manifest.feature +19 -5
- data/features/step_definitions/generator_steps.rb +5 -6
- data/features/support/env.rb +4 -4
- data/lib/omnibus/build_version.rb +14 -14
- data/lib/omnibus/build_version_dsl.rb +3 -3
- data/lib/omnibus/builder.rb +50 -61
- data/lib/omnibus/changelog.rb +2 -2
- data/lib/omnibus/changelog_printer.rb +4 -4
- data/lib/omnibus/cleaner.rb +4 -4
- data/lib/omnibus/cli/base.rb +15 -15
- data/lib/omnibus/cli/cache.rb +13 -13
- data/lib/omnibus/cli/changelog.rb +8 -9
- data/lib/omnibus/cli/publish.rb +12 -13
- data/lib/omnibus/cli.rb +26 -27
- data/lib/omnibus/compressor.rb +6 -6
- data/lib/omnibus/compressors/base.rb +7 -2
- data/lib/omnibus/compressors/dmg.rb +12 -12
- data/lib/omnibus/compressors/null.rb +1 -1
- data/lib/omnibus/compressors/tgz.rb +8 -8
- data/lib/omnibus/config.rb +37 -26
- data/lib/omnibus/core_extensions/open_uri.rb +3 -3
- data/lib/omnibus/core_extensions.rb +1 -1
- data/lib/omnibus/digestable.rb +5 -4
- data/lib/omnibus/download_helpers.rb +7 -6
- data/lib/omnibus/exceptions.rb +29 -13
- data/lib/omnibus/fetcher.rb +0 -1
- data/lib/omnibus/fetchers/git_fetcher.rb +7 -7
- data/lib/omnibus/fetchers/net_fetcher.rb +19 -19
- data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
- data/lib/omnibus/file_syncer.rb +3 -3
- data/lib/omnibus/generator.rb +60 -47
- data/lib/omnibus/git_cache.rb +33 -22
- data/lib/omnibus/git_repository.rb +5 -5
- data/lib/omnibus/health_check.rb +122 -119
- data/lib/omnibus/instrumentation.rb +1 -1
- data/lib/omnibus/licensing.rb +348 -60
- data/lib/omnibus/logger.rb +12 -9
- data/lib/omnibus/logging.rb +1 -1
- data/lib/omnibus/manifest.rb +4 -4
- data/lib/omnibus/manifest_diff.rb +6 -7
- data/lib/omnibus/manifest_entry.rb +1 -1
- data/lib/omnibus/metadata.rb +36 -36
- data/lib/omnibus/ohai.rb +6 -7
- data/lib/omnibus/package.rb +1 -1
- data/lib/omnibus/packager.rb +37 -28
- data/lib/omnibus/packagers/appx.rb +86 -0
- data/lib/omnibus/packagers/base.rb +21 -18
- data/lib/omnibus/packagers/bff.rb +22 -24
- data/lib/omnibus/packagers/deb.rb +20 -20
- data/lib/omnibus/packagers/ips.rb +18 -17
- data/lib/omnibus/packagers/makeself.rb +7 -7
- data/lib/omnibus/packagers/msi.rb +38 -193
- data/lib/omnibus/packagers/pkg.rb +16 -16
- data/lib/omnibus/packagers/rpm.rb +53 -54
- data/lib/omnibus/packagers/solaris.rb +14 -14
- data/lib/omnibus/packagers/windows_base.rb +192 -0
- data/lib/omnibus/project.rb +45 -43
- data/lib/omnibus/publisher.rb +3 -3
- data/lib/omnibus/publishers/artifactory_publisher.rb +39 -39
- data/lib/omnibus/publishers/s3_publisher.rb +7 -7
- data/lib/omnibus/reports.rb +10 -10
- data/lib/omnibus/s3_cache.rb +7 -7
- data/lib/omnibus/s3_helpers.rb +8 -7
- data/lib/omnibus/semantic_version.rb +1 -1
- data/lib/omnibus/software.rb +131 -81
- data/lib/omnibus/sugarable.rb +10 -10
- data/lib/omnibus/templating.rb +5 -5
- data/lib/omnibus/thread_pool.rb +1 -1
- data/lib/omnibus/util.rb +5 -5
- data/lib/omnibus/version.rb +1 -1
- data/lib/omnibus.rb +65 -65
- data/omnibus.gemspec +34 -32
- data/resources/appx/AppxManifest.xml.erb +18 -0
- data/resources/appx/assets/clear.png +0 -0
- data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-bundler-audit-0.5.0-COPYING.txt +674 -0
- data/spec/fixtures/licensing/license_scout/snoopy/ruby_bundler-inifile-3.0.0-README.md +215 -0
- data/spec/fixtures/licensing/license_scout/snoopy/snoopy-dependency-licenses.json +24 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-inifile-3.0.0-README.md +215 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mime-types-3.1-Licence.rdoc +25 -0
- data/spec/fixtures/licensing/license_scout/zlib/ruby_bundler-mini_portile2-2.1.0-LICENSE.txt +20 -0
- data/spec/fixtures/licensing/license_scout/zlib/zlib-dependency-licenses.json +32 -0
- data/spec/functional/builder_spec.rb +149 -150
- data/spec/functional/fetchers/git_fetcher_spec.rb +69 -71
- data/spec/functional/fetchers/net_fetcher_spec.rb +79 -79
- data/spec/functional/fetchers/path_fetcher_spec.rb +19 -20
- data/spec/functional/file_syncer_spec.rb +74 -74
- data/spec/functional/licensing_spec.rb +344 -35
- data/spec/functional/templating_spec.rb +17 -17
- data/spec/spec_helper.rb +20 -20
- data/spec/support/examples.rb +21 -15
- data/spec/support/file_helpers.rb +1 -1
- data/spec/support/git_helpers.rb +37 -37
- data/spec/support/matchers.rb +3 -3
- data/spec/support/ohai_helpers.rb +4 -4
- data/spec/support/path_helpers.rb +2 -2
- data/spec/support/shell_helpers.rb +2 -2
- data/spec/unit/build_version_dsl_spec.rb +5 -5
- data/spec/unit/build_version_spec.rb +63 -63
- data/spec/unit/builder_spec.rb +86 -70
- data/spec/unit/changelog_spec.rb +4 -4
- data/spec/unit/changelogprinter_spec.rb +130 -0
- data/spec/unit/cleanroom_spec.rb +11 -11
- data/spec/unit/compressor_spec.rb +16 -16
- data/spec/unit/compressors/base_spec.rb +6 -6
- data/spec/unit/compressors/dmg_spec.rb +76 -76
- data/spec/unit/compressors/null_spec.rb +4 -4
- data/spec/unit/compressors/tgz_spec.rb +20 -20
- data/spec/unit/config_spec.rb +44 -43
- data/spec/unit/digestable_spec.rb +13 -13
- data/spec/unit/fetcher_spec.rb +11 -12
- data/spec/unit/fetchers/git_fetcher_spec.rb +31 -31
- data/spec/unit/fetchers/net_fetcher_spec.rb +172 -173
- data/spec/unit/fetchers/path_fetcher_spec.rb +18 -18
- data/spec/unit/generator_spec.rb +38 -38
- data/spec/unit/git_cache_spec.rb +56 -54
- data/spec/unit/git_repository_spec.rb +2 -2
- data/spec/unit/health_check_spec.rb +40 -40
- data/spec/unit/library_spec.rb +35 -35
- data/spec/unit/manifest_diff_spec.rb +10 -11
- data/spec/unit/manifest_spec.rb +17 -17
- data/spec/unit/metadata_spec.rb +152 -152
- data/spec/unit/ohai_spec.rb +5 -5
- data/spec/unit/omnibus_spec.rb +31 -31
- data/spec/unit/package_spec.rb +20 -20
- data/spec/unit/packager_spec.rb +48 -42
- data/spec/unit/packagers/appx_spec.rb +165 -0
- data/spec/unit/packagers/base_spec.rb +34 -34
- data/spec/unit/packagers/bff_spec.rb +60 -60
- data/spec/unit/packagers/deb_spec.rb +71 -71
- data/spec/unit/packagers/ips_spec.rb +45 -45
- data/spec/unit/packagers/makeself_spec.rb +22 -22
- data/spec/unit/packagers/msi_spec.rb +141 -147
- data/spec/unit/packagers/pkg_spec.rb +59 -60
- data/spec/unit/packagers/rpm_spec.rb +125 -126
- data/spec/unit/packagers/solaris_spec.rb +52 -52
- data/spec/unit/project_spec.rb +137 -135
- data/spec/unit/publisher_spec.rb +70 -70
- data/spec/unit/publishers/artifactory_publisher_spec.rb +85 -85
- data/spec/unit/publishers/s3_publisher_spec.rb +36 -36
- data/spec/unit/s3_cacher_spec.rb +34 -34
- data/spec/unit/s3_helpers_spec.rb +6 -6
- data/spec/unit/semantic_version_spec.rb +2 -2
- data/spec/unit/software_spec.rb +346 -384
- data/spec/unit/sugarable_spec.rb +10 -10
- data/spec/unit/util_spec.rb +60 -60
- metadata +54 -6
- data/.rubocop.yml +0 -48
@@ -1,16 +1,16 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
describe Packager::RPM do
|
5
5
|
let(:project) do
|
6
6
|
Project.new.tap do |project|
|
7
|
-
project.name(
|
8
|
-
project.homepage(
|
9
|
-
project.install_dir(
|
10
|
-
project.build_version(
|
11
|
-
project.build_iteration(
|
12
|
-
project.maintainer(
|
13
|
-
project.replace(
|
7
|
+
project.name("project")
|
8
|
+
project.homepage("https://example.com")
|
9
|
+
project.install_dir("/opt/project")
|
10
|
+
project.build_version("1.2.3")
|
11
|
+
project.build_iteration("2")
|
12
|
+
project.maintainer("Chef Software")
|
13
|
+
project.replace("old-project")
|
14
14
|
project.license(project_license) if project_license
|
15
15
|
end
|
16
16
|
end
|
@@ -18,10 +18,10 @@ module Omnibus
|
|
18
18
|
subject { described_class.new(project) }
|
19
19
|
|
20
20
|
let(:project_license) { nil }
|
21
|
-
let(:project_root) { File.join(tmp_path,
|
22
|
-
let(:package_dir) { File.join(tmp_path,
|
23
|
-
let(:staging_dir) { File.join(tmp_path,
|
24
|
-
let(:architecture) {
|
21
|
+
let(:project_root) { File.join(tmp_path, "project/root") }
|
22
|
+
let(:package_dir) { File.join(tmp_path, "package/dir") }
|
23
|
+
let(:staging_dir) { File.join(tmp_path, "staging/dir") }
|
24
|
+
let(:architecture) { "x86_64" }
|
25
25
|
|
26
26
|
before do
|
27
27
|
Config.project_root(project_root)
|
@@ -35,143 +35,142 @@ module Omnibus
|
|
35
35
|
create_directory("#{staging_dir}/SOURCES")
|
36
36
|
create_directory("#{staging_dir}/SPECS")
|
37
37
|
|
38
|
-
stub_ohai(platform:
|
39
|
-
data[
|
38
|
+
stub_ohai(platform: "redhat", version: "6.5") do |data|
|
39
|
+
data["kernel"]["machine"] = architecture
|
40
40
|
end
|
41
41
|
end
|
42
42
|
|
43
43
|
describe '#signing_passphrase' do
|
44
|
-
it
|
44
|
+
it "is a DSL method" do
|
45
45
|
expect(subject).to have_exposed_method(:signing_passphrase)
|
46
46
|
end
|
47
47
|
|
48
|
-
it
|
48
|
+
it "has a no default value" do
|
49
49
|
expect(subject.signing_passphrase).to be(nil)
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
53
|
-
|
54
53
|
describe '#vendor' do
|
55
|
-
it
|
54
|
+
it "is a DSL method" do
|
56
55
|
expect(subject).to have_exposed_method(:vendor)
|
57
56
|
end
|
58
57
|
|
59
|
-
it
|
60
|
-
expect(subject.vendor).to eq(
|
58
|
+
it "has a default value" do
|
59
|
+
expect(subject.vendor).to eq("Omnibus <omnibus@getchef.com>")
|
61
60
|
end
|
62
61
|
|
63
|
-
it
|
62
|
+
it "must be a string" do
|
64
63
|
expect { subject.vendor(Object.new) }.to raise_error(InvalidValue)
|
65
64
|
end
|
66
65
|
end
|
67
66
|
|
68
67
|
describe '#license' do
|
69
|
-
it
|
68
|
+
it "is a DSL method" do
|
70
69
|
expect(subject).to have_exposed_method(:license)
|
71
70
|
end
|
72
71
|
|
73
|
-
it
|
74
|
-
expect(subject.license).to eq(
|
72
|
+
it "has a default value" do
|
73
|
+
expect(subject.license).to eq("Unspecified")
|
75
74
|
end
|
76
75
|
|
77
|
-
it
|
76
|
+
it "must be a string" do
|
78
77
|
expect { subject.license(Object.new) }.to raise_error(InvalidValue)
|
79
78
|
end
|
80
79
|
|
81
|
-
context
|
82
|
-
let(:project_license) {
|
80
|
+
context "with project license" do
|
81
|
+
let(:project_license) { "custom-license" }
|
83
82
|
|
84
|
-
it
|
85
|
-
expect(subject.license).to eq(
|
83
|
+
it "uses project license" do
|
84
|
+
expect(subject.license).to eq("custom-license")
|
86
85
|
end
|
87
86
|
end
|
88
87
|
end
|
89
88
|
|
90
89
|
describe '#priority' do
|
91
|
-
it
|
90
|
+
it "is a DSL method" do
|
92
91
|
expect(subject).to have_exposed_method(:priority)
|
93
92
|
end
|
94
93
|
|
95
|
-
it
|
96
|
-
expect(subject.priority).to eq(
|
94
|
+
it "has a default value" do
|
95
|
+
expect(subject.priority).to eq("extra")
|
97
96
|
end
|
98
97
|
|
99
|
-
it
|
98
|
+
it "must be a string" do
|
100
99
|
expect { subject.priority(Object.new) }.to raise_error(InvalidValue)
|
101
100
|
end
|
102
101
|
end
|
103
102
|
|
104
103
|
describe '#category' do
|
105
|
-
it
|
104
|
+
it "is a DSL method" do
|
106
105
|
expect(subject).to have_exposed_method(:category)
|
107
106
|
end
|
108
107
|
|
109
|
-
it
|
110
|
-
expect(subject.category).to eq(
|
108
|
+
it "has a default value" do
|
109
|
+
expect(subject.category).to eq("default")
|
111
110
|
end
|
112
111
|
|
113
|
-
it
|
112
|
+
it "must be a string" do
|
114
113
|
expect { subject.category(Object.new) }.to raise_error(InvalidValue)
|
115
114
|
end
|
116
115
|
end
|
117
116
|
|
118
117
|
describe '#dist_tag' do
|
119
|
-
it
|
118
|
+
it "is a DSL method" do
|
120
119
|
expect(subject).to have_exposed_method(:dist_tag)
|
121
120
|
end
|
122
121
|
|
123
|
-
it
|
124
|
-
expect(subject.dist_tag).to eq(
|
122
|
+
it "has a default value" do
|
123
|
+
expect(subject.dist_tag).to eq(".el6")
|
125
124
|
end
|
126
125
|
end
|
127
126
|
|
128
127
|
describe '#id' do
|
129
|
-
it
|
128
|
+
it "is :rpm" do
|
130
129
|
expect(subject.id).to eq(:rpm)
|
131
130
|
end
|
132
131
|
end
|
133
132
|
|
134
133
|
describe '#package_name' do
|
135
|
-
context
|
134
|
+
context "when dist_tag is enabled" do
|
136
135
|
before do
|
137
|
-
allow(subject).to receive(:safe_architecture).and_return(
|
136
|
+
allow(subject).to receive(:safe_architecture).and_return("x86_64")
|
138
137
|
end
|
139
138
|
|
140
|
-
it
|
141
|
-
expect(subject.package_name).to eq(
|
139
|
+
it "includes the name, version, and build iteration" do
|
140
|
+
expect(subject.package_name).to eq("project-1.2.3-2.el6.x86_64.rpm")
|
142
141
|
end
|
143
142
|
end
|
144
143
|
|
145
|
-
context
|
144
|
+
context "when dist_tag is disabled" do
|
146
145
|
before do
|
147
146
|
allow(subject).to receive(:dist_tag).and_return(false)
|
148
147
|
end
|
149
148
|
|
150
|
-
it
|
151
|
-
expect(subject.package_name).to eq(
|
149
|
+
it "excludes dist tag" do
|
150
|
+
expect(subject.package_name).to eq("project-1.2.3-2.x86_64.rpm")
|
152
151
|
end
|
153
152
|
end
|
154
153
|
end
|
155
154
|
|
156
155
|
describe '#build_dir' do
|
157
|
-
it
|
156
|
+
it "is nested inside the staging_dir" do
|
158
157
|
expect(subject.build_dir).to eq("#{staging_dir}/BUILD")
|
159
158
|
end
|
160
159
|
end
|
161
160
|
|
162
161
|
describe '#write_rpm_spec' do
|
163
162
|
before do
|
164
|
-
allow(subject).to receive(:safe_architecture).and_return(
|
163
|
+
allow(subject).to receive(:safe_architecture).and_return("x86_64")
|
165
164
|
end
|
166
165
|
|
167
166
|
let(:spec_file) { "#{staging_dir}/SPECS/project-1.2.3-2.el6.x86_64.rpm.spec" }
|
168
167
|
|
169
|
-
it
|
168
|
+
it "generates the file" do
|
170
169
|
subject.write_rpm_spec
|
171
170
|
expect(spec_file).to be_a_file
|
172
171
|
end
|
173
172
|
|
174
|
-
it
|
173
|
+
it "has the correct content" do
|
175
174
|
subject.write_rpm_spec
|
176
175
|
contents = File.read(spec_file)
|
177
176
|
|
@@ -190,8 +189,8 @@ module Omnibus
|
|
190
189
|
expect(contents).to include("Obsoletes: old-project")
|
191
190
|
end
|
192
191
|
|
193
|
-
context
|
194
|
-
let(:scripts) {
|
192
|
+
context "when scripts are given" do
|
193
|
+
let(:scripts) { %w{ pre post preun postun verifyscript pretans posttrans } }
|
195
194
|
|
196
195
|
before do
|
197
196
|
scripts.each do |script_name|
|
@@ -201,7 +200,7 @@ module Omnibus
|
|
201
200
|
end
|
202
201
|
end
|
203
202
|
|
204
|
-
it
|
203
|
+
it "writes the scripts into the spec" do
|
205
204
|
subject.write_rpm_spec
|
206
205
|
contents = File.read(spec_file)
|
207
206
|
|
@@ -212,8 +211,8 @@ module Omnibus
|
|
212
211
|
end
|
213
212
|
end
|
214
213
|
|
215
|
-
context
|
216
|
-
let(:default_scripts) { %w
|
214
|
+
context "when scripts with default omnibus naming are given" do
|
215
|
+
let(:default_scripts) { %w{ preinst postinst prerm postrm } }
|
217
216
|
|
218
217
|
before do
|
219
218
|
default_scripts.each do |default_name|
|
@@ -223,7 +222,7 @@ module Omnibus
|
|
223
222
|
end
|
224
223
|
end
|
225
224
|
|
226
|
-
it
|
225
|
+
it "writes the scripts into the spec" do
|
227
226
|
subject.write_rpm_spec
|
228
227
|
contents = File.read(spec_file)
|
229
228
|
|
@@ -235,7 +234,7 @@ module Omnibus
|
|
235
234
|
end
|
236
235
|
end
|
237
236
|
|
238
|
-
context
|
237
|
+
context "when files and directories are present" do
|
239
238
|
before do
|
240
239
|
create_file("#{staging_dir}/BUILD/.file1")
|
241
240
|
create_file("#{staging_dir}/BUILD/file2")
|
@@ -244,7 +243,7 @@ module Omnibus
|
|
244
243
|
create_directory("#{staging_dir}/BUILD/dir3 space")
|
245
244
|
end
|
246
245
|
|
247
|
-
it
|
246
|
+
it "writes them into the spec" do
|
248
247
|
subject.write_rpm_spec
|
249
248
|
contents = File.read(spec_file)
|
250
249
|
|
@@ -256,14 +255,14 @@ module Omnibus
|
|
256
255
|
end
|
257
256
|
end
|
258
257
|
|
259
|
-
context
|
258
|
+
context "when leaf directories owned by the filesystem package are present" do
|
260
259
|
before do
|
261
260
|
create_directory("#{staging_dir}/BUILD/usr/lib")
|
262
261
|
create_directory("#{staging_dir}/BUILD/opt")
|
263
262
|
create_file("#{staging_dir}/BUILD/opt/thing")
|
264
263
|
end
|
265
264
|
|
266
|
-
it
|
265
|
+
it "is written into the spec with ownership and permissions" do
|
267
266
|
subject.write_rpm_spec
|
268
267
|
contents = File.read(spec_file)
|
269
268
|
|
@@ -272,14 +271,14 @@ module Omnibus
|
|
272
271
|
end
|
273
272
|
end
|
274
273
|
|
275
|
-
context
|
274
|
+
context "when the platform_family is wrlinux" do
|
276
275
|
let(:spec_file) { "#{staging_dir}/SPECS/project-1.2.3-2.nexus5.x86_64.rpm.spec" }
|
277
276
|
|
278
277
|
before do
|
279
|
-
stub_ohai(platform:
|
278
|
+
stub_ohai(platform: "nexus", version: "5")
|
280
279
|
end
|
281
280
|
|
282
|
-
it
|
281
|
+
it "writes out a spec file with no BuildArch" do
|
283
282
|
subject.write_rpm_spec
|
284
283
|
contents = File.read(spec_file)
|
285
284
|
|
@@ -287,14 +286,14 @@ module Omnibus
|
|
287
286
|
end
|
288
287
|
end
|
289
288
|
|
290
|
-
context
|
289
|
+
context "when dist_tag is disabled" do
|
291
290
|
let(:spec_file) { "#{staging_dir}/SPECS/project-1.2.3-2.x86_64.rpm.spec" }
|
292
291
|
|
293
292
|
before do
|
294
293
|
allow(subject).to receive(:dist_tag).and_return(false)
|
295
294
|
end
|
296
295
|
|
297
|
-
it
|
296
|
+
it "has the correct release" do
|
298
297
|
subject.write_rpm_spec
|
299
298
|
contents = File.read(spec_file)
|
300
299
|
expect(contents).to include("Release: 2")
|
@@ -308,24 +307,24 @@ module Omnibus
|
|
308
307
|
allow(Dir).to receive(:chdir) { |_, &b| b.call }
|
309
308
|
end
|
310
309
|
|
311
|
-
it
|
310
|
+
it "logs a message" do
|
312
311
|
output = capture_logging { subject.create_rpm_file }
|
313
|
-
expect(output).to include(
|
312
|
+
expect(output).to include("Creating .rpm file")
|
314
313
|
end
|
315
314
|
|
316
|
-
it
|
315
|
+
it "uses the correct command" do
|
317
316
|
expect(subject).to receive(:shellout!)
|
318
317
|
.with(/rpmbuild --target #{architecture} -bb --buildroot/)
|
319
318
|
subject.create_rpm_file
|
320
319
|
end
|
321
320
|
|
322
|
-
context
|
321
|
+
context "when RPM signing is enabled" do
|
323
322
|
before do
|
324
|
-
subject.signing_passphrase(
|
323
|
+
subject.signing_passphrase("foobar")
|
325
324
|
allow(Dir).to receive(:mktmpdir).and_return(tmp_path)
|
326
325
|
end
|
327
326
|
|
328
|
-
it
|
327
|
+
it "signs the rpm" do
|
329
328
|
expect(subject).to receive(:shellout!)
|
330
329
|
.with(/sign\-rpm/, kind_of(Hash))
|
331
330
|
subject.create_rpm_file
|
@@ -335,50 +334,50 @@ module Omnibus
|
|
335
334
|
|
336
335
|
describe '#spec_file' do
|
337
336
|
before do
|
338
|
-
allow(subject).to receive(:package_name).and_return(
|
337
|
+
allow(subject).to receive(:package_name).and_return("package_name")
|
339
338
|
end
|
340
339
|
|
341
|
-
it
|
340
|
+
it "includes the package_name" do
|
342
341
|
expect(subject.spec_file).to eq("#{staging_dir}/SPECS/package_name.spec")
|
343
342
|
end
|
344
343
|
end
|
345
344
|
|
346
345
|
describe '#rpm_safe' do
|
347
|
-
it
|
348
|
-
expect(subject.rpm_safe(
|
346
|
+
it "adds quotes when required" do
|
347
|
+
expect(subject.rpm_safe("file path")).to eq('"file path"')
|
349
348
|
end
|
350
349
|
|
351
|
-
it
|
352
|
-
expect(subject.rpm_safe(
|
350
|
+
it "escapes [" do
|
351
|
+
expect(subject.rpm_safe("[foo")).to eq('[\\[]foo')
|
353
352
|
end
|
354
353
|
|
355
|
-
it
|
356
|
-
expect(subject.rpm_safe(
|
354
|
+
it "escapes *" do
|
355
|
+
expect(subject.rpm_safe("*foo")).to eq("[*]foo")
|
357
356
|
end
|
358
357
|
|
359
|
-
it
|
360
|
-
expect(subject.rpm_safe(
|
358
|
+
it "escapes ?" do
|
359
|
+
expect(subject.rpm_safe("?foo")).to eq("[?]foo")
|
361
360
|
end
|
362
361
|
|
363
|
-
it
|
364
|
-
expect(subject.rpm_safe(
|
362
|
+
it "escapes %" do
|
363
|
+
expect(subject.rpm_safe("%foo")).to eq("[%]foo")
|
365
364
|
end
|
366
365
|
end
|
367
366
|
|
368
367
|
describe '#safe_base_package_name' do
|
369
368
|
context 'when the project name is "safe"' do
|
370
|
-
it
|
371
|
-
expect(subject.safe_base_package_name).to eq(
|
369
|
+
it "returns the value without logging a message" do
|
370
|
+
expect(subject.safe_base_package_name).to eq("project")
|
372
371
|
expect(subject).to_not receive(:log)
|
373
372
|
end
|
374
373
|
end
|
375
374
|
|
376
|
-
context
|
375
|
+
context "when the project name has invalid characters" do
|
377
376
|
before { project.name("Pro$ject123.for-realz_2") }
|
378
377
|
|
379
|
-
it
|
378
|
+
it "returns the value while logging a message" do
|
380
379
|
output = capture_logging do
|
381
|
-
expect(subject.safe_base_package_name).to eq(
|
380
|
+
expect(subject.safe_base_package_name).to eq("pro-ject123.for-realz-2")
|
382
381
|
end
|
383
382
|
|
384
383
|
expect(output).to include("The `name' component of RPM package names can only include")
|
@@ -387,67 +386,67 @@ module Omnibus
|
|
387
386
|
end
|
388
387
|
|
389
388
|
describe '#safe_build_iteration' do
|
390
|
-
it
|
389
|
+
it "returns the build iternation" do
|
391
390
|
expect(subject.safe_build_iteration).to eq(project.build_iteration)
|
392
391
|
end
|
393
392
|
end
|
394
393
|
|
395
394
|
describe '#safe_version' do
|
396
395
|
context 'when the project build_version is "safe"' do
|
397
|
-
it
|
398
|
-
expect(subject.safe_version).to eq(
|
396
|
+
it "returns the value without logging a message" do
|
397
|
+
expect(subject.safe_version).to eq("1.2.3")
|
399
398
|
expect(subject).to_not receive(:log)
|
400
399
|
end
|
401
400
|
end
|
402
401
|
|
403
|
-
context
|
404
|
-
before { project.build_version(
|
402
|
+
context "when the project build_version has dashes" do
|
403
|
+
before { project.build_version("1.2-rc.1") }
|
405
404
|
|
406
|
-
it
|
405
|
+
it "returns the value while logging a message" do
|
407
406
|
output = capture_logging do
|
408
|
-
expect(subject.safe_version).to eq(
|
407
|
+
expect(subject.safe_version).to eq("1.2~rc.1")
|
409
408
|
end
|
410
409
|
|
411
410
|
expect(output).to include("Tildes hold special significance in the RPM package versions.")
|
412
411
|
end
|
413
412
|
end
|
414
413
|
|
415
|
-
context
|
414
|
+
context "when the project build_version has invalid characters" do
|
416
415
|
before { project.build_version("1.2-pre_alpha.##__2") }
|
417
416
|
|
418
|
-
it
|
417
|
+
it "returns the value while logging a message" do
|
419
418
|
output = capture_logging do
|
420
|
-
expect(subject.safe_version).to eq(
|
419
|
+
expect(subject.safe_version).to eq("1.2~pre_alpha._2")
|
421
420
|
end
|
422
421
|
|
423
422
|
expect(output).to include("The `version' component of RPM package names can only include")
|
424
423
|
end
|
425
424
|
end
|
426
425
|
|
427
|
-
context
|
426
|
+
context "when the build is for nexus" do
|
428
427
|
before do
|
429
|
-
project.build_version(
|
430
|
-
stub_ohai(platform:
|
428
|
+
project.build_version("1.2-3")
|
429
|
+
stub_ohai(platform: "nexus", version: "5")
|
431
430
|
end
|
432
431
|
|
433
|
-
it
|
432
|
+
it "returns the value while logging a message" do
|
434
433
|
output = capture_logging do
|
435
|
-
expect(subject.safe_version).to eq(
|
434
|
+
expect(subject.safe_version).to eq("1.2_3")
|
436
435
|
end
|
437
436
|
|
438
437
|
expect(output).to include("rpmbuild on Wind River Linux does not support this")
|
439
438
|
end
|
440
439
|
end
|
441
440
|
|
442
|
-
context
|
441
|
+
context "when the build is for ios_xr" do
|
443
442
|
before do
|
444
|
-
project.build_version(
|
445
|
-
stub_ohai(platform:
|
443
|
+
project.build_version("1.2-3")
|
444
|
+
stub_ohai(platform: "ios_xr", version: "6.0.0.14I")
|
446
445
|
end
|
447
446
|
|
448
|
-
it
|
447
|
+
it "returns the value while logging a message" do
|
449
448
|
output = capture_logging do
|
450
|
-
expect(subject.safe_version).to eq(
|
449
|
+
expect(subject.safe_version).to eq("1.2_3")
|
451
450
|
end
|
452
451
|
|
453
452
|
expect(output).to include("rpmbuild on Wind River Linux does not support this")
|
@@ -457,39 +456,39 @@ module Omnibus
|
|
457
456
|
|
458
457
|
describe '#safe_architecture' do
|
459
458
|
before do
|
460
|
-
stub_ohai(platform:
|
461
|
-
data[
|
459
|
+
stub_ohai(platform: "redhat", version: "6.5") do |data|
|
460
|
+
data["kernel"]["machine"] = "i386"
|
462
461
|
end
|
463
462
|
end
|
464
463
|
|
465
|
-
it
|
466
|
-
expect(subject.safe_architecture).to eq(
|
464
|
+
it "returns the value from Ohai" do
|
465
|
+
expect(subject.safe_architecture).to eq("i386")
|
467
466
|
end
|
468
467
|
|
469
|
-
context
|
468
|
+
context "when i686" do
|
470
469
|
before do
|
471
|
-
stub_ohai(platform:
|
472
|
-
data[
|
470
|
+
stub_ohai(platform: "redhat", version: "6.5") do |data|
|
471
|
+
data["kernel"]["machine"] = "i686"
|
473
472
|
end
|
474
473
|
end
|
475
474
|
|
476
|
-
it
|
477
|
-
expect(subject.safe_architecture).to eq(
|
475
|
+
it "returns i386" do
|
476
|
+
expect(subject.safe_architecture).to eq("i386")
|
478
477
|
end
|
479
478
|
end
|
480
479
|
|
481
|
-
context
|
480
|
+
context "on Pidora" do
|
482
481
|
before do
|
483
482
|
# There's no Pidora in Fauxhai :(
|
484
|
-
stub_ohai(platform:
|
485
|
-
data[
|
486
|
-
data[
|
487
|
-
data[
|
483
|
+
stub_ohai(platform: "fedora", version: "20") do |data|
|
484
|
+
data["platform"] = "pidora"
|
485
|
+
data["platform_version"] = "20"
|
486
|
+
data["kernel"]["machine"] = "armv6l"
|
488
487
|
end
|
489
488
|
end
|
490
489
|
|
491
|
-
it
|
492
|
-
expect(subject.safe_architecture).to eq(
|
490
|
+
it "returns armv6hl" do
|
491
|
+
expect(subject.safe_architecture).to eq("armv6hl")
|
493
492
|
end
|
494
493
|
end
|
495
494
|
end
|