omnibus 6.1.9 → 8.0.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (70) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -4
  3. data/README.md +54 -13
  4. data/bin/omnibus +1 -1
  5. data/lib/omnibus.rb +2 -2
  6. data/lib/omnibus/build_version.rb +1 -1
  7. data/lib/omnibus/build_version_dsl.rb +5 -7
  8. data/lib/omnibus/builder.rb +4 -4
  9. data/lib/omnibus/cleaner.rb +1 -1
  10. data/lib/omnibus/cli.rb +2 -2
  11. data/lib/omnibus/cli/changelog.rb +1 -1
  12. data/lib/omnibus/compressor.rb +2 -2
  13. data/lib/omnibus/compressors/base.rb +2 -2
  14. data/lib/omnibus/compressors/dmg.rb +5 -2
  15. data/lib/omnibus/compressors/tgz.rb +2 -2
  16. data/lib/omnibus/config.rb +13 -3
  17. data/lib/omnibus/core_extensions/open_uri.rb +1 -1
  18. data/lib/omnibus/digestable.rb +2 -2
  19. data/lib/omnibus/download_helpers.rb +6 -2
  20. data/lib/omnibus/fetchers/file_fetcher.rb +1 -1
  21. data/lib/omnibus/fetchers/net_fetcher.rb +1 -1
  22. data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
  23. data/lib/omnibus/file_syncer.rb +1 -1
  24. data/lib/omnibus/generator.rb +2 -2
  25. data/lib/omnibus/generator_files/README.md.erb +20 -16
  26. data/lib/omnibus/generator_files/config/software/preparation.rb.erb +1 -1
  27. data/lib/omnibus/generator_files/omnibus.rb.erb +5 -4
  28. data/lib/omnibus/git_cache.rb +2 -2
  29. data/lib/omnibus/health_check.rb +2 -0
  30. data/lib/omnibus/licensing.rb +3 -3
  31. data/lib/omnibus/logger.rb +1 -1
  32. data/lib/omnibus/manifest.rb +1 -1
  33. data/lib/omnibus/metadata.rb +3 -3
  34. data/lib/omnibus/ohai.rb +1 -1
  35. data/lib/omnibus/package.rb +1 -1
  36. data/lib/omnibus/packager.rb +6 -14
  37. data/lib/omnibus/packagers/base.rb +1 -1
  38. data/lib/omnibus/packagers/msi.rb +1 -1
  39. data/lib/omnibus/packagers/pkg.rb +122 -3
  40. data/lib/omnibus/packagers/solaris.rb +1 -1
  41. data/lib/omnibus/project.rb +2 -2
  42. data/lib/omnibus/publishers/artifactory_publisher.rb +2 -2
  43. data/lib/omnibus/publishers/s3_publisher.rb +6 -4
  44. data/lib/omnibus/s3_cache.rb +4 -2
  45. data/lib/omnibus/s3_helpers.rb +7 -7
  46. data/lib/omnibus/software.rb +52 -34
  47. data/lib/omnibus/sugarable.rb +5 -14
  48. data/lib/omnibus/templating.rb +1 -1
  49. data/lib/omnibus/thread_pool.rb +0 -2
  50. data/lib/omnibus/util.rb +1 -1
  51. data/lib/omnibus/version.rb +1 -1
  52. data/lib/omnibus/whitelist.rb +24 -1
  53. data/omnibus.gemspec +7 -8
  54. data/resources/ips/doc-transform.erb +1 -0
  55. data/resources/msi/CustomActionFastMsi.CA.dll +0 -0
  56. data/resources/msi/source.wxs.erb +2 -10
  57. data/resources/rpm/signing.erb +7 -10
  58. data/spec/support/path_helpers.rb +2 -2
  59. data/spec/unit/compressor_spec.rb +1 -1
  60. data/spec/unit/compressors/dmg_spec.rb +5 -2
  61. data/spec/unit/metadata_spec.rb +6 -6
  62. data/spec/unit/packager_spec.rb +6 -13
  63. data/spec/unit/packagers/ips_spec.rb +1 -0
  64. data/spec/unit/packagers/pkg_spec.rb +354 -0
  65. data/spec/unit/packagers/rpm_spec.rb +5 -5
  66. data/spec/unit/project_spec.rb +5 -5
  67. data/spec/unit/s3_cacher_spec.rb +17 -0
  68. data/spec/unit/s3_helpers_spec.rb +20 -1
  69. data/spec/unit/software_spec.rb +58 -119
  70. metadata +22 -22
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "socket"
17
+ require "socket" unless defined?(Socket)
18
18
 
