omnibus 8.0.9 → 8.3.2
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 +4 -4
- data/README.md +1 -2
- data/lib/omnibus/builder.rb +57 -17
- data/lib/omnibus/compressors/dmg.rb +2 -2
- data/lib/omnibus/config.rb +3 -1
- data/lib/omnibus/health_check.rb +147 -38
- data/lib/omnibus/manifest_diff.rb +7 -13
- data/lib/omnibus/metadata.rb +7 -3
- data/lib/omnibus/packagers/pkg.rb +21 -13
- data/lib/omnibus/packagers/rpm.rb +23 -9
- data/lib/omnibus/software.rb +2 -2
- data/lib/omnibus/version.rb +1 -1
- data/lib/omnibus/whitelist.rb +33 -12
- data/omnibus.gemspec +4 -3
- data/resources/msi/CustomActionFastMsi.CA.dll +0 -0
- data/resources/pkg/distribution.xml.erb +1 -1
- data/resources/rpm/spec.erb +5 -2
- data/spec/functional/fetchers/net_fetcher_spec.rb +2 -11
- data/spec/unit/builder_spec.rb +6 -0
- data/spec/unit/compressor_spec.rb +2 -2
- data/spec/unit/compressors/dmg_spec.rb +9 -9
- data/spec/unit/compressors/tgz_spec.rb +4 -4
- data/spec/unit/fetchers/net_fetcher_spec.rb +5 -1
- data/spec/unit/health_check_spec.rb +75 -6
- data/spec/unit/metadata_spec.rb +2 -0
- data/spec/unit/packager_spec.rb +2 -2
- data/spec/unit/packagers/pkg_spec.rb +29 -7
- data/spec/unit/packagers/rpm_spec.rb +10 -0
- data/spec/unit/project_spec.rb +2 -2
- data/spec/unit/software_spec.rb +25 -25
- metadata +33 -7
@@ -125,7 +125,7 @@ module Omnibus
|
|
125
125
|
|
126
126
|
# @see Base#package_name
|
127
127
|
def package_name
|
128
|
-
"#{safe_base_package_name}-#{safe_version}-#{safe_build_iteration}.pkg"
|
128
|
+
"#{safe_base_package_name}-#{safe_version}-#{safe_build_iteration}.#{safe_architecture}.pkg"
|
129
129
|
end
|
130
130
|
|
131
131
|
#
|
@@ -286,6 +286,7 @@ module Omnibus
|
|
286
286
|
identifier: safe_identifier,
|
287
287
|
version: safe_version,
|
288
288
|
component_pkg: component_pkg,
|
289
|
+
host_architecture: safe_architecture,
|
289
290
|
})
|
290
291
|
end
|
291
292
|
|
@@ -320,6 +321,15 @@ module Omnibus
|
|
320
321
|
"#{safe_base_package_name}-core.pkg"
|
321
322
|
end
|
322
323
|
|
324
|
+
#
|
325
|
+
# Return the architecture
|
326
|
+
#
|
327
|
+
# @return [String]
|
328
|
+
#
|
329
|
+
def safe_architecture
|
330
|
+
@safe_architecture ||= Ohai["kernel"]["machine"]
|
331
|
+
end
|
332
|
+
|
323
333
|
#
|
324
334
|
# Return the PKG-ready base package name, removing any invalid characters.
|
325
335
|
#
|
@@ -421,23 +431,21 @@ module Omnibus
|
|
421
431
|
end
|
422
432
|
|
423
433
|
def is_binary?(bin)
|
424
|
-
|
425
|
-
|
426
|
-
|
427
|
-
|
428
|
-
is_binary
|
434
|
+
return false unless File.file?(bin) && File.executable?(bin) && !File.symlink?(bin)
|
435
|
+
|
436
|
+
log.debug(log_key) { " skipping non-binary file from signing: #{bin}" }
|
437
|
+
true
|
429
438
|
end
|
430
439
|
|
431
440
|
def is_macho?(lib)
|
432
|
-
|
433
|
-
if is_binary?(lib)
|
434
|
-
command = "file #{lib}"
|
441
|
+
return false unless File.file?(lib) && File.executable?(lib) && !File.symlink?(lib)
|
435
442
|
|
436
|
-
|
437
|
-
|
443
|
+
if shellout!("file #{lib}").stdout.match?(/Mach-O.*(library|bundle)/) # https://rubular.com/r/nRgaQlAbkM9wHL
|
444
|
+
log.debug(log_key) { " skipping non-Mach-O library file from signing: #{lib}" }
|
445
|
+
return true
|
438
446
|
end
|
439
|
-
|
440
|
-
|
447
|
+
|
448
|
+
false
|
441
449
|
end
|
442
450
|
end
|
443
451
|
end
|
@@ -417,6 +417,10 @@ module Omnibus
|
|
417
417
|
command << %{ -bb}
|
418
418
|
command << %{ --buildroot #{staging_dir}/BUILD}
|
419
419
|
command << %{ --define '_topdir #{staging_dir}'}
|
420
|
+
command << " #{spec_file}"
|
421
|
+
|
422
|
+
log.info(log_key) { "Creating .rpm file" }
|
423
|
+
shellout!("#{command}")
|
420
424
|
|
421
425
|
if signing_passphrase
|
422
426
|
log.info(log_key) { "Signing enabled for .rpm file" }
|
@@ -438,17 +442,18 @@ module Omnibus
|
|
438
442
|
})
|
439
443
|
end
|
440
444
|
|
441
|
-
|
442
|
-
command << " #{spec_file}"
|
443
|
-
|
445
|
+
sign_cmd = "rpmsign --addsign #{rpm_file}"
|
444
446
|
with_rpm_signing do |signing_script|
|
445
|
-
log.info(log_key) { "
|
446
|
-
|
447
|
+
log.info(log_key) { "Signing the built rpm file" }
|
448
|
+
|
449
|
+
# RHEL 8 has gpg-agent running so we can skip the expect script since the agent
|
450
|
+
# takes care of the passphrase entering on the signing
|
451
|
+
if dist_tag != ".el8"
|
452
|
+
sign_cmd.prepend("#{signing_script} \"").concat("\"")
|
453
|
+
end
|
454
|
+
|
455
|
+
shellout!("#{sign_cmd}", environment: { "HOME" => home })
|
447
456
|
end
|
448
|
-
else
|
449
|
-
log.info(log_key) { "Creating .rpm file" }
|
450
|
-
command << " #{spec_file}"
|
451
|
-
shellout!("#{command}")
|
452
457
|
end
|
453
458
|
|
454
459
|
FileSyncer.glob("#{staging_dir}/RPMS/**/*.rpm").each do |rpm|
|
@@ -483,6 +488,15 @@ module Omnibus
|
|
483
488
|
"#{staging_dir}/SPECS/#{package_name}.spec"
|
484
489
|
end
|
485
490
|
|
491
|
+
#
|
492
|
+
# The full path to the rpm file.
|
493
|
+
#
|
494
|
+
# @return [String]
|
495
|
+
#
|
496
|
+
def rpm_file
|
497
|
+
"#{staging_dir}/RPMS/#{safe_architecture}/#{package_name}"
|
498
|
+
end
|
499
|
+
|
486
500
|
#
|
487
501
|
# Render the rpm signing script with secure permissions, call the given
|
488
502
|
# block with the path to the script, and ensure deletion of the script from
|
data/lib/omnibus/software.rb
CHANGED
@@ -718,7 +718,7 @@ module Omnibus
|
|
718
718
|
"CC" => "clang",
|
719
719
|
"CXX" => "clang++",
|
720
720
|
"LDFLAGS" => "-L#{install_dir}/embedded/lib",
|
721
|
-
"CFLAGS" => "-I#{install_dir}/embedded/include -
|
721
|
+
"CFLAGS" => "-I#{install_dir}/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
722
722
|
}
|
723
723
|
when "windows"
|
724
724
|
arch_flag = windows_arch_i386? ? "-m32" : "-m64"
|
@@ -739,7 +739,7 @@ module Omnibus
|
|
739
739
|
else
|
740
740
|
{
|
741
741
|
"LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
|
742
|
-
"CFLAGS" => "-I#{install_dir}/embedded/include -
|
742
|
+
"CFLAGS" => "-I#{install_dir}/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
743
743
|
}
|
744
744
|
end
|
745
745
|
|
data/lib/omnibus/version.rb
CHANGED
data/lib/omnibus/whitelist.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
# Copyright
|
2
|
+
# Copyright:: Copyright (c) Chef Software Inc.
|
3
3
|
#
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
5
|
# you may not use this file except in compliance with the License.
|
@@ -49,12 +49,18 @@ ARCH_WHITELIST_LIBS = [
|
|
49
49
|
].freeze
|
50
50
|
|
51
51
|
AIX_WHITELIST_LIBS = [
|
52
|
+
/libc\.a/,
|
53
|
+
/libcfg\.a/,
|
54
|
+
/libcorcfg\.a/,
|
55
|
+
/libcrypt\.a/,
|
56
|
+
/libdl\.a/,
|
57
|
+
/liblvm\.a/,
|
58
|
+
/libodm\.a/,
|
59
|
+
/libperfstat\.a/,
|
52
60
|
/libpthread\.a/,
|
53
61
|
/libpthreads\.a/,
|
54
|
-
/libdl.a/,
|
55
62
|
/librtl\.a/,
|
56
|
-
/
|
57
|
-
/libcrypt\.a/,
|
63
|
+
/libsrc\.a/,
|
58
64
|
/unix$/,
|
59
65
|
].freeze
|
60
66
|
|
@@ -162,6 +168,7 @@ MAC_WHITELIST_LIBS = [
|
|
162
168
|
/libc\+\+\.1\.dylib/,
|
163
169
|
/libzstd\.1\.dylib/,
|
164
170
|
/Security/,
|
171
|
+
/SystemConfiguration/,
|
165
172
|
].freeze
|
166
173
|
|
167
174
|
FREEBSD_WHITELIST_LIBS = [
|
@@ -176,28 +183,34 @@ FREEBSD_WHITELIST_LIBS = [
|
|
176
183
|
/libkvm\.so/,
|
177
184
|
/libprocstat\.so/,
|
178
185
|
/libmd\.so/,
|
186
|
+
/libdl\.so/,
|
179
187
|
].freeze
|
180
188
|
|
181
189
|
IGNORED_ENDINGS = %w{
|
182
190
|
.TXT
|
183
|
-
.[ch]
|
184
|
-
.[ch]pp
|
185
|
-
.[eh]rl
|
186
191
|
.app
|
187
192
|
.appup
|
188
193
|
.bat
|
189
194
|
.beam
|
195
|
+
.c
|
190
196
|
.cc
|
191
197
|
.cmake
|
192
198
|
.conf
|
199
|
+
.cpp
|
193
200
|
.css
|
194
|
-
.
|
201
|
+
.erb
|
202
|
+
.erl
|
195
203
|
.feature
|
196
204
|
.gemspec
|
197
205
|
.gif
|
198
206
|
.gitignore
|
199
207
|
.gitkeep
|
200
|
-
.h
|
208
|
+
.h
|
209
|
+
.h
|
210
|
+
.hh
|
211
|
+
.hpp
|
212
|
+
.hrl
|
213
|
+
.html
|
201
214
|
.jar
|
202
215
|
.java
|
203
216
|
.jpg
|
@@ -209,6 +222,7 @@ IGNORED_ENDINGS = %w{
|
|
209
222
|
.lua
|
210
223
|
.md
|
211
224
|
.mkd
|
225
|
+
.mo
|
212
226
|
.npmignore
|
213
227
|
.out
|
214
228
|
.packlist
|
@@ -218,21 +232,28 @@ IGNORED_ENDINGS = %w{
|
|
218
232
|
.png
|
219
233
|
.pod
|
220
234
|
.properties
|
221
|
-
.py
|
222
|
-
.
|
235
|
+
.py
|
236
|
+
.pyc
|
237
|
+
.pyo
|
223
238
|
.rake
|
239
|
+
.rb
|
240
|
+
.rbs
|
224
241
|
.rdoc
|
242
|
+
.rhtml
|
225
243
|
.ri
|
244
|
+
.rpm
|
226
245
|
.rst
|
227
246
|
.scss
|
228
247
|
.sh
|
229
248
|
.sql
|
230
249
|
.svg
|
231
250
|
.toml
|
251
|
+
.tt
|
232
252
|
.ttf
|
233
253
|
.txt
|
234
254
|
.xml
|
235
255
|
.yml
|
256
|
+
COPYING
|
236
257
|
Gemfile
|
237
258
|
LICENSE
|
238
259
|
Makefile
|
@@ -242,7 +263,7 @@ IGNORED_ENDINGS = %w{
|
|
242
263
|
license
|
243
264
|
}.freeze
|
244
265
|
|
245
|
-
|
266
|
+
IGNORED_SUBSTRINGS = %w{
|
246
267
|
/build_info/
|
247
268
|
/licenses/
|
248
269
|
/LICENSES/
|
data/omnibus.gemspec
CHANGED
@@ -25,17 +25,18 @@ Gem::Specification.new do |gem|
|
|
25
25
|
gem.add_dependency "chef-cleanroom", "~> 1.0"
|
26
26
|
gem.add_dependency "ffi-yajl", "~> 2.2"
|
27
27
|
gem.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
|
28
|
-
gem.add_dependency "ohai", ">= 15"
|
28
|
+
gem.add_dependency "ohai", ">= 15", "< 18"
|
29
29
|
gem.add_dependency "ruby-progressbar", "~> 1.7"
|
30
30
|
gem.add_dependency "thor", ">= 0.18", "< 2.0"
|
31
31
|
gem.add_dependency "license_scout", "~> 1.0"
|
32
|
+
gem.add_dependency "contracts", ">= 0.16.0", "< 0.17.0"
|
32
33
|
|
33
34
|
gem.add_dependency "mixlib-versioning"
|
34
35
|
gem.add_dependency "pedump"
|
35
36
|
|
36
37
|
gem.add_development_dependency "artifactory", "~> 3.0"
|
37
|
-
gem.add_development_dependency "aruba", "~> 0
|
38
|
-
gem.add_development_dependency "chefstyle", "= 1.5
|
38
|
+
gem.add_development_dependency "aruba", "~> 2.0"
|
39
|
+
gem.add_development_dependency "chefstyle", "= 1.7.5"
|
39
40
|
gem.add_development_dependency "fauxhai-ng", ">= 7.5"
|
40
41
|
gem.add_development_dependency "rspec", "~> 3.0"
|
41
42
|
gem.add_development_dependency "rspec-json_expectations"
|
Binary file
|
@@ -7,7 +7,7 @@
|
|
7
7
|
|
8
8
|
<!-- Generated by productbuild - - synthesize -->
|
9
9
|
<pkg-ref id="<%= identifier %>"/>
|
10
|
-
<options customize="never" require-scripts="false"/>
|
10
|
+
<options customize="never" require-scripts="false" hostArchitectures="<%= host_architecture %>" />
|
11
11
|
<choices-outline>
|
12
12
|
<line choice="default">
|
13
13
|
<line choice="<%= identifier %>"/>
|
data/resources/rpm/spec.erb
CHANGED
@@ -8,11 +8,14 @@
|
|
8
8
|
%define __spec_clean_post true
|
9
9
|
%define __spec_clean_pre true
|
10
10
|
|
11
|
-
# Use
|
12
|
-
%define _binary_filedigest_algorithm
|
11
|
+
# Use SHA256 checksums for all files
|
12
|
+
%define _binary_filedigest_algorithm 8
|
13
13
|
|
14
14
|
%define _binary_payload <%= compression %>
|
15
15
|
|
16
|
+
# Disable creation of build-id links
|
17
|
+
%define _build_id_links none
|
18
|
+
|
16
19
|
# Metadata
|
17
20
|
Name: <%= name %>
|
18
21
|
Version: <%= version %>
|
@@ -127,17 +127,8 @@ module Omnibus
|
|
127
127
|
end
|
128
128
|
end
|
129
129
|
|
130
|
-
|
131
|
-
|
132
|
-
let(:source_md5) { "577dbe528415c6f178a9431fd0554df4" }
|
133
|
-
|
134
|
-
it "extracts the asset without crashing" do
|
135
|
-
subject.clean
|
136
|
-
expect(extracted).to_not be_a_file
|
137
|
-
subject.clean
|
138
|
-
expect(extracted).to_not be_a_file
|
139
|
-
end
|
140
|
-
end
|
130
|
+
# we need to find a new test fixture because this one no longer exists
|
131
|
+
# context "when the source has read-only files"
|
141
132
|
|
142
133
|
context "when the source has broken symlinks" do
|
143
134
|
let(:source_url) { "http://www.openssl.org/source/openssl-1.0.1q.tar.gz" }
|
data/spec/unit/builder_spec.rb
CHANGED
@@ -3,8 +3,8 @@ require "spec_helper"
|
|
3
3
|
module Omnibus
|
4
4
|
describe Compressor do
|
5
5
|
describe ".for_current_system" do
|
6
|
-
context "on
|
7
|
-
before { stub_ohai(platform: "mac_os_x"
|
6
|
+
context "on macOS" do
|
7
|
+
before { stub_ohai(platform: "mac_os_x") }
|
8
8
|
|
9
9
|
context "when :dmg is activated" do
|
10
10
|
it "prefers dmg" do
|
@@ -190,7 +190,7 @@ module Omnibus
|
|
190
190
|
|
191
191
|
expect(contents).to include('set found_disk to do shell script "ls /Volumes/ | grep \'Project One*\'"')
|
192
192
|
expect(contents).to include(" set the bounds of Finder window 1 to {100, 100, 750, 600}")
|
193
|
-
expect(contents).to include(' set position of item "project-1.2.3-2.pkg" of container window to {535, 50}')
|
193
|
+
expect(contents).to include(' set position of item "project-1.2.3-2.x86_64.pkg" of container window to {535, 50}')
|
194
194
|
end
|
195
195
|
|
196
196
|
it "runs the apple script" do
|
@@ -219,8 +219,8 @@ module Omnibus
|
|
219
219
|
sync
|
220
220
|
hdiutil unmount "#{device}"
|
221
221
|
# Give some time to the system so unmount dmg
|
222
|
-
ATTEMPTS=
|
223
|
-
until [ $ATTEMPTS -eq
|
222
|
+
ATTEMPTS=1
|
223
|
+
until [ $ATTEMPTS -eq 6 ] || hdiutil detach "/dev/sda1"; do
|
224
224
|
sleep 10
|
225
225
|
echo Attempt number $(( ATTEMPTS++ ))
|
226
226
|
done
|
@@ -229,7 +229,7 @@ module Omnibus
|
|
229
229
|
-format UDZO \\
|
230
230
|
-imagekey \\
|
231
231
|
zlib-level=9 \\
|
232
|
-
-o "#{package_dir}/project-1.2.3-2.dmg" \\
|
232
|
+
-o "#{package_dir}/project-1.2.3-2.x86_64.dmg" \\
|
233
233
|
-puppetstrings
|
234
234
|
EOH
|
235
235
|
|
@@ -247,7 +247,7 @@ module Omnibus
|
|
247
247
|
expect(subject).to receive(:shellout!)
|
248
248
|
.with <<-EOH.gsub(/^ {12}/, "")
|
249
249
|
hdiutil verify \\
|
250
|
-
"#{package_dir}/project-1.2.3-2.dmg" \\
|
250
|
+
"#{package_dir}/project-1.2.3-2.x86_64.dmg" \\
|
251
251
|
-puppetstrings
|
252
252
|
EOH
|
253
253
|
|
@@ -289,10 +289,10 @@ module Omnibus
|
|
289
289
|
DeRez -only icns "#{icon}" > tmp.rsrc
|
290
290
|
|
291
291
|
# Append the icon reosurce to the DMG
|
292
|
-
Rez -append tmp.rsrc -o "#{package_dir}/project-1.2.3-2.dmg"
|
292
|
+
Rez -append tmp.rsrc -o "#{package_dir}/project-1.2.3-2.x86_64.dmg"
|
293
293
|
|
294
294
|
# Source the icon
|
295
|
-
SetFile -a C "#{package_dir}/project-1.2.3-2.dmg"
|
295
|
+
SetFile -a C "#{package_dir}/project-1.2.3-2.x86_64.dmg"
|
296
296
|
EOH
|
297
297
|
|
298
298
|
subject.set_dmg_icon
|
@@ -301,11 +301,11 @@ module Omnibus
|
|
301
301
|
|
302
302
|
describe "#package_name" do
|
303
303
|
it "reflects the packager's unmodified package_name" do
|
304
|
-
expect(subject.package_name).to eq("project-1.2.3-2.dmg")
|
304
|
+
expect(subject.package_name).to eq("project-1.2.3-2.x86_64.dmg")
|
305
305
|
end
|
306
306
|
|
307
307
|
it "reflects the packager's modified package_name" do
|
308
|
-
package_basename = "projectsub-1.2.3-3"
|
308
|
+
package_basename = "projectsub-1.2.3-3.x86_64"
|
309
309
|
allow(project.packagers_for_system[0]).to receive(:package_name)
|
310
310
|
.and_return("#{package_basename}.pkg")
|
311
311
|
|
@@ -38,25 +38,25 @@ module Omnibus
|
|
38
38
|
|
39
39
|
describe "#package_name" do
|
40
40
|
it "returns the name of the packager" do
|
41
|
-
expect(subject.package_name).to eq("project-1.2.3-2.pkg.tar.gz")
|
41
|
+
expect(subject.package_name).to eq("project-1.2.3-2.x86_64.pkg.tar.gz")
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "#write_tgz" do
|
46
46
|
before do
|
47
|
-
File.open("#{staging_dir}/project-1.2.3-2.pkg", "wb") do |f|
|
47
|
+
File.open("#{staging_dir}/project-1.2.3-2.x86_64.pkg", "wb") do |f|
|
48
48
|
f.write " " * 1_000_000
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
it "generates the file" do
|
53
53
|
subject.write_tgz
|
54
|
-
expect("#{staging_dir}/project-1.2.3-2.pkg.tar.gz").to be_a_file
|
54
|
+
expect("#{staging_dir}/project-1.2.3-2.x86_64.pkg.tar.gz").to be_a_file
|
55
55
|
end
|
56
56
|
|
57
57
|
it "has the correct content" do
|
58
58
|
subject.write_tgz
|
59
|
-
file = File.open("#{staging_dir}/project-1.2.3-2.pkg.tar.gz", "rb")
|
59
|
+
file = File.open("#{staging_dir}/project-1.2.3-2.x86_64.pkg.tar.gz", "rb")
|
60
60
|
contents = file.read
|
61
61
|
file.close
|
62
62
|
|
@@ -278,6 +278,10 @@ module Omnibus
|
|
278
278
|
|
279
279
|
let(:cumulative_downloaded_length) { 100 }
|
280
280
|
|
281
|
+
let(:uri_open_target) do
|
282
|
+
RUBY_VERSION.to_f < 2.7 ? subject : URI
|
283
|
+
end
|
284
|
+
|
281
285
|
def capturing_stdout
|
282
286
|
old_stdout, $stdout = $stdout, progress_bar_output
|
283
287
|
yield
|
@@ -286,7 +290,7 @@ module Omnibus
|
|
286
290
|
end
|
287
291
|
|
288
292
|
before do
|
289
|
-
expect(
|
293
|
+
expect(uri_open_target).to receive(:open).with(source[:url], expected_open_opts) do |_url, open_uri_opts|
|
290
294
|
open_uri_opts[:content_length_proc].call(reported_content_length)
|
291
295
|
open_uri_opts[:progress_proc].call(cumulative_downloaded_length)
|
292
296
|
|
@@ -99,9 +99,47 @@ module Omnibus
|
|
99
99
|
context "on linux" do
|
100
100
|
before { stub_ohai(platform: "ubuntu", version: "16.04") }
|
101
101
|
|
102
|
+
# file_list just needs to have one file which is inside of the install_dir
|
103
|
+
let(:file_list) do
|
104
|
+
double("Mixlib::Shellout",
|
105
|
+
error!: false,
|
106
|
+
stdout: <<~EOH
|
107
|
+
/opt/chefdk/shouldnt/matter
|
108
|
+
EOH
|
109
|
+
)
|
110
|
+
end
|
111
|
+
|
112
|
+
let(:empty_list) do
|
113
|
+
double("Mixlib::Shellout",
|
114
|
+
error!: false,
|
115
|
+
stdout: <<~EOH
|
116
|
+
EOH
|
117
|
+
)
|
118
|
+
end
|
119
|
+
|
120
|
+
let(:failed_list) do
|
121
|
+
failed_list = double("Mixlib::Shellout",
|
122
|
+
stdout: <<~EOH
|
123
|
+
/opt/chefdk/shouldnt/matter
|
124
|
+
EOH
|
125
|
+
)
|
126
|
+
allow(failed_list).to receive(:error!).and_raise("Mixlib::Shellout::ShellCommandFailed")
|
127
|
+
failed_list
|
128
|
+
end
|
129
|
+
|
130
|
+
let(:bad_list) do
|
131
|
+
double("Mixlib::Shellout",
|
132
|
+
error!: false,
|
133
|
+
stdout: <<~EOH
|
134
|
+
/somewhere/other/than/install/dir
|
135
|
+
EOH
|
136
|
+
)
|
137
|
+
end
|
138
|
+
|
102
139
|
let(:bad_healthcheck) do
|
103
140
|
double("Mixlib::Shellout",
|
104
|
-
|
141
|
+
error!: false,
|
142
|
+
stdout: <<~EOH
|
105
143
|
/bin/ls:
|
106
144
|
linux-vdso.so.1 => (0x00007fff583ff000)
|
107
145
|
libselinux.so.1 => /lib/x86_64-linux-gnu/libselinux.so.1 (0x00007fad8592a000)
|
@@ -122,7 +160,8 @@ module Omnibus
|
|
122
160
|
|
123
161
|
let(:good_healthcheck) do
|
124
162
|
double("Mixlib::Shellout",
|
125
|
-
|
163
|
+
error!: false,
|
164
|
+
stdout: <<~EOH
|
126
165
|
/bin/echo:
|
127
166
|
linux-vdso.so.1 => (0x00007fff8a6ee000)
|
128
167
|
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f70f58c0000)
|
@@ -135,11 +174,13 @@ module Omnibus
|
|
135
174
|
)
|
136
175
|
end
|
137
176
|
|
138
|
-
let(:regexp) { ".*(\\.TXT|\\.[ch]|\\.[ch]pp|\\.[eh]rl|\\.app|\\.appup|\\.bat|\\.beam|\\.cc|\\.cmake|\\.conf|\\.css|\\.e*rb|\\.feature|\\.gemspec|\\.gif|\\.gitignore|\\.gitkeep|\\.h*h|\\.jar|\\.java|\\.jpg|\\.js|\\.jsm|\\.json|\\.lock|\\.log|\\.lua|\\.md|\\.mkd|\\.npmignore|\\.out|\\.packlist|\\.perl|\\.pl|\\.pm|\\.png|\\.pod|\\.properties|\\.py[oc]*|\\.r*html|\\.rake|\\.rdoc|\\.ri|\\.rst|\\.scss|\\.sh|\\.sql|\\.svg|\\.toml|\\.ttf|\\.txt|\\.xml|\\.yml|Gemfile|LICENSE|Makefile|README|Rakefile|VERSION|license)$|.*\\/build_info\\/.*|.*\\/licenses\\/.*|.*\\/LICENSES\\/.*|.*\\/man\\/.*|.*\\/share\\/doc\\/.*|.*\\/share\\/info\\/.*|.*\\/share\\/postgresql\\/.*|.*\\/share\\/terminfo\\/.*|.*\\/share\\/timezone\\/.*|.*\\/terminfo\\/.*" }
|
139
|
-
|
140
177
|
it "raises an exception when there are external dependencies" do
|
141
178
|
allow(subject).to receive(:shellout)
|
142
|
-
.with("find
|
179
|
+
.with("find /opt/chefdk/ -type f | xargs file | grep \"ELF\" | awk -F: '{print $1}' | sed -e 's/:$//'")
|
180
|
+
.and_return(file_list)
|
181
|
+
|
182
|
+
allow(subject).to receive(:shellout)
|
183
|
+
.with("xargs ldd", { input: "/opt/chefdk/shouldnt/matter\n" })
|
143
184
|
.and_return(bad_healthcheck)
|
144
185
|
|
145
186
|
expect { subject.run! }.to raise_error(HealthCheckFailed)
|
@@ -147,7 +188,11 @@ module Omnibus
|
|
147
188
|
|
148
189
|
it "does not raise an exception when the healthcheck passes" do
|
149
190
|
allow(subject).to receive(:shellout)
|
150
|
-
.with("find
|
191
|
+
.with("find /opt/chefdk/ -type f | xargs file | grep \"ELF\" | awk -F: '{print $1}' | sed -e 's/:$//'")
|
192
|
+
.and_return(file_list)
|
193
|
+
|
194
|
+
allow(subject).to receive(:shellout)
|
195
|
+
.with("xargs ldd", { input: "/opt/chefdk/shouldnt/matter\n" })
|
151
196
|
.and_return(good_healthcheck)
|
152
197
|
|
153
198
|
expect { subject.run! }.to_not raise_error
|
@@ -156,6 +201,30 @@ module Omnibus
|
|
156
201
|
it "will not perform dll base relocation checks" do
|
157
202
|
expect(subject.relocation_checkable?).to be false
|
158
203
|
end
|
204
|
+
|
205
|
+
it "raises an exception if there's nothing in the file list" do
|
206
|
+
allow(subject).to receive(:shellout)
|
207
|
+
.with("find /opt/chefdk/ -type f | xargs file | grep \"ELF\" | awk -F: '{print $1}' | sed -e 's/:$//'")
|
208
|
+
.and_return(empty_list)
|
209
|
+
|
210
|
+
expect { subject.run! }.to raise_error(RuntimeError, "Internal Error: Health Check found no lines")
|
211
|
+
end
|
212
|
+
|
213
|
+
it "raises an exception if the file list command raises" do
|
214
|
+
allow(subject).to receive(:shellout)
|
215
|
+
.with("find /opt/chefdk/ -type f | xargs file | grep \"ELF\" | awk -F: '{print $1}' | sed -e 's/:$//'")
|
216
|
+
.and_return(failed_list)
|
217
|
+
|
218
|
+
expect { subject.run! }.to raise_error(RuntimeError, "Mixlib::Shellout::ShellCommandFailed")
|
219
|
+
end
|
220
|
+
|
221
|
+
it "raises an exception if the file list command has no entries in the install_dir" do
|
222
|
+
allow(subject).to receive(:shellout)
|
223
|
+
.with("find /opt/chefdk/ -type f | xargs file | grep \"ELF\" | awk -F: '{print $1}' | sed -e 's/:$//'")
|
224
|
+
.and_return(bad_list)
|
225
|
+
|
226
|
+
expect { subject.run! }.to raise_error(RuntimeError, "Internal Error: Health Check lines not matching the install_dir")
|
227
|
+
end
|
159
228
|
end
|
160
229
|
end
|
161
230
|
end
|
data/spec/unit/metadata_spec.rb
CHANGED
@@ -218,6 +218,8 @@ module Omnibus
|
|
218
218
|
it_behaves_like "a version manipulator", "gentoo", "4.9.95-gentoo", "rolling"
|
219
219
|
it_behaves_like "a version manipulator", "kali", "rolling", "rolling"
|
220
220
|
it_behaves_like "a version manipulator", "mac_os_x", "10.9.1", "10.9"
|
221
|
+
it_behaves_like "a version manipulator", "mac_os_x", "10.15.7", "10.15"
|
222
|
+
it_behaves_like "a version manipulator", "mac_os_x", "11.2.1", "11"
|
221
223
|
it_behaves_like "a version manipulator", "omnios", "r151010", "r151010"
|
222
224
|
it_behaves_like "a version manipulator", "openbsd", "5.4.4", "5.4"
|
223
225
|
it_behaves_like "a version manipulator", "opensuseleap", "42.3", "42.3"
|
data/spec/unit/packager_spec.rb
CHANGED
@@ -3,8 +3,8 @@ require "spec_helper"
|
|
3
3
|
module Omnibus
|
4
4
|
describe Packager do
|
5
5
|
describe ".for_current_system" do
|
6
|
-
context "on
|
7
|
-
before { stub_ohai(platform: "mac_os_x"
|
6
|
+
context "on macOS" do
|
7
|
+
before { stub_ohai(platform: "mac_os_x") }
|
8
8
|
it "prefers PKG" do
|
9
9
|
expect(described_class.for_current_system).to eq([Packager::PKG])
|
10
10
|
end
|