omnibus 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -0
- data/.travis.yml +3 -11
- data/CHANGELOG.md +50 -0
- data/MAINTAINERS.md +26 -0
- data/README.md +61 -4
- data/appveyor.yml +35 -0
- data/docs/Build Cache.md +28 -3
- data/docs/Building on RHEL.md +1 -1
- data/features/commands/publish.feature +4 -9
- data/features/step_definitions/generator_steps.rb +14 -1
- data/features/support/env.rb +5 -3
- data/lib/omnibus.rb +10 -0
- data/lib/omnibus/build_version.rb +34 -25
- data/lib/omnibus/build_version_dsl.rb +43 -4
- data/lib/omnibus/builder.rb +30 -11
- data/lib/omnibus/changelog.rb +52 -0
- data/lib/omnibus/changelog_printer.rb +77 -0
- data/lib/omnibus/cli.rb +37 -2
- data/lib/omnibus/cli/changelog.rb +149 -0
- data/lib/omnibus/cli/publish.rb +30 -10
- data/lib/omnibus/config.rb +41 -2
- data/lib/omnibus/digestable.rb +6 -1
- data/lib/omnibus/exceptions.rb +15 -1
- data/lib/omnibus/fetcher.rb +78 -34
- data/lib/omnibus/fetchers/git_fetcher.rb +84 -42
- data/lib/omnibus/fetchers/net_fetcher.rb +64 -13
- data/lib/omnibus/fetchers/null_fetcher.rb +8 -1
- data/lib/omnibus/fetchers/path_fetcher.rb +24 -1
- data/lib/omnibus/file_syncer.rb +52 -1
- data/lib/omnibus/generator.rb +22 -21
- data/lib/omnibus/generator_files/.kitchen.yml.erb +8 -12
- data/lib/omnibus/generator_files/Berksfile.erb +4 -4
- data/lib/omnibus/generator_files/Gemfile.erb +3 -3
- data/lib/omnibus/generator_files/README.md.erb +17 -0
- data/lib/omnibus/generator_files/omnibus.rb.erb +6 -0
- data/lib/omnibus/git_repository.rb +43 -0
- data/lib/omnibus/health_check.rb +5 -1
- data/lib/omnibus/manifest.rb +134 -0
- data/lib/omnibus/manifest_diff.rb +88 -0
- data/lib/omnibus/manifest_entry.rb +43 -0
- data/lib/omnibus/metadata.rb +19 -1
- data/lib/omnibus/package.rb +9 -0
- data/lib/omnibus/packagers/base.rb +1 -1
- data/lib/omnibus/packagers/bff.rb +5 -5
- data/lib/omnibus/packagers/deb.rb +11 -4
- data/lib/omnibus/packagers/msi.rb +243 -2
- data/lib/omnibus/packagers/rpm.rb +68 -14
- data/lib/omnibus/packagers/solaris.rb +17 -23
- data/lib/omnibus/project.rb +129 -16
- data/lib/omnibus/publisher.rb +62 -49
- data/lib/omnibus/publishers/artifactory_publisher.rb +96 -5
- data/lib/omnibus/publishers/s3_publisher.rb +20 -25
- data/lib/omnibus/s3_cache.rb +13 -34
- data/lib/omnibus/s3_helpers.rb +119 -0
- data/lib/omnibus/semantic_version.rb +57 -0
- data/lib/omnibus/software.rb +87 -28
- data/lib/omnibus/sugarable.rb +18 -0
- data/lib/omnibus/templating.rb +8 -1
- data/lib/omnibus/version.rb +1 -1
- data/omnibus.gemspec +10 -7
- data/resources/bff/gen.template.erb +1 -1
- data/resources/msi/bundle.wxs.erb +17 -0
- data/resources/msi/localization-en-us.wxl.erb +1 -1
- data/resources/rpm/spec.erb +1 -1
- data/spec/functional/builder_spec.rb +15 -7
- data/spec/functional/fetchers/git_fetcher_spec.rb +44 -12
- data/spec/functional/fetchers/net_fetcher_spec.rb +171 -20
- data/spec/functional/fetchers/path_fetcher_spec.rb +16 -1
- data/spec/functional/file_syncer_spec.rb +58 -5
- data/spec/functional/templating_spec.rb +17 -6
- data/spec/spec_helper.rb +17 -0
- data/spec/support/file_helpers.rb +12 -2
- data/spec/support/git_helpers.rb +23 -18
- data/spec/support/matchers.rb +22 -0
- data/spec/support/output_helpers.rb +29 -0
- data/spec/unit/build_version_dsl_spec.rb +31 -4
- data/spec/unit/build_version_spec.rb +11 -4
- data/spec/unit/builder_spec.rb +33 -0
- data/spec/unit/changelog_spec.rb +55 -0
- data/spec/unit/cleanroom_spec.rb +1 -1
- data/spec/unit/compressors/dmg_spec.rb +3 -3
- data/spec/unit/compressors/tgz_spec.rb +3 -3
- data/spec/unit/config_spec.rb +3 -1
- data/spec/unit/fetcher_spec.rb +35 -0
- data/spec/unit/fetchers/git_fetcher_spec.rb +28 -14
- data/spec/unit/fetchers/net_fetcher_spec.rb +178 -24
- data/spec/unit/fetchers/path_fetcher_spec.rb +8 -7
- data/spec/unit/generator_spec.rb +22 -21
- data/spec/unit/git_repository_spec.rb +60 -0
- data/spec/unit/manifest_diff_spec.rb +75 -0
- data/spec/unit/manifest_spec.rb +116 -0
- data/spec/unit/metadata_spec.rb +11 -0
- data/spec/unit/omnibus_spec.rb +9 -6
- data/spec/unit/package_spec.rb +1 -1
- data/spec/unit/packagers/base_spec.rb +8 -18
- data/spec/unit/packagers/bff_spec.rb +9 -5
- data/spec/unit/packagers/deb_spec.rb +44 -12
- data/spec/unit/packagers/makeself_spec.rb +4 -4
- data/spec/unit/packagers/msi_spec.rb +122 -6
- data/spec/unit/packagers/pkg_spec.rb +3 -3
- data/spec/unit/packagers/rpm_spec.rb +37 -12
- data/spec/unit/project_spec.rb +18 -1
- data/spec/unit/publisher_spec.rb +65 -0
- data/spec/unit/publishers/artifactory_publisher_spec.rb +26 -20
- data/spec/unit/publishers/s3_publisher_spec.rb +14 -30
- data/spec/unit/s3_cacher_spec.rb +1 -1
- data/spec/unit/s3_helpers_spec.rb +32 -0
- data/spec/unit/semantic_version_spec.rb +55 -0
- data/spec/unit/software_spec.rb +112 -4
- metadata +86 -16
@@ -15,11 +15,15 @@ module Omnibus
|
|
15
15
|
|
16
16
|
subject { described_class.new(project) }
|
17
17
|
|
18
|
-
let(:project_root) {
|
19
|
-
let(:package_dir) {
|
20
|
-
let(:staging_dir) {
|
18
|
+
let(:project_root) { File.join(tmp_path, 'project/root') }
|
19
|
+
let(:package_dir) { File.join(tmp_path, 'package/dir') }
|
20
|
+
let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
|
21
21
|
|
22
22
|
before do
|
23
|
+
# This is here to allow this unit test to run on windows.
|
24
|
+
allow(File).to receive(:expand_path).and_wrap_original do |m, *args|
|
25
|
+
m.call(*args).sub(/^[A-Za-z]:/, '')
|
26
|
+
end
|
23
27
|
Config.project_root(project_root)
|
24
28
|
Config.package_dir(package_dir)
|
25
29
|
|
@@ -46,13 +50,13 @@ module Omnibus
|
|
46
50
|
|
47
51
|
describe '#scripts_install_dir' do
|
48
52
|
it 'is nested inside the project install_dir' do
|
49
|
-
expect(subject.scripts_install_dir).to
|
53
|
+
expect(subject.scripts_install_dir).to start_with(project.install_dir)
|
50
54
|
end
|
51
55
|
end
|
52
56
|
|
53
57
|
describe '#scripts_staging_dir' do
|
54
58
|
it 'is nested inside the staging_dir' do
|
55
|
-
expect(subject.scripts_staging_dir).to
|
59
|
+
expect(subject.scripts_staging_dir).to start_with(staging_dir)
|
56
60
|
end
|
57
61
|
end
|
58
62
|
|
@@ -15,9 +15,9 @@ module Omnibus
|
|
15
15
|
|
16
16
|
subject { described_class.new(project) }
|
17
17
|
|
18
|
-
let(:project_root) {
|
19
|
-
let(:package_dir) {
|
20
|
-
let(:staging_dir) {
|
18
|
+
let(:project_root) { File.join(tmp_path, 'project/root') }
|
19
|
+
let(:package_dir) { File.join(tmp_path, 'package/dir') }
|
20
|
+
let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
|
21
21
|
|
22
22
|
before do
|
23
23
|
Config.project_root(project_root)
|
@@ -167,13 +167,18 @@ module Omnibus
|
|
167
167
|
create_file("#{project_root}/package-scripts/project/postrm") { "postrm" }
|
168
168
|
end
|
169
169
|
|
170
|
-
it 'copies the scripts into the DEBIAN dir' do
|
170
|
+
it 'copies the scripts into the DEBIAN dir with permissions = 100755', :not_supported_on_windows do
|
171
171
|
subject.write_scripts
|
172
172
|
|
173
173
|
expect("#{staging_dir}/DEBIAN/preinst").to be_a_file
|
174
174
|
expect("#{staging_dir}/DEBIAN/postinst").to be_a_file
|
175
175
|
expect("#{staging_dir}/DEBIAN/prerm").to be_a_file
|
176
176
|
expect("#{staging_dir}/DEBIAN/postrm").to be_a_file
|
177
|
+
|
178
|
+
expect("#{staging_dir}/DEBIAN/preinst").to have_permissions '100755'
|
179
|
+
expect("#{staging_dir}/DEBIAN/postinst").to have_permissions '100755'
|
180
|
+
expect("#{staging_dir}/DEBIAN/prerm").to have_permissions '100755'
|
181
|
+
expect("#{staging_dir}/DEBIAN/postrm").to have_permissions '100755'
|
177
182
|
end
|
178
183
|
|
179
184
|
it 'logs a message' do
|
@@ -344,18 +349,45 @@ module Omnibus
|
|
344
349
|
end
|
345
350
|
end
|
346
351
|
|
347
|
-
context '
|
352
|
+
context 'when ppc64le' do
|
348
353
|
before do
|
349
|
-
|
350
|
-
|
351
|
-
|
352
|
-
|
353
|
-
|
354
|
+
stub_ohai(platform: 'ubuntu', version: '14.04') do |data|
|
355
|
+
data['kernel']['machine'] = 'ppc64le'
|
356
|
+
end
|
357
|
+
end
|
358
|
+
|
359
|
+
it 'returns ppc64el' do
|
360
|
+
expect(subject.safe_architecture).to eq('ppc64el')
|
361
|
+
end
|
362
|
+
end
|
363
|
+
|
364
|
+
context 'Raspberry Pi' do
|
365
|
+
context 'Raspbian on Pi v1' do
|
366
|
+
before do
|
367
|
+
# There's no Raspbian in Fauxhai :(
|
368
|
+
stub_ohai(platform: 'debian', version: '7.6') do |data|
|
369
|
+
data['platform'] = 'raspbian'
|
370
|
+
data['platform_version'] = '7.6'
|
371
|
+
data['kernel']['machine'] = 'armv6l'
|
372
|
+
end
|
373
|
+
end
|
374
|
+
|
375
|
+
it 'returns armhf' do
|
376
|
+
expect(subject.safe_architecture).to eq('armhf')
|
354
377
|
end
|
355
378
|
end
|
356
379
|
|
357
|
-
|
358
|
-
|
380
|
+
context 'Ubuntu on Pi v2' do
|
381
|
+
before do
|
382
|
+
# There's no Raspbian in Fauxhai :(
|
383
|
+
stub_ohai(platform: 'ubuntu', version: '14.04') do |data|
|
384
|
+
data['kernel']['machine'] = 'armv7l'
|
385
|
+
end
|
386
|
+
end
|
387
|
+
|
388
|
+
it 'returns armhf' do
|
389
|
+
expect(subject.safe_architecture).to eq('armhf')
|
390
|
+
end
|
359
391
|
end
|
360
392
|
end
|
361
393
|
end
|
@@ -15,9 +15,9 @@ module Omnibus
|
|
15
15
|
|
16
16
|
subject { described_class.new(project) }
|
17
17
|
|
18
|
-
let(:project_root) {
|
19
|
-
let(:package_dir) {
|
20
|
-
let(:staging_dir) {
|
18
|
+
let(:project_root) { File.join(tmp_path, 'project/root') }
|
19
|
+
let(:package_dir) { File.join(tmp_path, 'package/dir') }
|
20
|
+
let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
|
21
21
|
|
22
22
|
before do
|
23
23
|
Config.project_root(project_root)
|
@@ -44,7 +44,7 @@ module Omnibus
|
|
44
44
|
end
|
45
45
|
|
46
46
|
describe '#write_makeselfinst' do
|
47
|
-
it 'generates the executable file' do
|
47
|
+
it 'generates the executable file', :not_supported_on_windows do
|
48
48
|
subject.write_makeselfinst
|
49
49
|
expect("#{staging_dir}/makeselfinst").to be_an_executable
|
50
50
|
end
|
@@ -9,15 +9,15 @@ module Omnibus
|
|
9
9
|
project.install_dir('C:/project')
|
10
10
|
project.build_version('1.2.3')
|
11
11
|
project.build_iteration('2')
|
12
|
-
project.maintainer('Chef Software')
|
12
|
+
project.maintainer('Chef Software <maintainers@chef.io>')
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
subject { described_class.new(project) }
|
17
17
|
|
18
|
-
let(:project_root) {
|
19
|
-
let(:package_dir) {
|
20
|
-
let(:staging_dir) {
|
18
|
+
let(:project_root) { File.join(tmp_path, 'project/root') }
|
19
|
+
let(:package_dir) { File.join(tmp_path, 'package/dir') }
|
20
|
+
let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
|
21
21
|
|
22
22
|
before do
|
23
23
|
Config.project_root(project_root)
|
@@ -31,6 +31,10 @@ module Omnibus
|
|
31
31
|
it 'exposes :parameters' do
|
32
32
|
expect(subject).to have_exposed_method(:parameters)
|
33
33
|
end
|
34
|
+
|
35
|
+
it 'exposes :signing_identity' do
|
36
|
+
expect(subject).to have_exposed_method(:signing_identity)
|
37
|
+
end
|
34
38
|
end
|
35
39
|
|
36
40
|
describe '#id' do
|
@@ -86,8 +90,17 @@ module Omnibus
|
|
86
90
|
end
|
87
91
|
|
88
92
|
describe '#package_name' do
|
93
|
+
before do
|
94
|
+
allow(Config).to receive(:windows_arch).and_return(:foo_arch)
|
95
|
+
end
|
96
|
+
|
89
97
|
it 'includes the name, version, and build iteration' do
|
90
|
-
expect(subject.package_name).to eq('project-1.2.3-2.msi')
|
98
|
+
expect(subject.package_name).to eq('project-1.2.3-2-foo_arch.msi')
|
99
|
+
end
|
100
|
+
|
101
|
+
it 'returns the bundle name when building a bundle' do
|
102
|
+
subject.bundle_msi(true)
|
103
|
+
expect(subject.package_name).to eq('project-1.2.3-2-foo_arch.exe')
|
91
104
|
end
|
92
105
|
end
|
93
106
|
|
@@ -108,7 +121,7 @@ module Omnibus
|
|
108
121
|
contents = File.read("#{staging_dir}/localization-en-us.wxl")
|
109
122
|
|
110
123
|
expect(contents).to include('<String Id="ProductName">Project</String>')
|
111
|
-
expect(contents).to include('<String Id="ManufacturerName">Chef Software</String>')
|
124
|
+
expect(contents).to include('<String Id="ManufacturerName">"Chef Software <maintainers@chef.io>"</String>')
|
112
125
|
expect(contents).to include('<String Id="FeatureMainName">Project</String>')
|
113
126
|
end
|
114
127
|
end
|
@@ -168,6 +181,27 @@ module Omnibus
|
|
168
181
|
end
|
169
182
|
end
|
170
183
|
|
184
|
+
describe '#write_bundle_file' do
|
185
|
+
before do
|
186
|
+
subject.bundle_msi(true)
|
187
|
+
subject.upgrade_code('ABCD-1234')
|
188
|
+
allow(Config).to receive(:windows_arch).and_return(:x86)
|
189
|
+
end
|
190
|
+
|
191
|
+
it 'generates the file' do
|
192
|
+
subject.write_bundle_file
|
193
|
+
expect("#{staging_dir}/bundle.wxs").to be_a_file
|
194
|
+
end
|
195
|
+
|
196
|
+
it 'has the correct content' do
|
197
|
+
outpath = "#{tmp_path}/package/dir/project-1.2.3-2-x86.msi"
|
198
|
+
outpath = outpath.gsub(File::SEPARATOR, File::ALT_SEPARATOR) if windows?
|
199
|
+
subject.write_bundle_file
|
200
|
+
contents = File.read("#{staging_dir}/bundle.wxs")
|
201
|
+
expect(contents).to include("<MsiPackage SourceFile=\"#{outpath}\" EnableFeatureSelection=\"no\" />")
|
202
|
+
end
|
203
|
+
end
|
204
|
+
|
171
205
|
describe '#msi_version' do
|
172
206
|
context 'when the project build_version semver' do
|
173
207
|
it 'returns the right value' do
|
@@ -263,5 +297,87 @@ module Omnibus
|
|
263
297
|
expect(subject.wix_extension_switches(['a', 'b'])).to eq("-ext 'a' -ext 'b'")
|
264
298
|
end
|
265
299
|
end
|
300
|
+
|
301
|
+
describe "#bundle_msi" do
|
302
|
+
it 'is a DSL method' do
|
303
|
+
expect(subject).to have_exposed_method(:bundle_msi)
|
304
|
+
end
|
305
|
+
|
306
|
+
it 'requires the value to be a TrueClass or a FalseClass' do
|
307
|
+
expect {
|
308
|
+
subject.bundle_msi(Object.new)
|
309
|
+
}.to raise_error(InvalidValue)
|
310
|
+
end
|
311
|
+
|
312
|
+
it 'returns the given value' do
|
313
|
+
subject.bundle_msi(true)
|
314
|
+
expect(subject.bundle_msi).to be_truthy
|
315
|
+
end
|
316
|
+
end
|
317
|
+
|
318
|
+
context 'when signing parameters are provided' do
|
319
|
+
let(:msi) { 'somemsi.msi' }
|
320
|
+
|
321
|
+
context 'when invalid parameters' do
|
322
|
+
it 'should raise an InvalidValue error when the certificate name is not a String' do
|
323
|
+
expect{subject.signing_identity(Object.new)}.to raise_error(InvalidValue)
|
324
|
+
end
|
325
|
+
|
326
|
+
it 'should raise an InvalidValue error when params is not a Hash' do
|
327
|
+
expect{subject.signing_identity("foo", Object.new)}.to raise_error(InvalidValue)
|
328
|
+
end
|
329
|
+
|
330
|
+
it 'should raise an InvalidValue error when params contains an invalid key' do
|
331
|
+
expect{subject.signing_identity("foo", bar: 'baz')}.to raise_error(InvalidValue)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
context 'when valid parameters' do
|
336
|
+
before do
|
337
|
+
allow(subject).to receive(:shellout!)
|
338
|
+
end
|
339
|
+
|
340
|
+
it 'should sign the file and then add the timestamp' do
|
341
|
+
subject.signing_identity('foo')
|
342
|
+
expect(subject).to receive(:add_timestamp)
|
343
|
+
subject.sign_package(msi)
|
344
|
+
end
|
345
|
+
|
346
|
+
describe "#timestamp_servers" do
|
347
|
+
it "defaults to using ['http://timestamp.digicert.com','http://timestamp.verisign.com/scripts/timestamp.dll']" do
|
348
|
+
subject.signing_identity('foo')
|
349
|
+
expect(subject).to receive(:try_timestamp).with(msi, 'http://timestamp.digicert.com').and_return(false)
|
350
|
+
expect(subject).to receive(:try_timestamp).with(msi, 'http://timestamp.verisign.com/scripts/timestamp.dll').and_return(true)
|
351
|
+
subject.sign_package(msi)
|
352
|
+
end
|
353
|
+
|
354
|
+
it 'uses the timestamp server if provided through the #timestamp_server dsl' do
|
355
|
+
subject.signing_identity('foo', timestamp_servers: 'http://fooserver')
|
356
|
+
expect(subject).to receive(:try_timestamp).with(msi, 'http://fooserver').and_return(true)
|
357
|
+
subject.sign_package(msi)
|
358
|
+
end
|
359
|
+
|
360
|
+
it 'tries all timestamp server if provided through the #timestamp_server dsl' do
|
361
|
+
subject.signing_identity('foo', timestamp_servers: ['http://fooserver', 'http://barserver'])
|
362
|
+
expect(subject).to receive(:try_timestamp).with(msi, 'http://fooserver').and_return(false)
|
363
|
+
expect(subject).to receive(:try_timestamp).with(msi, 'http://barserver').and_return(true)
|
364
|
+
subject.sign_package(msi)
|
365
|
+
end
|
366
|
+
|
367
|
+
it 'tries all timestamp server if provided through the #timestamp_servers dsl and stops at the first available' do
|
368
|
+
subject.signing_identity('foo', timestamp_servers: ['http://fooserver', 'http://barserver'])
|
369
|
+
expect(subject).to receive(:try_timestamp).with(msi, 'http://fooserver').and_return(true)
|
370
|
+
expect(subject).not_to receive(:try_timestamp).with(msi, 'http://barserver')
|
371
|
+
subject.sign_package(msi)
|
372
|
+
end
|
373
|
+
|
374
|
+
it 'raises an exception if there are no available timestamp servers' do
|
375
|
+
subject.signing_identity('foo', timestamp_servers: 'http://fooserver')
|
376
|
+
expect(subject).to receive(:try_timestamp).with(msi, 'http://fooserver').and_return(false)
|
377
|
+
expect {subject.sign_package(msi)}.to raise_error(FailedToTimestampMSI)
|
378
|
+
end
|
379
|
+
end
|
380
|
+
end
|
381
|
+
end
|
266
382
|
end
|
267
383
|
end
|
@@ -15,9 +15,9 @@ module Omnibus
|
|
15
15
|
|
16
16
|
subject { described_class.new(project) }
|
17
17
|
|
18
|
-
let(:project_root) {
|
19
|
-
let(:package_dir) {
|
20
|
-
let(:staging_dir) {
|
18
|
+
let(:project_root) { File.join(tmp_path, 'project/root') }
|
19
|
+
let(:package_dir) { File.join(tmp_path, 'package/dir') }
|
20
|
+
let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
|
21
21
|
|
22
22
|
before do
|
23
23
|
subject.identifier('com.getchef.project')
|
@@ -16,9 +16,9 @@ module Omnibus
|
|
16
16
|
|
17
17
|
subject { described_class.new(project) }
|
18
18
|
|
19
|
-
let(:project_root) {
|
20
|
-
let(:package_dir) {
|
21
|
-
let(:staging_dir) {
|
19
|
+
let(:project_root) { File.join(tmp_path, 'project/root') }
|
20
|
+
let(:package_dir) { File.join(tmp_path, 'package/dir') }
|
21
|
+
let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
|
22
22
|
|
23
23
|
before do
|
24
24
|
Config.project_root(project_root)
|
@@ -31,6 +31,8 @@ module Omnibus
|
|
31
31
|
create_directory("#{staging_dir}/SRPMS")
|
32
32
|
create_directory("#{staging_dir}/SOURCES")
|
33
33
|
create_directory("#{staging_dir}/SPECS")
|
34
|
+
|
35
|
+
stub_ohai(platform: 'redhat', version: '6.5')
|
34
36
|
end
|
35
37
|
|
36
38
|
describe '#signing_passphrase' do
|
@@ -112,7 +114,7 @@ module Omnibus
|
|
112
114
|
end
|
113
115
|
|
114
116
|
it 'includes the name, version, and build iteration' do
|
115
|
-
expect(subject.package_name).to eq('project-1.2.3-2.x86_64.rpm')
|
117
|
+
expect(subject.package_name).to eq('project-1.2.3-2.el6.x86_64.rpm')
|
116
118
|
end
|
117
119
|
end
|
118
120
|
|
@@ -127,7 +129,7 @@ module Omnibus
|
|
127
129
|
allow(subject).to receive(:safe_architecture).and_return('x86_64')
|
128
130
|
end
|
129
131
|
|
130
|
-
let(:spec_file) { "#{staging_dir}/SPECS/project-1.2.3-2.x86_64.rpm.spec" }
|
132
|
+
let(:spec_file) { "#{staging_dir}/SPECS/project-1.2.3-2.el6.x86_64.rpm.spec" }
|
131
133
|
|
132
134
|
it 'generates the file' do
|
133
135
|
subject.write_rpm_spec
|
@@ -140,7 +142,7 @@ module Omnibus
|
|
140
142
|
|
141
143
|
expect(contents).to include("Name: project")
|
142
144
|
expect(contents).to include("Version: 1.2.3")
|
143
|
-
expect(contents).to include("Release: 2")
|
145
|
+
expect(contents).to include("Release: 2.el6")
|
144
146
|
expect(contents).to include("Summary: The full stack of project")
|
145
147
|
expect(contents).to include("BuildArch: x86_64")
|
146
148
|
expect(contents).to include("AutoReqProv: no")
|
@@ -205,29 +207,34 @@ module Omnibus
|
|
205
207
|
create_file("#{staging_dir}/BUILD/file2")
|
206
208
|
create_directory("#{staging_dir}/BUILD/.dir1")
|
207
209
|
create_directory("#{staging_dir}/BUILD/dir2")
|
210
|
+
create_directory("#{staging_dir}/BUILD/dir3 space")
|
208
211
|
end
|
209
212
|
|
210
213
|
it 'writes them into the spec' do
|
211
214
|
subject.write_rpm_spec
|
212
215
|
contents = File.read(spec_file)
|
213
216
|
|
214
|
-
expect(contents).to include("/.dir1")
|
217
|
+
expect(contents).to include("%dir /.dir1")
|
215
218
|
expect(contents).to include("/.file1")
|
216
|
-
expect(contents).to include("/dir2")
|
219
|
+
expect(contents).to include("%dir /dir2")
|
217
220
|
expect(contents).to include("/file2")
|
221
|
+
expect(contents).to include("%dir \"/dir3 space\"")
|
218
222
|
end
|
219
223
|
end
|
220
224
|
|
221
225
|
context 'when leaf directories owned by the filesystem package are present' do
|
222
226
|
before do
|
223
|
-
|
227
|
+
create_directory("#{staging_dir}/BUILD/usr/lib")
|
228
|
+
create_directory("#{staging_dir}/BUILD/opt")
|
229
|
+
create_file("#{staging_dir}/BUILD/opt/thing")
|
224
230
|
end
|
225
231
|
|
226
|
-
it '
|
232
|
+
it 'is written into the spec with ownership and permissions' do
|
227
233
|
subject.write_rpm_spec
|
228
234
|
contents = File.read(spec_file)
|
229
235
|
|
230
|
-
expect(contents).
|
236
|
+
expect(contents).to include("%dir %attr(0755,root,root) /opt")
|
237
|
+
expect(contents).to include("%dir %attr(0555,root,root) /usr/lib")
|
231
238
|
end
|
232
239
|
end
|
233
240
|
end
|
@@ -295,6 +302,12 @@ module Omnibus
|
|
295
302
|
end
|
296
303
|
end
|
297
304
|
|
305
|
+
describe '#dist_tag' do
|
306
|
+
it 'returns the Fedora packaging guidelines dist tag for the package' do
|
307
|
+
expect(subject.dist_tag).to eq('.el6')
|
308
|
+
end
|
309
|
+
end
|
310
|
+
|
298
311
|
describe '#safe_base_package_name' do
|
299
312
|
context 'when the project name is "safe"' do
|
300
313
|
it 'returns the value without logging a message' do
|
@@ -357,7 +370,7 @@ module Omnibus
|
|
357
370
|
|
358
371
|
describe '#safe_architecture' do
|
359
372
|
before do
|
360
|
-
stub_ohai(platform: '
|
373
|
+
stub_ohai(platform: 'redhat', version: '6.5') do |data|
|
361
374
|
data['kernel']['machine'] = 'i386'
|
362
375
|
end
|
363
376
|
end
|
@@ -366,6 +379,18 @@ module Omnibus
|
|
366
379
|
expect(subject.safe_architecture).to eq('i386')
|
367
380
|
end
|
368
381
|
|
382
|
+
context 'when i686' do
|
383
|
+
before do
|
384
|
+
stub_ohai(platform: 'redhat', version: '6.5') do |data|
|
385
|
+
data['kernel']['machine'] = 'i686'
|
386
|
+
end
|
387
|
+
end
|
388
|
+
|
389
|
+
it 'returns i386' do
|
390
|
+
expect(subject.safe_architecture).to eq('i386')
|
391
|
+
end
|
392
|
+
end
|
393
|
+
|
369
394
|
context 'on Pidora' do
|
370
395
|
before do
|
371
396
|
# There's no Pidora in Fauxhai :(
|