19
19
  module Omnibus
20
20
  class Packager::Solaris < Packager::Base
@@ -15,8 +15,8 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require "time"
19
- require "ffi_yajl"
18
+ require "time" unless defined?(Time.zone_offset)
19
+ require "ffi_yajl" unless defined?(FFI_Yajl)
20
20
  require "omnibus/manifest"
21
21
  require "omnibus/manifest_entry"
22
22
  require "omnibus/reports"
@@ -14,8 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "uri"
18
- require "benchmark"
17
+ require "uri" unless defined?(URI)
18
+ require "benchmark" unless defined?(Benchmark)
19
19
 
20
20
  module Omnibus
21
21
  class ArtifactoryPublisher < Publisher
@@ -65,11 +65,13 @@ module Omnibus
65
65
  bucket_name: @options[:bucket],
66
66
  }
67
67
 
68
- if Config.publish_s3_profile
69
- config[:profile] = Config.publish_s3_profile
68
+ if Config.publish_s3_iam_role_arn
69
+ config[:publish_s3_iam_role_arn] = Config.publish_s3_iam_role_arn
70
+ elsif Config.publish_s3_profile
71
+ config[:profile] = Config.publish_s3_profile
70
72
  else
71
- config[:access_key_id] = Config.publish_s3_access_key
72
- config[:secret_access_key] = Config.publish_s3_secret_key
73
+ config[:access_key_id] = Config.publish_s3_access_key
74
+ config[:secret_access_key] = Config.publish_s3_secret_key
73
75
  end
74
76
 
75
77
  config
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "fileutils"
17
+ require "fileutils" unless defined?(FileUtils)
18
18
  require "omnibus/s3_helpers"
19
19
 
20
20
  module Omnibus
@@ -147,7 +147,9 @@ module Omnibus
147
147
  force_path_style: Config.s3_force_path_style,
148
148
  }
149
149
 
150
- if Config.s3_profile
150
+ if Config.s3_iam_role_arn
151
+ config[:iam_role_arn] = Config.s3_iam_role_arn
152
+ elsif Config.s3_profile
151
153
  config[:profile] = Config.s3_profile
152
154
  else
153
155
  config[:access_key_id] = Config.s3_access_key
@@ -17,7 +17,7 @@
17
17
  require "aws-sdk-s3"
18
18
  require "aws-sdk-core/credentials"
19
19
  require "aws-sdk-core/shared_credentials"
20
- require "base64"
20
+ require "base64" unless defined?(Base64)
21
21
 
22
22
  module Omnibus
23
23
  module S3Helpers
@@ -53,10 +53,7 @@ module Omnibus
53
53
  # @return [Aws::S3::Resource]
54
54
  #
55
55
  def client
56
- Aws.config.update(
57
- region: s3_configuration[:region],
58
- credentials: get_credentials
59
- )
56
+ Aws.config.update(region: s3_configuration[:region])
60
57
 
61
58
  @s3_client ||= Aws::S3::Resource.new(resource_params)
62
59
  end
@@ -70,6 +67,7 @@ module Omnibus
70
67
  params = {
71
68
  use_accelerate_endpoint: s3_configuration[:use_accelerate_endpoint],
72
69
  force_path_style: s3_configuration[:force_path_style],
70
+ credentials: get_credentials,
73
71
  }
74
72
 
75
73
  if s3_configuration[:use_accelerate_endpoint]
@@ -84,12 +82,14 @@ module Omnibus
84
82
  end
85
83
 
86
84
  #
87
- # Create credentials object based on credential profile or access key
85
+ # Create credentials object based on AWS IAM role arn, credential profile or access key
88
86
  # parameters for use by the client object.
89
87
  #
90
88
  # @return [Aws::SharedCredentials, Aws::Credentials]
91
89
  def get_credentials
92
- if s3_configuration[:profile]
90
+ if s3_configuration[:iam_role_arn]
91
+ Aws::AssumeRoleCredentials.new(role_arn: s3_configuration[:iam_role_arn], role_session_name: "omnibus-assume-role-s3-access")
92
+ elsif s3_configuration[:profile]
93
93
  Aws::SharedCredentials.new(profile_name: s3_configuration[:profile])
94
94
  elsif s3_configuration[:access_key_id] && s3_configuration[:secret_access_key]
95
95
  Aws::Credentials.new(s3_configuration[:access_key_id], s3_configuration[:secret_access_key])
