omnibus 8.2.2 → 9.0.8
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/lib/omnibus/config.rb +3 -1
- data/lib/omnibus/fetchers/net_fetcher.rb +2 -11
- data/lib/omnibus/health_check.rb +152 -38
- data/lib/omnibus/metadata.rb +1 -1
- data/lib/omnibus/packagers/pkg.rb +10 -12
- data/lib/omnibus/project.rb +1 -1
- data/lib/omnibus/software.rb +1 -1
- data/lib/omnibus/version.rb +1 -1
- data/lib/omnibus/whitelist.rb +38 -12
- data/omnibus.gemspec +3 -2
- data/resources/rpm/spec.erb +3 -0
- data/spec/functional/builder_spec.rb +1 -1
- data/spec/support/examples.rb +1 -1
- data/spec/support/ohai_helpers.rb +1 -1
- data/spec/unit/builder_spec.rb +19 -19
- data/spec/unit/fetchers/net_fetcher_spec.rb +14 -14
- data/spec/unit/health_check_spec.rb +75 -6
- data/spec/unit/packagers/pkg_spec.rb +9 -3
- data/spec/unit/project_spec.rb +1 -1
- data/spec/unit/software_spec.rb +6 -6
- metadata +20 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f05719c1cecdc2defbb5641b5a61517b84f88a844932ca0568e3b435997e6fd9
|
4
|
+
data.tar.gz: 7593e4150d3222b368a722f84f92755a4f246e2a31fc8bdb72b8bc9495c42420
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb4cd2da9b1baab9d1b2555f498d0efdf71627a0a8686654ebdab0e1da8546004b48215ac907e768c964409f8f08caa0a91cd75d664de76d8b7607f509795c5c
|
7
|
+
data.tar.gz: e1a6e11eac83c8e192c2468fbd457b20eacecca8d0aa7c2e286f77cdc1357cba4a9cb1618c0c03014fb7fdb4d7f9bfd346036abe277abed169d1b26f74f833e7
|
data/lib/omnibus/config.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.
|
@@ -15,6 +15,7 @@
|
|
15
15
|
#
|
16
16
|
|
17
17
|
require "singleton" unless defined?(Singleton)
|
18
|
+
require "omnibus/sugarable" unless defined?(Sugarable)
|
18
19
|
|
19
20
|
module Omnibus
|
20
21
|
class Config
|
@@ -22,6 +23,7 @@ module Omnibus
|
|
22
23
|
include NullArgumentable
|
23
24
|
include Singleton
|
24
25
|
include Util
|
26
|
+
include Sugarable
|
25
27
|
|
26
28
|
class << self
|
27
29
|
#
|
@@ -212,7 +212,7 @@ module Omnibus
|
|
212
212
|
# :seven_zip - use 7zip for all tar/compressed tar files on windows.
|
213
213
|
# :lax_tar - use tar.exe on windows but ignore errors.
|
214
214
|
#
|
215
|
-
#
|
215
|
+
# 7z has issues on windows.
|
216
216
|
#
|
217
217
|
# 7z cannot extract and untar at the same time. You need to extract to a
|
218
218
|
# temporary location and then extract again into project_dir.
|
@@ -221,15 +221,6 @@ module Omnibus
|
|
221
221
|
# location simply results in a text file with the target path written in
|
222
222
|
# it. It does this without throwing any errors.
|
223
223
|
#
|
224
|
-
# bsdtar will exit(1) if it is encounters symlinks on windows. So we can't
|
225
|
-
# use shellout! directly.
|
226
|
-
#
|
227
|
-
# bsdtar will also exit(1) and fail to overwrite files at the destination
|
228
|
-
# during extraction if a file already exists at the destination and is
|
229
|
-
# marked read-only. This used to be a problem when we weren't properly
|
230
|
-
# cleaning an existing project_dir. It should be less of a problem now...
|
231
|
-
# but who knows.
|
232
|
-
#
|
233
224
|
def extract
|
234
225
|
# Only used by tar
|
235
226
|
compression_switch = ""
|
@@ -243,7 +234,7 @@ module Omnibus
|
|
243
234
|
returns = [0]
|
244
235
|
returns << 1 if source[:extract] == :lax_tar
|
245
236
|
|
246
|
-
shellout!("tar #{compression_switch}xf #{
|
237
|
+
shellout!("tar #{compression_switch}xf #{downloaded_file} --force-local -C#{project_dir}", returns: returns)
|
247
238
|
elsif downloaded_file.end_with?(*COMPRESSED_TAR_EXTENSIONS)
|
248
239
|
Dir.mktmpdir do |temp_dir|
|
249
240
|
log.debug(log_key) { "Temporarily extracting `#{safe_downloaded_file}' to `#{temp_dir}'" }
|
data/lib/omnibus/health_check.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.
|
@@ -66,20 +66,25 @@ module Omnibus
|
|
66
66
|
def run!
|
67
67
|
measure("Health check time") do
|
68
68
|
log.info(log_key) { "Running health on #{project.name}" }
|
69
|
-
bad_libs =
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
69
|
+
bad_libs, good_libs =
|
70
|
+
case Ohai["platform"]
|
71
|
+
when "mac_os_x"
|
72
|
+
health_check_otool
|
73
|
+
when "aix"
|
74
|
+
health_check_aix
|
75
|
+
when "windows"
|
76
|
+
# TODO: objdump -p will provided a very limited check of
|
77
|
+
# explicit dependencies on windows. Most dependencies are
|
78
|
+
# implicit and hence not detected.
|
79
|
+
log.warn(log_key) { "Skipping dependency health checks on Windows." }
|
80
|
+
[{}, {}]
|
81
|
+
when "solaris2"
|
82
|
+
health_check_solaris
|
83
|
+
when "freebsd", "openbsd", "netbsd"
|
84
|
+
health_check_freebsd
|
85
|
+
else
|
86
|
+
health_check_linux
|
87
|
+
end
|
83
88
|
|
84
89
|
unresolved = []
|
85
90
|
unreliable = []
|
@@ -167,6 +172,10 @@ module Omnibus
|
|
167
172
|
raise HealthCheckFailed
|
168
173
|
end
|
169
174
|
|
175
|
+
if good_libs.keys.length == 0 && !windows?
|
176
|
+
raise "Internal error: no good libraries were found"
|
177
|
+
end
|
178
|
+
|
170
179
|
conflict_map = {}
|
171
180
|
|
172
181
|
conflict_map = relocation_check if relocation_checkable?
|
@@ -280,19 +289,20 @@ module Omnibus
|
|
280
289
|
def health_check_otool
|
281
290
|
current_library = nil
|
282
291
|
bad_libs = {}
|
292
|
+
good_libs = {}
|
283
293
|
|
284
|
-
read_shared_libs("find #{project.install_dir}/ -type f | egrep '\.(dylib|bundle)$'
|
294
|
+
read_shared_libs("find #{project.install_dir}/ -type f | egrep '\.(dylib|bundle)$'", "xargs otool -L") do |line|
|
285
295
|
case line
|
286
296
|
when /^(.+):$/
|
287
297
|
current_library = Regexp.last_match[1]
|
288
298
|
when /^\s+(.+) \(.+\)$/
|
289
299
|
linked = Regexp.last_match[1]
|
290
300
|
name = File.basename(linked)
|
291
|
-
bad_libs = check_for_bad_library(bad_libs, current_library, name, linked)
|
301
|
+
bad_libs, good_libs = check_for_bad_library(bad_libs, good_libs, current_library, name, linked)
|
292
302
|
end
|
293
303
|
end
|
294
304
|
|
295
|
-
bad_libs
|
305
|
+
[bad_libs, good_libs]
|
296
306
|
end
|
297
307
|
|
298
308
|
#
|
@@ -304,8 +314,9 @@ module Omnibus
|
|
304
314
|
def health_check_aix
|
305
315
|
current_library = nil
|
306
316
|
bad_libs = {}
|
317
|
+
good_libs = {}
|
307
318
|
|
308
|
-
read_shared_libs("find #{project.install_dir}/ -type f | xargs file | grep \"
|
319
|
+
read_shared_libs("find #{project.install_dir}/ -type f | xargs file | grep \"XCOFF\" | awk -F: '{print $1}'", "xargs -n 1 ldd") do |line|
|
309
320
|
case line
|
310
321
|
when /^(.+) needs:$/
|
311
322
|
current_library = Regexp.last_match[1]
|
@@ -313,31 +324,68 @@ module Omnibus
|
|
313
324
|
when /^\s+(.+)$/
|
314
325
|
name = Regexp.last_match[1]
|
315
326
|
linked = Regexp.last_match[1]
|
316
|
-
bad_libs = check_for_bad_library(bad_libs, current_library, name, linked)
|
327
|
+
( bad_libs, good_libs ) = check_for_bad_library(bad_libs, good_libs, current_library, name, linked)
|
317
328
|
when /File is not an executable XCOFF file/ # ignore non-executable files
|
318
329
|
else
|
319
330
|
log.warn(log_key) { "Line did not match for #{current_library}\n#{line}" }
|
320
331
|
end
|
321
332
|
end
|
322
333
|
|
323
|
-
bad_libs
|
334
|
+
[bad_libs, good_libs]
|
324
335
|
end
|
325
336
|
|
326
337
|
#
|
327
|
-
# Run healthchecks
|
338
|
+
# Run healthchecks on Solaris.
|
328
339
|
#
|
329
340
|
# @return [Hash<String, Hash<String, Hash<String, Int>>>]
|
330
341
|
# the bad libraries (library_name -> dependency_name -> satisfied_lib_path -> count)
|
331
342
|
#
|
332
|
-
def
|
333
|
-
|
334
|
-
|
335
|
-
|
343
|
+
def health_check_solaris
|
344
|
+
current_library = nil
|
345
|
+
bad_libs = {}
|
346
|
+
good_libs = {}
|
347
|
+
|
348
|
+
# The case/when below depends on the "current_library" being output with a : at the end
|
349
|
+
# and then the dependencies on subsequent lines in the form "library.so.1 => /lib/64/library.so.1"
|
350
|
+
# This output format only happens if ldd is passed multiple libraries (for Solaris, similar to Linux)
|
351
|
+
# FIXME if any of the `when` clauses in the `health_check_*` methods run before the `current_library`
|
352
|
+
# they probably should error out with an explicit callout of formatting with their environment's
|
353
|
+
# respective ldd parsing
|
354
|
+
read_shared_libs("find #{project.install_dir}/ -type f | xargs file | grep \"ELF\" | awk -F: '{print $1}' | sed -e 's/:$//'", "xargs ldd") do |line|
|
355
|
+
case line
|
356
|
+
when /^(.+):$/
|
357
|
+
current_library = Regexp.last_match[1]
|
358
|
+
when /^\s+(.+) \=\>\s+(.+)( \(.+\))?$/
|
359
|
+
name = Regexp.last_match[1]
|
360
|
+
linked = Regexp.last_match[2]
|
361
|
+
( bad_libs, good_libs ) = check_for_bad_library(bad_libs, good_libs, current_library, name, linked)
|
362
|
+
when /^\s+(.+) \(.+\)$/
|
363
|
+
next
|
364
|
+
when /^\s+statically linked$/
|
365
|
+
next
|
366
|
+
when /^\s+not a dynamic executable$/ # ignore non-executable files
|
367
|
+
else
|
368
|
+
log.warn(log_key) do
|
369
|
+
"Line did not match for #{current_library}\n#{line}"
|
370
|
+
end
|
371
|
+
end
|
372
|
+
end
|
336
373
|
|
374
|
+
[bad_libs, good_libs]
|
375
|
+
end
|
376
|
+
|
377
|
+
#
|
378
|
+
# Run healthchecks on FreeBSD
|
379
|
+
#
|
380
|
+
# @return [Hash<String, Hash<String, Hash<String, Int>>>]
|
381
|
+
# the bad libraries (library_name -> dependency_name -> satisfied_lib_path -> count)
|
382
|
+
#
|
383
|
+
def health_check_freebsd
|
337
384
|
current_library = nil
|
338
385
|
bad_libs = {}
|
386
|
+
good_libs = {}
|
339
387
|
|
340
|
-
read_shared_libs("find #{project.install_dir}/ -type f
|
388
|
+
read_shared_libs("find #{project.install_dir}/ -type f | xargs file | grep \"ELF\" | awk -F: '{print $1}' | sed -e 's/:$//'", "xargs ldd") do |line|
|
341
389
|
case line
|
342
390
|
when /^(.+):$/
|
343
391
|
current_library = Regexp.last_match[1]
|
@@ -345,16 +393,51 @@ module Omnibus
|
|
345
393
|
when /^\s+(.+) \=\>\s+(.+)( \(.+\))?$/
|
346
394
|
name = Regexp.last_match[1]
|
347
395
|
linked = Regexp.last_match[2]
|
348
|
-
bad_libs = check_for_bad_library(bad_libs, current_library, name, linked)
|
396
|
+
( bad_libs, good_libs ) = check_for_bad_library(bad_libs, good_libs, current_library, name, linked)
|
349
397
|
when /^\s+(.+) \(.+\)$/
|
350
398
|
next
|
351
399
|
when /^\s+statically linked$/
|
352
400
|
next
|
353
|
-
when /^\s+
|
401
|
+
when /^\s+not a dynamic executable$/ # ignore non-executable files
|
402
|
+
else
|
403
|
+
log.warn(log_key) do
|
404
|
+
"Line did not match for #{current_library}\n#{line}"
|
405
|
+
end
|
406
|
+
end
|
407
|
+
end
|
408
|
+
|
409
|
+
[bad_libs, good_libs]
|
410
|
+
end
|
411
|
+
|
412
|
+
#
|
413
|
+
# Run healthchecks against ldd.
|
414
|
+
#
|
415
|
+
# @return [Hash<String, Hash<String, Hash<String, Int>>>]
|
416
|
+
# the bad libraries (library_name -> dependency_name -> satisfied_lib_path -> count)
|
417
|
+
#
|
418
|
+
def health_check_linux
|
419
|
+
current_library = nil
|
420
|
+
bad_libs = {}
|
421
|
+
good_libs = {}
|
422
|
+
|
423
|
+
read_shared_libs("find #{project.install_dir}/ -type f | xargs file | grep \"ELF\" | awk -F: '{print $1}' | sed -e 's/:$//'", "xargs ldd") do |line|
|
424
|
+
case line
|
425
|
+
when /^(.+):$/
|
426
|
+
current_library = Regexp.last_match[1]
|
427
|
+
log.debug(log_key) { "Analyzing dependencies for #{current_library}" }
|
428
|
+
when /^\s+(.+) \=\>\s+(.+)( \(.+\))?$/
|
429
|
+
name = Regexp.last_match[1]
|
430
|
+
linked = Regexp.last_match[2]
|
431
|
+
( bad_libs, good_libs ) = check_for_bad_library(bad_libs, good_libs, current_library, name, linked)
|
432
|
+
when /^\s+(.+) \(.+\)$/
|
433
|
+
next
|
434
|
+
when /^\s+statically linked$/
|
354
435
|
next
|
355
|
-
when /^\s+
|
436
|
+
when /^\s+libjvm.so/ # FIXME: should remove if it doesn't blow up server
|
356
437
|
next
|
357
|
-
when /^\s+
|
438
|
+
when /^\s+libjava.so/ # FIXME: should remove if it doesn't blow up server
|
439
|
+
next
|
440
|
+
when /^\s+libmawt.so/ # FIXME: should remove if it doesn't blow up server
|
358
441
|
next
|
359
442
|
when /^\s+not a dynamic executable$/ # ignore non-executable files
|
360
443
|
else
|
@@ -364,7 +447,7 @@ module Omnibus
|
|
364
447
|
end
|
365
448
|
end
|
366
449
|
|
367
|
-
bad_libs
|
450
|
+
[bad_libs, good_libs]
|
368
451
|
end
|
369
452
|
|
370
453
|
private
|
@@ -399,10 +482,40 @@ module Omnibus
|
|
399
482
|
# @yield [String]
|
400
483
|
# each line
|
401
484
|
#
|
402
|
-
def read_shared_libs(
|
403
|
-
|
404
|
-
|
405
|
-
|
485
|
+
def read_shared_libs(find_command, ldd_command, &output_proc)
|
486
|
+
#
|
487
|
+
# construct the list of files to check
|
488
|
+
#
|
489
|
+
|
490
|
+
find_output = shellout!(find_command).stdout.lines
|
491
|
+
|
492
|
+
find_output.reject! { |file| IGNORED_ENDINGS.any? { |ending| file.end_with?("#{ending}\n") } }
|
493
|
+
|
494
|
+
find_output.reject! { |file| IGNORED_SUBSTRINGS.any? { |substr| file.include?(substr) } }
|
495
|
+
|
496
|
+
if find_output.empty?
|
497
|
+
# probably the find_command is busted, it should never be empty or why are you using omnibus?
|
498
|
+
raise "Internal Error: Health Check found no lines"
|
499
|
+
end
|
500
|
+
|
501
|
+
if find_output.any? { |file| file !~ Regexp.new(project.install_dir) }
|
502
|
+
# every file in the find output should be within the install_dir
|
503
|
+
raise "Internal Error: Health Check lines not matching the install_dir"
|
504
|
+
end
|
505
|
+
|
506
|
+
#
|
507
|
+
# feed the list of files to the "ldd" command
|
508
|
+
#
|
509
|
+
|
510
|
+
# this command will typically fail if the last file isn't a valid lib/binary which happens often
|
511
|
+
ldd_output = shellout(ldd_command, input: find_output.join).stdout
|
512
|
+
|
513
|
+
#
|
514
|
+
# do the output process to determine if the files are good or bad
|
515
|
+
#
|
516
|
+
|
517
|
+
ldd_output.each_line do |line|
|
518
|
+
output_proc.call(line)
|
406
519
|
end
|
407
520
|
end
|
408
521
|
|
@@ -420,7 +533,7 @@ module Omnibus
|
|
420
533
|
#
|
421
534
|
# @return the modified bad_library hash
|
422
535
|
#
|
423
|
-
def check_for_bad_library(bad_libs, current_library, name, linked)
|
536
|
+
def check_for_bad_library(bad_libs, good_libs, current_library, name, linked)
|
424
537
|
safe = nil
|
425
538
|
|
426
539
|
whitelist_libs = case Ohai["platform"]
|
@@ -463,10 +576,11 @@ module Omnibus
|
|
463
576
|
bad_libs[current_library][name][linked] = 1
|
464
577
|
end
|
465
578
|
else
|
579
|
+
good_libs[current_library] = true
|
466
580
|
log.debug(log_key) { " -> PASSED: #{name} is either whitelisted or safely provided." }
|
467
581
|
end
|
468
582
|
|
469
|
-
bad_libs
|
583
|
+
[bad_libs, good_libs]
|
470
584
|
end
|
471
585
|
end
|
472
586
|
end
|
data/lib/omnibus/metadata.rb
CHANGED
@@ -218,7 +218,7 @@ module Omnibus
|
|
218
218
|
# version is the same as Windows 2012R2. It's only here for completeness
|
219
219
|
# and documentation.
|
220
220
|
when /6\.3\.\d+/, "8.1" then "8.1"
|
221
|
-
when /^10\.0/ then "10"
|
221
|
+
when "10", /^10\.0/ then "10"
|
222
222
|
else
|
223
223
|
raise UnknownPlatformVersion.new(platform, platform_version)
|
224
224
|
end
|
@@ -431,23 +431,21 @@ module Omnibus
|
|
431
431
|
end
|
432
432
|
|
433
433
|
def is_binary?(bin)
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
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
|
439
438
|
end
|
440
439
|
|
441
440
|
def is_macho?(lib)
|
442
|
-
|
443
|
-
if is_binary?(lib)
|
444
|
-
command = "file #{lib}"
|
441
|
+
return false unless File.file?(lib) && File.executable?(lib) && !File.symlink?(lib)
|
445
442
|
|
446
|
-
|
447
|
-
|
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
|
448
446
|
end
|
449
|
-
|
450
|
-
|
447
|
+
|
448
|
+
false
|
451
449
|
end
|
452
450
|
end
|
453
451
|
end
|
data/lib/omnibus/project.rb
CHANGED
@@ -179,7 +179,7 @@ module Omnibus
|
|
179
179
|
if null?(val)
|
180
180
|
@install_dir || raise(MissingRequiredAttribute.new(self, :install_dir, "/opt/chef"))
|
181
181
|
else
|
182
|
-
@install_dir = val.tr('\\', "/").squeeze("/").chomp("/")
|
182
|
+
@install_dir = val.tr('\\', "/").squeeze("/").chomp("/") # rubocop:disable Style/StringLiterals
|
183
183
|
end
|
184
184
|
end
|
185
185
|
expose :install_dir
|
data/lib/omnibus/software.rb
CHANGED
@@ -717,7 +717,7 @@ module Omnibus
|
|
717
717
|
{
|
718
718
|
"CC" => "clang",
|
719
719
|
"CXX" => "clang++",
|
720
|
-
"LDFLAGS" => "-L#{install_dir}/embedded/lib",
|
720
|
+
"LDFLAGS" => "-L#{install_dir}/embedded/lib -Wl,-rpath,#{install_dir}/embedded/lib",
|
721
721
|
"CFLAGS" => "-I#{install_dir}/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
722
722
|
}
|
723
723
|
when "windows"
|
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
|
|
@@ -82,11 +88,13 @@ OMNIOS_WHITELIST_LIBS = [
|
|
82
88
|
SOLARIS_WHITELIST_LIBS = [
|
83
89
|
/libaio\.so/,
|
84
90
|
/libavl\.so/,
|
91
|
+
/libbsm\.so/,
|
85
92
|
/libcrypt_[di]\.so/,
|
86
93
|
/libcrypto.so/,
|
87
94
|
/libcurses\.so/,
|
88
95
|
/libdoor\.so/,
|
89
96
|
/libgen\.so/,
|
97
|
+
/libinetutil\.so/,
|
90
98
|
/libmd5\.so/,
|
91
99
|
/libmd\.so/,
|
92
100
|
/libmp\.so/,
|
@@ -96,9 +104,11 @@ SOLARIS_WHITELIST_LIBS = [
|
|
96
104
|
/libsocket\.so/,
|
97
105
|
/libssl.so/,
|
98
106
|
/libthread.so/,
|
107
|
+
/libtsol\.so/,
|
99
108
|
/libuutil\.so/,
|
100
109
|
/libkstat\.so/,
|
101
110
|
# solaris 11 libraries:
|
111
|
+
/libstdc\+\+\.so/,
|
102
112
|
/libc\.so\.1/,
|
103
113
|
/libm\.so\.2/,
|
104
114
|
/libdl\.so\.1/,
|
@@ -167,6 +177,8 @@ MAC_WHITELIST_LIBS = [
|
|
167
177
|
|
168
178
|
FREEBSD_WHITELIST_LIBS = [
|
169
179
|
/libc\.so/,
|
180
|
+
/libc\+\+\.so/,
|
181
|
+
/libcxxrt\.so/,
|
170
182
|
/libgcc_s\.so/,
|
171
183
|
/libcrypt\.so/,
|
172
184
|
/libm\.so/,
|
@@ -177,28 +189,34 @@ FREEBSD_WHITELIST_LIBS = [
|
|
177
189
|
/libkvm\.so/,
|
178
190
|
/libprocstat\.so/,
|
179
191
|
/libmd\.so/,
|
192
|
+
/libdl\.so/,
|
180
193
|
].freeze
|
181
194
|
|
182
195
|
IGNORED_ENDINGS = %w{
|
183
196
|
.TXT
|
184
|
-
.[ch]
|
185
|
-
.[ch]pp
|
186
|
-
.[eh]rl
|
187
197
|
.app
|
188
198
|
.appup
|
189
199
|
.bat
|
190
200
|
.beam
|
201
|
+
.c
|
191
202
|
.cc
|
192
203
|
.cmake
|
193
204
|
.conf
|
205
|
+
.cpp
|
194
206
|
.css
|
195
|
-
.
|
207
|
+
.erb
|
208
|
+
.erl
|
196
209
|
.feature
|
197
210
|
.gemspec
|
198
211
|
.gif
|
199
212
|
.gitignore
|
200
213
|
.gitkeep
|
201
|
-
.h
|
214
|
+
.h
|
215
|
+
.h
|
216
|
+
.hh
|
217
|
+
.hpp
|
218
|
+
.hrl
|
219
|
+
.html
|
202
220
|
.jar
|
203
221
|
.java
|
204
222
|
.jpg
|
@@ -210,6 +228,7 @@ IGNORED_ENDINGS = %w{
|
|
210
228
|
.lua
|
211
229
|
.md
|
212
230
|
.mkd
|
231
|
+
.mo
|
213
232
|
.npmignore
|
214
233
|
.out
|
215
234
|
.packlist
|
@@ -219,21 +238,28 @@ IGNORED_ENDINGS = %w{
|
|
219
238
|
.png
|
220
239
|
.pod
|
221
240
|
.properties
|
222
|
-
.py
|
223
|
-
.
|
241
|
+
.py
|
242
|
+
.pyc
|
243
|
+
.pyo
|
224
244
|
.rake
|
245
|
+
.rb
|
246
|
+
.rbs
|
225
247
|
.rdoc
|
248
|
+
.rhtml
|
226
249
|
.ri
|
250
|
+
.rpm
|
227
251
|
.rst
|
228
252
|
.scss
|
229
253
|
.sh
|
230
254
|
.sql
|
231
255
|
.svg
|
232
256
|
.toml
|
257
|
+
.tt
|
233
258
|
.ttf
|
234
259
|
.txt
|
235
260
|
.xml
|
236
261
|
.yml
|
262
|
+
COPYING
|
237
263
|
Gemfile
|
238
264
|
LICENSE
|
239
265
|
Makefile
|
@@ -243,7 +269,7 @@ IGNORED_ENDINGS = %w{
|
|
243
269
|
license
|
244
270
|
}.freeze
|
245
271
|
|
246
|
-
|
272
|
+
IGNORED_SUBSTRINGS = %w{
|
247
273
|
/build_info/
|
248
274
|
/licenses/
|
249
275
|
/LICENSES/
|
data/omnibus.gemspec
CHANGED
@@ -25,18 +25,19 @@ 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
32
|
gem.add_dependency "contracts", ">= 0.16.0", "< 0.17.0"
|
33
|
+
gem.add_dependency "rexml", "~> 3.2"
|
33
34
|
|
34
35
|
gem.add_dependency "mixlib-versioning"
|
35
36
|
gem.add_dependency "pedump"
|
36
37
|
|
37
38
|
gem.add_development_dependency "artifactory", "~> 3.0"
|
38
39
|
gem.add_development_dependency "aruba", "~> 2.0"
|
39
|
-
gem.add_development_dependency "chefstyle", "=
|
40
|
+
gem.add_development_dependency "chefstyle", "= 2.2.2"
|
40
41
|
gem.add_development_dependency "fauxhai-ng", ">= 7.5"
|
41
42
|
gem.add_development_dependency "rspec", "~> 3.0"
|
42
43
|
gem.add_development_dependency "rspec-json_expectations"
|
data/resources/rpm/spec.erb
CHANGED
@@ -222,7 +222,7 @@ module Omnibus
|
|
222
222
|
output = capture_logging { subject.build }
|
223
223
|
|
224
224
|
appbundler_path = File.join(embedded_bin_dir, "appbundler")
|
225
|
-
appbundler_path.gsub!(%r{/}, '\\') if windows?
|
225
|
+
appbundler_path.gsub!(%r{/}, '\\') if windows? # rubocop:disable Style/StringLiterals
|
226
226
|
expect(output).to include("#{appbundler_path} '#{project_dir}' '#{bin_dir}'")
|
227
227
|
end
|
228
228
|
end
|
data/spec/support/examples.rb
CHANGED
@@ -60,7 +60,7 @@ RSpec.shared_examples "a software" do |name = "chefdk"|
|
|
60
60
|
|
61
61
|
allow(software).to receive(:embedded_bin) do |binary|
|
62
62
|
p = File.join(embedded_bin_dir, binary)
|
63
|
-
p.gsub!(%r{/}, '\\') if windows?
|
63
|
+
p.gsub!(%r{/}, '\\') if windows? # rubocop:disable Style/StringLiterals
|
64
64
|
p
|
65
65
|
end
|
66
66
|
end
|
@@ -14,7 +14,7 @@ module Omnibus
|
|
14
14
|
# If we asked for Windows, we should also specify that magical
|
15
15
|
# +File::ALT_SEPARATOR+ variable
|
16
16
|
if options[:platform] && options[:platform] == "windows"
|
17
|
-
stub_const("File::ALT_SEPARATOR", '\\')
|
17
|
+
stub_const("File::ALT_SEPARATOR", '\\') # rubocop:disable Style/StringLiterals
|
18
18
|
end
|
19
19
|
end
|
20
20
|
end
|
data/spec/unit/builder_spec.rb
CHANGED
@@ -23,7 +23,7 @@ module Omnibus
|
|
23
23
|
allow(subject).to receive(:windows?).and_return(on_windows)
|
24
24
|
allow(subject).to receive(:windows_safe_path) do |*args|
|
25
25
|
path = File.join(*args)
|
26
|
-
path.gsub!(File::SEPARATOR, '\\') if on_windows
|
26
|
+
path.gsub!(File::SEPARATOR, '\\') if on_windows # rubocop:disable Style/StringLiterals
|
27
27
|
end
|
28
28
|
end
|
29
29
|
|
@@ -171,7 +171,7 @@ module Omnibus
|
|
171
171
|
context "when :bin is present" do
|
172
172
|
it "uses the custom bin" do
|
173
173
|
expect(subject).to receive(:command)
|
174
|
-
.with("/path/to/make", in_msys_bash: true)
|
174
|
+
.with("/path/to/make", { in_msys_bash: true })
|
175
175
|
subject.make(bin: "/path/to/make")
|
176
176
|
end
|
177
177
|
end
|
@@ -185,7 +185,7 @@ module Omnibus
|
|
185
185
|
|
186
186
|
it "uses gmake and sets MAKE=gmake" do
|
187
187
|
expect(subject).to receive(:command)
|
188
|
-
.with("gmake", env: { "MAKE" => "gmake" }, in_msys_bash: true)
|
188
|
+
.with("gmake", { env: { "MAKE" => "gmake" }, in_msys_bash: true } )
|
189
189
|
subject.make
|
190
190
|
end
|
191
191
|
end
|
@@ -198,26 +198,26 @@ module Omnibus
|
|
198
198
|
|
199
199
|
it "uses make" do
|
200
200
|
expect(subject).to receive(:command)
|
201
|
-
.with("make", in_msys_bash: true)
|
201
|
+
.with("make", { in_msys_bash: true } )
|
202
202
|
subject.make
|
203
203
|
end
|
204
204
|
end
|
205
205
|
|
206
206
|
it "accepts 0 options" do
|
207
207
|
expect(subject).to receive(:command)
|
208
|
-
.with("make", in_msys_bash: true)
|
208
|
+
.with("make", { in_msys_bash: true } )
|
209
209
|
expect { subject.make }.to_not raise_error
|
210
210
|
end
|
211
211
|
|
212
212
|
it "accepts an additional command string" do
|
213
213
|
expect(subject).to receive(:command)
|
214
|
-
.with("make install", in_msys_bash: true)
|
214
|
+
.with("make install", { in_msys_bash: true } )
|
215
215
|
expect { subject.make("install") }.to_not raise_error
|
216
216
|
end
|
217
217
|
|
218
218
|
it "persists given options" do
|
219
219
|
expect(subject).to receive(:command)
|
220
|
-
.with("make", timeout: 3600, in_msys_bash: true)
|
220
|
+
.with("make", { timeout: 3600, in_msys_bash: true } )
|
221
221
|
subject.make(timeout: 3600)
|
222
222
|
end
|
223
223
|
end
|
@@ -242,7 +242,7 @@ module Omnibus
|
|
242
242
|
|
243
243
|
it "appends platform host to the options" do
|
244
244
|
expect(subject).to receive(:command)
|
245
|
-
.with("./configure --build=x86_64-w64-mingw32 --prefix=#{project_dir}/embedded", in_msys_bash: true)
|
245
|
+
.with("./configure --build=x86_64-w64-mingw32 --prefix=#{project_dir}/embedded", { in_msys_bash: true } )
|
246
246
|
subject.configure
|
247
247
|
end
|
248
248
|
end
|
@@ -258,7 +258,7 @@ module Omnibus
|
|
258
258
|
|
259
259
|
it "appends platform host to the options" do
|
260
260
|
expect(subject).to receive(:command)
|
261
|
-
.with("./configure --build=i686-w64-mingw32 --prefix=#{project_dir}/embedded", in_msys_bash: true)
|
261
|
+
.with("./configure --build=i686-w64-mingw32 --prefix=#{project_dir}/embedded", { in_msys_bash: true } )
|
262
262
|
subject.configure
|
263
263
|
end
|
264
264
|
end
|
@@ -266,7 +266,7 @@ module Omnibus
|
|
266
266
|
context "when :bin is present" do
|
267
267
|
it "uses the custom bin" do
|
268
268
|
expect(subject).to receive(:command)
|
269
|
-
.with("/path/to/configure --prefix=#{project_dir}/embedded", in_msys_bash: true)
|
269
|
+
.with("/path/to/configure --prefix=#{project_dir}/embedded", { in_msys_bash: true } )
|
270
270
|
subject.configure(bin: "/path/to/configure")
|
271
271
|
end
|
272
272
|
end
|
@@ -274,32 +274,32 @@ module Omnibus
|
|
274
274
|
context "when :prefix is present" do
|
275
275
|
it "emits non-empty prefix" do
|
276
276
|
expect(subject).to receive(:command)
|
277
|
-
.with("./configure --prefix=/some/prefix", in_msys_bash: true)
|
277
|
+
.with("./configure --prefix=/some/prefix", { in_msys_bash: true } )
|
278
278
|
subject.configure(prefix: "/some/prefix")
|
279
279
|
end
|
280
280
|
|
281
281
|
it "omits prefix if empty" do
|
282
282
|
expect(subject).to receive(:command)
|
283
|
-
.with("./configure", in_msys_bash: true)
|
283
|
+
.with("./configure", { in_msys_bash: true } )
|
284
284
|
subject.configure(prefix: "")
|
285
285
|
end
|
286
286
|
end
|
287
287
|
|
288
288
|
it "accepts 0 options" do
|
289
289
|
expect(subject).to receive(:command)
|
290
|
-
.with("./configure --prefix=#{project_dir}/embedded", in_msys_bash: true)
|
290
|
+
.with("./configure --prefix=#{project_dir}/embedded", { in_msys_bash: true } )
|
291
291
|
expect { subject.configure }.to_not raise_error
|
292
292
|
end
|
293
293
|
|
294
294
|
it "accepts an additional command string" do
|
295
295
|
expect(subject).to receive(:command)
|
296
|
-
.with("./configure --prefix=#{project_dir}/embedded --myopt", in_msys_bash: true)
|
296
|
+
.with("./configure --prefix=#{project_dir}/embedded --myopt", { in_msys_bash: true } )
|
297
297
|
expect { subject.configure("--myopt") }.to_not raise_error
|
298
298
|
end
|
299
299
|
|
300
300
|
it "persists given options" do
|
301
301
|
expect(subject).to receive(:command)
|
302
|
-
.with("./configure --prefix=#{project_dir}/embedded", timeout: 3600, in_msys_bash: true)
|
302
|
+
.with("./configure --prefix=#{project_dir}/embedded", { timeout: 3600, in_msys_bash: true } )
|
303
303
|
subject.configure(timeout: 3600)
|
304
304
|
end
|
305
305
|
end
|
@@ -321,28 +321,28 @@ module Omnibus
|
|
321
321
|
it "invokes patch with patch level 1 unless specified" do
|
322
322
|
expect { subject.patch(source: "good_patch") }.to_not raise_error
|
323
323
|
expect(subject).to receive(:shellout!)
|
324
|
-
.with("patch -p1 -i #{project_dir}/patch_location2/good_patch", in_msys_bash: true)
|
324
|
+
.with("patch -p1 -i #{project_dir}/patch_location2/good_patch", { in_msys_bash: true } )
|
325
325
|
run_build_command
|
326
326
|
end
|
327
327
|
|
328
328
|
it "invokes patch with patch level provided" do
|
329
329
|
expect { subject.patch(source: "good_patch", plevel: 0) }.to_not raise_error
|
330
330
|
expect(subject).to receive(:shellout!)
|
331
|
-
.with("patch -p0 -i #{project_dir}/patch_location2/good_patch", in_msys_bash: true)
|
331
|
+
.with("patch -p0 -i #{project_dir}/patch_location2/good_patch", { in_msys_bash: true } )
|
332
332
|
run_build_command
|
333
333
|
end
|
334
334
|
|
335
335
|
it "invokes patch differently if target is provided" do
|
336
336
|
expect { subject.patch(source: "good_patch", target: "target/path") }.to_not raise_error
|
337
337
|
expect(subject).to receive(:shellout!)
|
338
|
-
.with("cat #{project_dir}/patch_location2/good_patch | patch -p1 target/path", in_msys_bash: true)
|
338
|
+
.with("cat #{project_dir}/patch_location2/good_patch | patch -p1 target/path", { in_msys_bash: true } )
|
339
339
|
run_build_command
|
340
340
|
end
|
341
341
|
|
342
342
|
it "persists other options" do
|
343
343
|
expect { subject.patch(source: "good_patch", timeout: 3600) }.to_not raise_error
|
344
344
|
expect(subject).to receive(:shellout!)
|
345
|
-
.with("patch -p1 -i #{project_dir}/patch_location2/good_patch", timeout: 3600, in_msys_bash: true)
|
345
|
+
.with("patch -p1 -i #{project_dir}/patch_location2/good_patch", { timeout: 3600, in_msys_bash: true } )
|
346
346
|
run_build_command
|
347
347
|
end
|
348
348
|
end
|
@@ -421,19 +421,19 @@ module Omnibus
|
|
421
421
|
it_behaves_like "an extractor", "zip", {},
|
422
422
|
['7z.exe x C:\\file.zip -oC:\\tmp\\project -r -y']
|
423
423
|
it_behaves_like "an extractor", "tar", {},
|
424
|
-
[[
|
424
|
+
[["tar xf C:/file.tar --force-local -CC:/tmp/project", { returns: [0] }]]
|
425
425
|
it_behaves_like "an extractor", "tgz", {},
|
426
|
-
[[
|
426
|
+
[["tar zxf C:/file.tgz --force-local -CC:/tmp/project", { returns: [0] }]]
|
427
427
|
it_behaves_like "an extractor", "tar.gz", {},
|
428
|
-
[[
|
428
|
+
[["tar zxf C:/file.tar.gz --force-local -CC:/tmp/project", { returns: [0] }]]
|
429
429
|
it_behaves_like "an extractor", "tar.bz2", {},
|
430
|
-
[[
|
430
|
+
[["tar jxf C:/file.tar.bz2 --force-local -CC:/tmp/project", { returns: [0] }]]
|
431
431
|
it_behaves_like "an extractor", "txz", {},
|
432
|
-
[[
|
432
|
+
[["tar Jxf C:/file.txz --force-local -CC:/tmp/project", { returns: [0] }]]
|
433
433
|
it_behaves_like "an extractor", "tar.xz", {},
|
434
|
-
[[
|
434
|
+
[["tar Jxf C:/file.tar.xz --force-local -CC:/tmp/project", { returns: [0] }]]
|
435
435
|
it_behaves_like "an extractor", "tar.lzma", {},
|
436
|
-
[[
|
436
|
+
[["tar --lzma -xf C:/file.tar.lzma --force-local -CC:/tmp/project", { returns: [0] }]]
|
437
437
|
end
|
438
438
|
|
439
439
|
context "when seven_zip extract strategy is chosen" do
|
@@ -469,19 +469,19 @@ module Omnibus
|
|
469
469
|
it_behaves_like "an extractor", "zip", { extract: :lax_tar },
|
470
470
|
['7z.exe x C:\\file.zip -oC:\\tmp\\project -r -y']
|
471
471
|
it_behaves_like "an extractor", "tar", { extract: :lax_tar },
|
472
|
-
[[
|
472
|
+
[["tar xf C:/file.tar --force-local -CC:/tmp/project", { returns: [0, 1] }]]
|
473
473
|
it_behaves_like "an extractor", "tgz", { extract: :lax_tar },
|
474
|
-
[[
|
474
|
+
[["tar zxf C:/file.tgz --force-local -CC:/tmp/project", { returns: [0, 1] }]]
|
475
475
|
it_behaves_like "an extractor", "tar.gz", { extract: :lax_tar },
|
476
|
-
[[
|
476
|
+
[["tar zxf C:/file.tar.gz --force-local -CC:/tmp/project", { returns: [0, 1] }]]
|
477
477
|
it_behaves_like "an extractor", "tar.bz2", { extract: :lax_tar },
|
478
|
-
[[
|
478
|
+
[["tar jxf C:/file.tar.bz2 --force-local -CC:/tmp/project", { returns: [0, 1] }]]
|
479
479
|
it_behaves_like "an extractor", "txz", { extract: :lax_tar },
|
480
|
-
[[
|
480
|
+
[["tar Jxf C:/file.txz --force-local -CC:/tmp/project", { returns: [0, 1] }]]
|
481
481
|
it_behaves_like "an extractor", "tar.xz", { extract: :lax_tar },
|
482
|
-
[[
|
482
|
+
[["tar Jxf C:/file.tar.xz --force-local -CC:/tmp/project", { returns: [0, 1] }]]
|
483
483
|
it_behaves_like "an extractor", "tar.lzma", { extract: :lax_tar },
|
484
|
-
[[
|
484
|
+
[["tar --lzma -xf C:/file.tar.lzma --force-local -CC:/tmp/project", { returns: [0, 1] }]]
|
485
485
|
end
|
486
486
|
end
|
487
487
|
|
@@ -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
|
@@ -557,7 +557,9 @@ module Omnibus
|
|
557
557
|
|
558
558
|
context "when is a Mach-O library" do
|
559
559
|
before do
|
560
|
-
allow(
|
560
|
+
allow(File).to receive(:file?).with("file").and_return(true)
|
561
|
+
allow(File).to receive(:executable?).with("file").and_return(true)
|
562
|
+
allow(File).to receive(:symlink?).with("file").and_return(false)
|
561
563
|
expect(subject).to receive(:shellout!).with("file file").and_return(shellout)
|
562
564
|
allow(shellout).to receive(:stdout)
|
563
565
|
.and_return("file: Mach-O 64-bit dynamically linked shared library x86_64")
|
@@ -570,7 +572,9 @@ module Omnibus
|
|
570
572
|
|
571
573
|
context "when is a Mach-O Bundle" do
|
572
574
|
before do
|
573
|
-
allow(
|
575
|
+
allow(File).to receive(:file?).with("file").and_return(true)
|
576
|
+
allow(File).to receive(:executable?).with("file").and_return(true)
|
577
|
+
allow(File).to receive(:symlink?).with("file").and_return(false)
|
574
578
|
expect(subject).to receive(:shellout!).with("file file").and_return(shellout)
|
575
579
|
allow(shellout).to receive(:stdout)
|
576
580
|
.and_return("file: Mach-O 64-bit bundle x86_64")
|
@@ -583,7 +587,9 @@ module Omnibus
|
|
583
587
|
|
584
588
|
context "when is not a Mach-O Bundle or Mach-O library" do
|
585
589
|
before do
|
586
|
-
allow(
|
590
|
+
allow(File).to receive(:file?).with("file").and_return(true)
|
591
|
+
allow(File).to receive(:executable?).with("file").and_return(true)
|
592
|
+
allow(File).to receive(:symlink?).with("file").and_return(false)
|
587
593
|
expect(subject).to receive(:shellout!).with("file file").and_return(shellout)
|
588
594
|
allow(shellout).to receive(:stdout)
|
589
595
|
.and_return("file: ASCII text")
|
data/spec/unit/project_spec.rb
CHANGED
@@ -229,7 +229,7 @@ module Omnibus
|
|
229
229
|
|
230
230
|
context "when on Windows" do
|
231
231
|
before { stub_ohai(platform: "windows", version: "2019") }
|
232
|
-
before { stub_const("File::ALT_SEPARATOR", '\\') }
|
232
|
+
before { stub_const("File::ALT_SEPARATOR", '\\') } # rubocop:disable Style/StringLiterals
|
233
233
|
it "returns a Windows iteration" do
|
234
234
|
expect(subject.build_iteration).to eq(1)
|
235
235
|
end
|
data/spec/unit/software_spec.rb
CHANGED
@@ -239,7 +239,7 @@ module Omnibus
|
|
239
239
|
"CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
240
240
|
"CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
241
241
|
"CXX" => "clang++",
|
242
|
-
"LDFLAGS" => "-L/opt/project/embedded/lib",
|
242
|
+
"LDFLAGS" => "-L/opt/project/embedded/lib -Wl,-rpath,/opt/project/embedded/lib",
|
243
243
|
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
244
244
|
"PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
|
245
245
|
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
@@ -543,7 +543,7 @@ module Omnibus
|
|
543
543
|
|
544
544
|
it "fetches from a fully expanded git path" do
|
545
545
|
expect(subject.source).to eq(git: "https://github.com/chef/ohai.git")
|
546
|
-
expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", git: "https://github.com/chef/ohai.git").and_return("1.2.8")
|
546
|
+
expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", { git: "https://github.com/chef/ohai.git" } ).and_return("1.2.8")
|
547
547
|
subject.send(:fetcher)
|
548
548
|
end
|
549
549
|
|
@@ -552,7 +552,7 @@ module Omnibus
|
|
552
552
|
|
553
553
|
it "fetches from the override path" do
|
554
554
|
expect(subject.source).to eq(git: "https://blah.com/git.git")
|
555
|
-
expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", git: "https://blah.com/git.git").and_return("1.2.8")
|
555
|
+
expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", { git: "https://blah.com/git.git" } ).and_return("1.2.8")
|
556
556
|
subject.send(:fetcher)
|
557
557
|
end
|
558
558
|
end
|
@@ -562,7 +562,7 @@ module Omnibus
|
|
562
562
|
|
563
563
|
it "fetches from the override path" do
|
564
564
|
expect(subject.source).to eq(git: "https://github.com/a/b.git")
|
565
|
-
expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", git: "https://github.com/a/b.git").and_return("1.2.8")
|
565
|
+
expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", { git: "https://github.com/a/b.git" } ).and_return("1.2.8")
|
566
566
|
subject.send(:fetcher)
|
567
567
|
end
|
568
568
|
end
|
@@ -577,7 +577,7 @@ module Omnibus
|
|
577
577
|
|
578
578
|
it "fetches from the git spec" do
|
579
579
|
expect(subject.source).to eq(git: "https://blah.com/git.git")
|
580
|
-
expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", git: "https://blah.com/git.git").and_return("1.2.8")
|
580
|
+
expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", { git: "https://blah.com/git.git" } ).and_return("1.2.8")
|
581
581
|
subject.send(:fetcher)
|
582
582
|
end
|
583
583
|
|
@@ -586,7 +586,7 @@ module Omnibus
|
|
586
586
|
|
587
587
|
it "fetches from the override path" do
|
588
588
|
expect(subject.source).to eq(git: "https://github.com/a/b.git")
|
589
|
-
expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", git: "https://github.com/a/b.git").and_return("1.2.8")
|
589
|
+
expect(Omnibus::Fetcher).to receive(:resolve_version).with("1.2.3", { git: "https://github.com/a/b.git" } ).and_return("1.2.8")
|
590
590
|
subject.send(:fetcher)
|
591
591
|
end
|
592
592
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omnibus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 9.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-10-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk-s3
|
@@ -95,7 +95,7 @@ dependencies:
|
|
95
95
|
version: '15'
|
96
96
|
- - "<"
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: '
|
98
|
+
version: '18'
|
99
99
|
type: :runtime
|
100
100
|
prerelease: false
|
101
101
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -105,7 +105,7 @@ dependencies:
|
|
105
105
|
version: '15'
|
106
106
|
- - "<"
|
107
107
|
- !ruby/object:Gem::Version
|
108
|
-
version: '
|
108
|
+
version: '18'
|
109
109
|
- !ruby/object:Gem::Dependency
|
110
110
|
name: ruby-progressbar
|
111
111
|
requirement: !ruby/object:Gem::Requirement
|
@@ -174,6 +174,20 @@ dependencies:
|
|
174
174
|
- - "<"
|
175
175
|
- !ruby/object:Gem::Version
|
176
176
|
version: 0.17.0
|
177
|
+
- !ruby/object:Gem::Dependency
|
178
|
+
name: rexml
|
179
|
+
requirement: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - "~>"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '3.2'
|
184
|
+
type: :runtime
|
185
|
+
prerelease: false
|
186
|
+
version_requirements: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - "~>"
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '3.2'
|
177
191
|
- !ruby/object:Gem::Dependency
|
178
192
|
name: mixlib-versioning
|
179
193
|
requirement: !ruby/object:Gem::Requirement
|
@@ -236,14 +250,14 @@ dependencies:
|
|
236
250
|
requirements:
|
237
251
|
- - '='
|
238
252
|
- !ruby/object:Gem::Version
|
239
|
-
version:
|
253
|
+
version: 2.2.2
|
240
254
|
type: :development
|
241
255
|
prerelease: false
|
242
256
|
version_requirements: !ruby/object:Gem::Requirement
|
243
257
|
requirements:
|
244
258
|
- - '='
|
245
259
|
- !ruby/object:Gem::Version
|
246
|
-
version:
|
260
|
+
version: 2.2.2
|
247
261
|
- !ruby/object:Gem::Dependency
|
248
262
|
name: fauxhai-ng
|
249
263
|
requirement: !ruby/object:Gem::Requirement
|