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,28 +1,28 @@
|
|
1
|
-
require
|
1
|
+
require "spec_helper"
|
2
2
|
|
3
3
|
module Omnibus
|
4
4
|
describe Packager::BFF 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(
|
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
13
|
end
|
14
14
|
end
|
15
15
|
|
16
16
|
subject { described_class.new(project) }
|
17
17
|
|
18
|
-
let(:project_root) { File.join(tmp_path,
|
19
|
-
let(:package_dir) { File.join(tmp_path,
|
20
|
-
let(:staging_dir) { File.join(tmp_path,
|
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
|
# This is here to allow this unit test to run on windows.
|
24
24
|
allow(File).to receive(:expand_path).and_wrap_original do |m, *args|
|
25
|
-
m.call(*args).sub(/^[A-Za-z]:/,
|
25
|
+
m.call(*args).sub(/^[A-Za-z]:/, "")
|
26
26
|
end
|
27
27
|
Config.project_root(project_root)
|
28
28
|
Config.package_dir(package_dir)
|
@@ -33,36 +33,36 @@ module Omnibus
|
|
33
33
|
end
|
34
34
|
|
35
35
|
describe '#id' do
|
36
|
-
it
|
36
|
+
it "is :bff" do
|
37
37
|
expect(subject.id).to eq(:bff)
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
41
|
describe '#package_name' do
|
42
42
|
before do
|
43
|
-
allow(subject).to receive(:safe_architecture).and_return(
|
43
|
+
allow(subject).to receive(:safe_architecture).and_return("x86_64")
|
44
44
|
end
|
45
45
|
|
46
|
-
it
|
47
|
-
expect(subject.package_name).to eq(
|
46
|
+
it "includes the name and version" do
|
47
|
+
expect(subject.package_name).to eq("project-1.2.3-2.x86_64.bff")
|
48
48
|
end
|
49
49
|
end
|
50
50
|
|
51
51
|
describe '#scripts_install_dir' do
|
52
|
-
it
|
52
|
+
it "is nested inside the project install_dir" do
|
53
53
|
expect(subject.scripts_install_dir).to start_with(project.install_dir)
|
54
54
|
end
|
55
55
|
end
|
56
56
|
|
57
57
|
describe '#scripts_staging_dir' do
|
58
|
-
it
|
58
|
+
it "is nested inside the staging_dir" do
|
59
59
|
expect(subject.scripts_staging_dir).to start_with(staging_dir)
|
60
60
|
end
|
61
61
|
end
|
62
62
|
|
63
63
|
describe '#write_scripts' do
|
64
|
-
context
|
65
|
-
let(:scripts) { %w
|
64
|
+
context "when scripts are given" do
|
65
|
+
let(:scripts) { %w{ preinst postinst prerm postrm } }
|
66
66
|
before do
|
67
67
|
scripts.each do |script_name|
|
68
68
|
create_file("#{project_root}/package-scripts/project/#{script_name}") do
|
@@ -71,7 +71,7 @@ module Omnibus
|
|
71
71
|
end
|
72
72
|
end
|
73
73
|
|
74
|
-
it
|
74
|
+
it "writes the scripts into scripts staging dir" do
|
75
75
|
subject.write_scripts
|
76
76
|
|
77
77
|
scripts.each do |script_name|
|
@@ -85,17 +85,17 @@ module Omnibus
|
|
85
85
|
|
86
86
|
describe '#write_gen_template' do
|
87
87
|
before do
|
88
|
-
allow(subject).to receive(:safe_architecture).and_return(
|
88
|
+
allow(subject).to receive(:safe_architecture).and_return("x86_64")
|
89
89
|
end
|
90
90
|
|
91
91
|
let(:gen_file) { "#{staging_dir}/gen.template" }
|
92
92
|
|
93
|
-
it
|
93
|
+
it "generates the file" do
|
94
94
|
subject.write_gen_template
|
95
95
|
expect(gen_file).to be_a_file
|
96
96
|
end
|
97
97
|
|
98
|
-
it
|
98
|
+
it "has the correct content" do
|
99
99
|
subject.write_gen_template
|
100
100
|
contents = File.read(gen_file)
|
101
101
|
|
@@ -118,7 +118,7 @@ module Omnibus
|
|
118
118
|
expect(contents).to include("EOFileset")
|
119
119
|
end
|
120
120
|
|
121
|
-
context
|
121
|
+
context "when files and directories are present" do
|
122
122
|
before do
|
123
123
|
create_file("#{staging_dir}/.file1")
|
124
124
|
create_file("#{staging_dir}/file2")
|
@@ -126,7 +126,7 @@ module Omnibus
|
|
126
126
|
create_directory("#{staging_dir}/dir2")
|
127
127
|
end
|
128
128
|
|
129
|
-
it
|
129
|
+
it "writes them into the template" do
|
130
130
|
subject.write_gen_template
|
131
131
|
contents = File.read(gen_file)
|
132
132
|
|
@@ -137,7 +137,7 @@ module Omnibus
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
-
context
|
140
|
+
context "when paths with colons/commas are present", if: !windows? do
|
141
141
|
let(:contents) do
|
142
142
|
subject.write_gen_template
|
143
143
|
File.read(gen_file)
|
@@ -150,23 +150,23 @@ module Omnibus
|
|
150
150
|
create_directory("#{staging_dir}/comma,dir/file")
|
151
151
|
end
|
152
152
|
|
153
|
-
it
|
153
|
+
it "renames colon filenames in the template" do
|
154
154
|
expect(contents).to include("/man3/App____Cpan.3")
|
155
155
|
end
|
156
156
|
|
157
|
-
it
|
157
|
+
it "renames colon directory names in the template" do
|
158
158
|
expect(contents).to include("/colon____dir/file")
|
159
159
|
end
|
160
160
|
|
161
|
-
it
|
161
|
+
it "renames comma filenames in the template" do
|
162
162
|
expect(contents).to include("/comma__file")
|
163
163
|
end
|
164
164
|
|
165
|
-
it
|
165
|
+
it "renames comma directory names in the template" do
|
166
166
|
expect(contents).to include("/comma__dir/file")
|
167
167
|
end
|
168
168
|
|
169
|
-
context
|
169
|
+
context "creates a config script" do
|
170
170
|
it 'when there wasn\'t one provided' do
|
171
171
|
FileUtils.rm_f("#{subject.scripts_staging_dir}/config")
|
172
172
|
subject.write_gen_template
|
@@ -180,7 +180,7 @@ module Omnibus
|
|
180
180
|
expect(contents).to include("mv '/man3/App____Cpan.3' '/man3/App::Cpan.3'")
|
181
181
|
end
|
182
182
|
|
183
|
-
it
|
183
|
+
it "with mv commands for all the renamed files" do
|
184
184
|
subject.write_gen_template
|
185
185
|
contents = File.read("#{subject.scripts_staging_dir}/config")
|
186
186
|
expect(contents).to include("mv '/man3/App____Cpan.3' '/man3/App::Cpan.3'")
|
@@ -191,7 +191,7 @@ module Omnibus
|
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|
194
|
-
context
|
194
|
+
context "when script files are present" do
|
195
195
|
before do
|
196
196
|
create_file("#{subject.scripts_staging_dir}/preinst")
|
197
197
|
create_file("#{subject.scripts_staging_dir}/postinst")
|
@@ -200,7 +200,7 @@ module Omnibus
|
|
200
200
|
create_file("#{subject.scripts_staging_dir}/config")
|
201
201
|
end
|
202
202
|
|
203
|
-
it
|
203
|
+
it "writes them into the template" do
|
204
204
|
subject.write_gen_template
|
205
205
|
contents = File.read(gen_file)
|
206
206
|
|
@@ -212,12 +212,12 @@ module Omnibus
|
|
212
212
|
end
|
213
213
|
end
|
214
214
|
|
215
|
-
context
|
215
|
+
context "when the log_level is :debug, it" do
|
216
216
|
before do
|
217
217
|
Omnibus.logger.level = :debug
|
218
218
|
end
|
219
219
|
|
220
|
-
it
|
220
|
+
it "prints the rendered template" do
|
221
221
|
output = capture_logging { subject.write_gen_template }
|
222
222
|
expect(output).to include("Package Name: project")
|
223
223
|
end
|
@@ -240,8 +240,8 @@ module Omnibus
|
|
240
240
|
allow(subject).to receive(:shellout!)
|
241
241
|
.with("id -g").and_return(id_shellout)
|
242
242
|
|
243
|
-
create_file(File.join(staging_dir,
|
244
|
-
<<-INVENTORY.gsub(/^\s{12}/,
|
243
|
+
create_file(File.join(staging_dir, ".info", "#{project.name}.inventory")) {
|
244
|
+
<<-INVENTORY.gsub(/^\s{12}/, "")
|
245
245
|
/opt/project/version-manifest.txt:
|
246
246
|
owner = root
|
247
247
|
group = system
|
@@ -255,19 +255,19 @@ module Omnibus
|
|
255
255
|
create_file("#{staging_dir}/file") { "http://goo.gl/TbkO01" }
|
256
256
|
end
|
257
257
|
|
258
|
-
it
|
258
|
+
it "gets the build uid" do
|
259
259
|
expect(subject).to receive(:shellout!)
|
260
260
|
.with("id -u")
|
261
261
|
subject.create_bff_file
|
262
262
|
end
|
263
263
|
|
264
|
-
it
|
264
|
+
it "gets the build gid" do
|
265
265
|
expect(subject).to receive(:shellout!)
|
266
266
|
.with("id -g")
|
267
267
|
subject.create_bff_file
|
268
268
|
end
|
269
269
|
|
270
|
-
it
|
270
|
+
it "chowns the directory to root" do
|
271
271
|
# A note - the /opt/ here is essentially project.install_dir one level up.
|
272
272
|
# There is nothing magical about 'opt' as a directory.
|
273
273
|
expect(subject).to receive(:shellout!)
|
@@ -275,18 +275,18 @@ module Omnibus
|
|
275
275
|
subject.create_bff_file
|
276
276
|
end
|
277
277
|
|
278
|
-
it
|
278
|
+
it "logs a message" do
|
279
279
|
output = capture_logging { subject.create_bff_file }
|
280
|
-
expect(output).to include(
|
280
|
+
expect(output).to include("Creating .bff file")
|
281
281
|
end
|
282
282
|
|
283
|
-
it
|
283
|
+
it "uses the correct command" do
|
284
284
|
expect(subject).to receive(:shellout!)
|
285
285
|
.with(/\/usr\/sbin\/mkinstallp -d/)
|
286
286
|
subject.create_bff_file
|
287
287
|
end
|
288
288
|
|
289
|
-
it
|
289
|
+
it "chowns the directory back to the build user" do
|
290
290
|
# A note - the /opt/ here is essentially project.install_dir one level up.
|
291
291
|
# There is nothing magical about 'opt' as a directory.
|
292
292
|
# 300 is just what we set the mock for the build uid/gid to return.
|
@@ -295,12 +295,12 @@ module Omnibus
|
|
295
295
|
subject.create_bff_file
|
296
296
|
end
|
297
297
|
|
298
|
-
context
|
298
|
+
context "when the log_level is :debug, it" do
|
299
299
|
before do
|
300
300
|
Omnibus.logger.level = :debug
|
301
301
|
end
|
302
302
|
|
303
|
-
it
|
303
|
+
it "prints the inventory file" do
|
304
304
|
output = capture_logging { subject.create_bff_file }
|
305
305
|
expect(output).to match(%r{^/opt/project})
|
306
306
|
end
|
@@ -309,18 +309,18 @@ module Omnibus
|
|
309
309
|
|
310
310
|
describe '#safe_base_package_name' do
|
311
311
|
context 'when the project name is "safe"' do
|
312
|
-
it
|
313
|
-
expect(subject.safe_base_package_name).to eq(
|
312
|
+
it "returns the value without logging a message" do
|
313
|
+
expect(subject.safe_base_package_name).to eq("project")
|
314
314
|
expect(subject).to_not receive(:log)
|
315
315
|
end
|
316
316
|
end
|
317
317
|
|
318
|
-
context
|
318
|
+
context "when the project name has invalid characters" do
|
319
319
|
before { project.name("Pro$ject123.for-realz_2") }
|
320
320
|
|
321
|
-
it
|
321
|
+
it "returns the value while logging a message" do
|
322
322
|
output = capture_logging do
|
323
|
-
expect(subject.safe_base_package_name).to eq(
|
323
|
+
expect(subject.safe_base_package_name).to eq("pro-ject123.for-realz-2")
|
324
324
|
end
|
325
325
|
|
326
326
|
expect(output).to include("The `name' component of BFF package names can only include")
|
@@ -329,27 +329,27 @@ module Omnibus
|
|
329
329
|
end
|
330
330
|
|
331
331
|
describe '#create_bff_file_name' do
|
332
|
-
it
|
333
|
-
expect(subject.create_bff_file_name).to eq(
|
332
|
+
it "constructs the proper package name" do
|
333
|
+
expect(subject.create_bff_file_name).to eq("project-1.2.3-2.x86_64.bff")
|
334
334
|
end
|
335
335
|
|
336
336
|
end
|
337
337
|
|
338
338
|
describe '#bff_version' do
|
339
|
-
it
|
340
|
-
expect(subject.bff_version).to eq(
|
339
|
+
it "returns the build version up with the build iteration" do
|
340
|
+
expect(subject.bff_version).to eq("1.2.3.2")
|
341
341
|
end
|
342
342
|
end
|
343
343
|
|
344
344
|
describe '#safe_architecture' do
|
345
345
|
before do
|
346
|
-
stub_ohai(platform:
|
347
|
-
data[
|
346
|
+
stub_ohai(platform: "ubuntu", version: "12.04") do |data|
|
347
|
+
data["kernel"]["machine"] = "i386"
|
348
348
|
end
|
349
349
|
end
|
350
350
|
|
351
|
-
it
|
352
|
-
expect(subject.safe_architecture).to eq(
|
351
|
+
it "returns the value from Ohai" do
|
352
|
+
expect(subject.safe_architecture).to eq("i386")
|
353
353
|
end
|
354
354
|
end
|
355
355
|
end
|