@@ -14,8 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "fileutils"
18
- require "uri"
17
+ require "fileutils" unless defined?(FileUtils)
18
+ require "uri" unless defined?(URI)
19
19
  require "omnibus/manifest_entry"
20
20
 
21
21
  module Omnibus
@@ -205,6 +205,46 @@ module Omnibus
205
205
  end
206
206
  expose :maintainer
207
207
 
208
+ #
209
+ # Sets the bin_dirs where this software installs bins.
210
+ #
211
+ # @example
212
+ # bin_dirs ['/opt/chef-workstation/bin']
213
+ #
214
+ # @param [Array<String>] val
215
+ # the bin_dirs of the software
216
+ #
217
+ # @return [Array<String>]
218
+ #
219
+ def bin_dirs(val = NULL)
220
+ if null?(val)
221
+ @bin_dirs || [windows_safe_path("#{install_dir}/bin"), windows_safe_path("#{install_dir}/embedded/bin")]
222
+ else
223
+ @bin_dirs = val
224
+ end
225
+ end
226
+ expose :bin_dirs
227
+
228
+ #
229
+ # Sets the lib_dirs where this software installs libs.
230
+ #
231
+ # @example
232
+ # lib_dirs ['/opt/chef-workstation/bin']
233
+ #
234
+ # @param [Array<String>] val
235
+ # the lib_dirs of the software
236
+ #
237
+ # @return [Array<String>]
238
+ #
239
+ def lib_dirs(val = NULL)
240
+ if null?(val)
241
+ @lib_dirs || [windows_safe_path("#{install_dir}/embedded/lib")]
242
+ else
243
+ @lib_dirs = val
244
+ end
245
+ end
246
+ expose :lib_dirs
247
+
208
248
  #
209
249
  # Add a software dependency to this software.
210
250
  #
@@ -485,7 +525,7 @@ module Omnibus
485
525
  return if final_version.nil?
486
526
 
487
527
  begin
488
- Chef::Sugar::Constraints::Version.new(final_version)
528
+ ChefUtils::VersionString.new(final_version)
489
529
  rescue ArgumentError
490
530
  log.warn(log_key) do
491
531
  "Version #{final_version} for software #{name} was not parseable. " \
@@ -668,40 +708,18 @@ module Omnibus
668
708
  "ARFLAGS" => "-X64 cru",
669
709
  }
670
710
  when "solaris2"
671
- if platform_version.satisfies?("<= 5.10")
672
- solaris_flags = {
673
- # this override is due to a bug in libtool documented here:
674
- # http://lists.gnu.org/archive/html/bug-libtool/2005-10/msg00004.html
675
- "CC" => "gcc -static-libgcc",
676
- "LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc",
677
- "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
678
- }
679
- elsif platform_version.satisfies?(">= 5.11")
680
- solaris_flags = {
681
- "CC" => "gcc -m64 -static-libgcc",
682
- "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc",
683
- "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
684
- }
685
- end
686
- solaris_flags
711
+ {
712
+ "CC" => "gcc -m64 -static-libgcc",
713
+ "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc",
714
+ "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
715
+ }
687
716
  when "freebsd"
688
717
  {
689
718
  "CC" => "clang",
690
719
  "CXX" => "clang++",
691
720
  "LDFLAGS" => "-L#{install_dir}/embedded/lib",
692
- "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
693
- }
694
- when "suse"
695
- suse_flags = {
696
- "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
697
- "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
721
+ "CFLAGS" => "-I#{install_dir}/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
698
722
  }
699
- # Enable gcc version 4.8 if it is available
700
- if which("gcc-4.8") && platform_version.satisfies?("< 12")
701
- suse_flags["CC"] = "gcc-4.8"
702
- suse_flags["CXX"] = "g++-4.8"
703
- end
704
- suse_flags
705
723
  when "windows"
706
724
  arch_flag = windows_arch_i386? ? "-m32" : "-m64"
707
725
  opt_flag = windows_arch_i386? ? "-march=i686" : "-march=x86-64"
@@ -721,7 +739,7 @@ module Omnibus
721
739
  else
722
740
  {
723
741
  "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
724
- "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
742
+ "CFLAGS" => "-I#{install_dir}/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
725
743
  }
726
744
  end
727
745
 
@@ -1075,8 +1093,8 @@ module Omnibus
1075
1093
  log.info(log_key) do
1076
1094
  "Forcing a build because resolved version is nil"
1077
1095
  end
1078
- execute_build
1079
- project.dirty!(self)
1096
+ execute_build(build_wrappers)
1097
+ project.dirty!(self) unless project.dirty? # omnibus can only be mildly dirty
1080
1098
  elsif project.dirty?
1081
1099
  log.info(log_key) do
1082
1100
  "Building because `#{project.culprit.name}' dirtied the cache"
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2014-2018 Chef Software, Inc.
2
+ # Copyright 2014-2020, 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.
@@ -14,31 +14,22 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "chef/sugar/architecture"
18
- require "chef/sugar/cloud"
19
- require "chef/sugar/constraints"
20
- require "chef/sugar/ip"
21
- require "chef/sugar/init"
22
- require "chef/sugar/platform"
23
- require "chef/sugar/platform_family"
24
- require "chef/sugar/ruby"
25
- require "chef/sugar/shell"
26
- require "chef/sugar/vagrant"
17
+ require "chef-utils" unless defined?(ChefUtils::CANARY)
27
18
 
28
19
  module Omnibus
29
20
  module Sugarable
30
21
  def self.extended(base)
31
- base.send(:extend, Chef::Sugar::DSL)
22
+ base.send(:extend, ChefUtils)
32
23
  base.send(:extend, Omnibus::Sugar)
33
24
  end
34
25
 
35
26
  def self.included(base)
36
- base.send(:include, Chef::Sugar::DSL)
27
+ base.send(:include, ChefUtils)
37
28
  base.send(:include, Omnibus::Sugar)
38
29
 
39
30
  if base < Cleanroom
40
31
  # Make all the "sugars" available in the cleanroom (DSL)
41
- Chef::Sugar::DSL.instance_methods.each do |instance_method|
32
+ ChefUtils.instance_methods.each do |instance_method|
42
33
  base.send(:expose, instance_method)
43
34
  end
44
35
 
@@ -13,7 +13,7 @@
13
13
  # See the License for the specific language governing permissions and
14
14
  # limitations under the License.
15
15
  #
16
- require "erb"
16
+ require "erb" unless defined?(Erb)
17
17
 
18
18
  module Omnibus
19
19
  module Templating
@@ -15,8 +15,6 @@
15
15
  # limitations under the License.
16
16
  #
17
17
 
18
- require "thread"
19
-
20
18
  module Omnibus
21
19
  class ThreadPool
22
20
 
data/lib/omnibus/util.rb CHANGED
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "mixlib/shellout"
17
+ require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
18
18
 
19
19
  module Omnibus
20
20
  module Util
@@ -15,5 +15,5 @@
15
15
  #
16
16
 
17
17
  module Omnibus
18
- VERSION = "6.1.9".freeze
18
+ VERSION = "8.0.15".freeze
19
19
  end
@@ -1,5 +1,5 @@
1
1
 
2
- # Copyright 2012-2018 Chef Software, Inc.
2
+ # Copyright 2012-2020, 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.
@@ -16,6 +16,7 @@
16
16
 
17
17
  WHITELIST_LIBS = [
18
18
  /ld-linux/,
19
+ /libanl\.so/,
19
20
  /libc\.so/,
20
21
  /libcrypt\.so/,
21
22
  /libdl/,
@@ -33,6 +34,7 @@ WHITELIST_LIBS = [
33
34
  ].freeze
34
35
 
35
36
  ARCH_WHITELIST_LIBS = [
37
+ /libanl\.so/,
36
38
  /libc\.so/,
37
39
  /libcrypt\.so/,
38
40
  /libdb-5\.3\.so/,
@@ -56,6 +58,27 @@ AIX_WHITELIST_LIBS = [
56
58
  /unix$/,
57
59
  ].freeze
58
60
 
61
+ OMNIOS_WHITELIST_LIBS = [
62
+ /libc\.so\.1/,
63
+ /libcrypt\./,
64
+ /libcrypt\.so\.1/,
65
+ /libdl\.so\.1/,
66
+ /libgcc_s\.so\.1/,
67
+ /libgen\.so\.1/,
68
+ /libm\.so\.2/,
69
+ /libmd\.so\.1/,
70
+ /libmp\.so/,
71
+ /libmp\.so\.2/,
72
+ /libnsl\.so\.1/,
73
+ /libpthread\.so\.1/,
74
+ /librt\.so\.1/,
75
+ /libsocket\.so\.1/,
76
+ /libssp\.s/,
77
+ /libssp\.so./,
78
+ /libssp\.so\.0/,
79
+ /libgcc_s\.so\.1/,
80
+ ].freeze
81
+
59
82
  SOLARIS_WHITELIST_LIBS = [
60
83
  /libaio\.so/,
61
84
  /libavl\.so/,
data/omnibus.gemspec CHANGED
@@ -1,5 +1,4 @@
1
- # -*- encoding: utf-8 -*-
2
- lib = File.expand_path("../lib", __FILE__)
1
+ lib = File.expand_path("lib", __dir__)
3
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
3
  require "omnibus/version"
5
4
 
@@ -13,7 +12,7 @@ Gem::Specification.new do |gem|
13
12
  gem.description = gem.summary
14
13
  gem.homepage = "https://github.com/chef/omnibus"
15
14
 
16
- gem.required_ruby_version = ">= 2.4"
15
+ gem.required_ruby_version = ">= 2.6"
17
16
 
18
17
  gem.files = %w{ LICENSE README.md Rakefile Gemfile } + Dir.glob("*.gemspec") + Dir.glob("{bin,lib,resources,spec}/**/{*,.kitchen*}")
19
18
  gem.bindir = "bin"
@@ -22,13 +21,13 @@ Gem::Specification.new do |gem|
22
21
  gem.require_paths = ["lib"]
23
22
 
24
23
  gem.add_dependency "aws-sdk-s3", "~> 1"
25
- gem.add_dependency "chef-sugar-ng", ">= 3.3"
24
+ gem.add_dependency "chef-utils", ">= 15.4"
26
25
  gem.add_dependency "chef-cleanroom", "~> 1.0"
27
26
  gem.add_dependency "ffi-yajl", "~> 2.2"
28
27
  gem.add_dependency "mixlib-shellout", ">= 2.0", "< 4.0"
29
- gem.add_dependency "ohai", ">= 13", "< 16"
28
+ gem.add_dependency "ohai", ">= 15"
30
29
  gem.add_dependency "ruby-progressbar", "~> 1.7"
31
- gem.add_dependency "thor", "~> 0.18"
30
+ gem.add_dependency "thor", ">= 0.18", "< 2.0"
32
31
  gem.add_dependency "license_scout", "~> 1.0"
33
32
 
34
33
  gem.add_dependency "mixlib-versioning"
@@ -36,8 +35,8 @@ Gem::Specification.new do |gem|
36
35
 
37
36
  gem.add_development_dependency "artifactory", "~> 3.0"
38
37
  gem.add_development_dependency "aruba", "~> 0.5"
39
- gem.add_development_dependency "chefstyle", "= 0.13.3"
40
- gem.add_development_dependency "fauxhai", ">= 5.2"
38
+ gem.add_development_dependency "chefstyle", "= 1.6.2"
39
+ gem.add_development_dependency "fauxhai-ng", ">= 7.5"
41
40
  gem.add_development_dependency "rspec", "~> 3.0"
42
41
  gem.add_development_dependency "rspec-json_expectations"
43
42
  gem.add_development_dependency "rspec-its"
@@ -2,3 +2,4 @@
2
2
  <transform file depend -> edit pkg.debug.depend.file ruby env>
3
3
  <transform file depend -> edit pkg.debug.depend.file make env>
4
4
  <transform file depend -> edit pkg.debug.depend.file perl env>
5
+ <transform file depend -> edit pkg.debug.depend.path usr/local/bin usr/bin>
@@ -21,20 +21,12 @@
21
21
  <Media Id="1" Cabinet="Project.cab" EmbedCab="yes" CompressionLevel="high" />
22
22
 
23
23
  <!--
24
- Take advantage of Windows Installer 5.0 feature (if available) to disable
25
- checkpointing and other costings that take significant amounts of time
24
+ Take advantage of Windows Installer 5.0 feature (if available) to disable
25
+ checkpointing and other costings that take significant amounts of time
26
26
  ref: https://msdn.microsoft.com/en-us/library/windows/desktop/dd408005(v=vs.85).aspx
27
27
  -->
28
28
  <Property Id="MSIFASTINSTALL" Value="7" />
29
29
 
30
- <!--
31
- Uncomment launch condition below to check for minimum OS
32
- 601 = Windows 7/Server 2008R2.
33
- -->
34
- <!-- Condition Message="!(loc.MinimumOSVersionMessage)">
35
- <![CDATA[Installed OR VersionNT >= 601]]>
36
- </Condition -->
37
-
38
30
  <!-- We always do Major upgrades -->
39
31
  <MajorUpgrade DowngradeErrorMessage="!(loc.DowngradeErrorMessage)" />
40
32