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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 13c799a70980298bd1b9a949570129950948678e848013b5cc45e9c16163eed4
4
- data.tar.gz: f674f27153dd215d6718e988b6d4bc7b8c30e3b3b00e3b89aaffbab1c14a7bdd
3
+ metadata.gz: 585e2c596ef1c84a2e679f73503cc00480fe5ef7484c35febaa0c3f9591d1cb2
4
+ data.tar.gz: 0d05d3f29a6d5e596f0e0e27c3077dda52f6f0a263d7481ce1ef3372a2aa07b4
5
5
  SHA512:
6
- metadata.gz: 7bd5732c6df36ef63dff1bf783117fe40eb49934209e41fe4f5b9f03e64998a3f69e30d86183b4b70d9f9780682a8641bb1bde8c229213be53b69f30d6267259
7
- data.tar.gz: 74bbdef1a133d657e75853a0a44ee3eea4dc461bc8fda2a52c5623656e0a289f1c40ba9906da8179686e3998354a088d5e2410dfe6b2519c41f45823613317c6
6
+ metadata.gz: 337957c5a64cd387614afd55193a739b5e668857f7858c5ef5665f77e7a8dc58709e94c04a6d497ee32502b37045b6089adea9b4f0e4991e0b93fd80218007e5
7
+ data.tar.gz: 66b99392d12b7a3c5757300b57243e856c7f0c67a132ebc39b4a74df84a03f5a6711903ae88325e8270c9930218147b93d53b3c83e1984ab48875f92a6f367d5
data/Gemfile CHANGED
@@ -13,7 +13,3 @@ group :debug do
13
13
  gem "pry-byebug"
14
14
  gem "pry-stack_explorer"
15
15
  end
16
-
17
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.5")
18
- gem "ohai", "<15"
19
- end
data/README.md CHANGED
@@ -16,7 +16,6 @@ Easily create full-stack installers for your project across a variety of platfor
16
16
 
17
17
  Seth Chisamore and Christopher Maier of CHEF gave an introductory talk on Omnibus at ChefConf 2013, entitled **Eat the Whole Bowl: Building a Full-Stack Installer with Omnibus**:
18
18
 
19
- - [Video](http://www.youtube.com/watch?v=q8iJAntXCNY)
20
19
  - [Slides](https://speakerdeck.com/schisamo/eat-the-whole-bowl-building-a-full-stack-installer-with-omnibus)
21
20
 
22
21
  This project is managed by the CHEF Release Engineering team. For more information on the Release Engineering team's contribution, triage, and release process, please consult the [CHEF Release Engineering OSS Management Guide](https://docs.google.com/a/opscode.com/document/d/1oJB0vZb_3bl7_ZU2YMDBkMFdL-EWplW1BJv_FXTUOzg/edit).
@@ -25,8 +24,7 @@ This project is managed by the CHEF Release Engineering team. For more informati
25
24
 
26
25
  Omnibus is designed to run with a minimal set of prerequisites. You will need the following:
27
26
 
28
- - Ruby 2.4+
29
- - Bundler
27
+ - Ruby 2.6+
30
28
 
31
29
  ## Get Started
32
30
 
@@ -46,10 +44,11 @@ $ omnibus new $MY_PROJECT_NAME
46
44
 
47
45
  This will generate a complete project skeleton in the directory `omnibus-$MY_PROJECT_NAME`
48
46
 
47
+ By default this will make a directory called `omnibus-$MY_PROJECT_NAME` assuming you're keeping your omnibus config separate from the repo. However, keeping it *in* your repo is a common practice, so feel to rename this directory to `omnibus` and place it in the top level of your projects source repo.
48
+
49
49
  ```bash
50
50
  $ cd omnibus-$MY_PROJECT_NAME
51
51
  $ bundle install --binstubs
52
- $ bin/omnibus build $MY_PROJECT_NAME
53
52
  ```
54
53
 
55
54
  More details can be found in the generated project's README file.
@@ -84,11 +83,19 @@ use_git_caching false
84
83
  # Enable S3 asset caching
85
84
  # ------------------------------
86
85
  use_s3_caching true
86
+ s3_bucket ENV['S3_BUCKET']
87
+
88
+ # There are three ways to authenticate to the S3 bucket
89
+
90
+ # 1. set `s3_access_key` and `s3_secret_key`
87
91
  s3_access_key ENV['S3_ACCESS_KEY']
88
92
  s3_secret_key ENV['S3_SECRET_KEY']
89
- # You can use the Shared Credentials files in place of the s3_access_key and s3_secret_key.
93
+
94
+ # 2. set `s3_profile` to use an AWS profile in the Shared Credentials files
90
95
  #s3_profile ENV['S3_PROFILE']
91
- s3_bucket ENV['S3_BUCKET']
96
+
97
+ # 3. set `s3_iam_role_arn` to use an AWS IAM role
98
+ #s3_iam_role_arn ENV['S3_IAM_ROLE_ARN']
92
99
  ```
93
100
 
94
101
  For more information, please see the [`Config` documentation](http://www.rubydoc.info/github/chef/omnibus/Omnibus/Config).
@@ -135,7 +142,7 @@ DSL Method | Description
135
142
  `package` | Invoke a packager-specific DSL
136
143
  `compress` | Invoke a compressor-specific DSL
137
144
 
138
- By default a timestamp is appended to the build_version. You can turn this behavior off by setting `append_timestamp` to `false` in your configuration file or using `--override append_timestamp:false` at the command line.
145
+ By default a timestamp is appended to the build_version. You can turn this behavior off by setting `append_timestamp` to `false` in your `omnibus.rb` or using `--override append_timestamp:false` at the command line.
139
146
 
140
147
  For more information, please see the [`Project` documentation](http://www.rubydoc.info/github/chef/omnibus/Omnibus/Project).
141
148
 
@@ -253,12 +260,46 @@ For all of these paths, **order matters**, so it is possible to depend on local
253
260
  $PWD/config/software/foo.rb
254
261
  /path/to/software/config/software/foo.rb
255
262
  /other/path/to/software/config/software/foo.rb
256
- /Users/sethvargo/.gems/.../my-comany-omnibus-software/config/software/foo.rb
263
+ /Users/sethvargo/.gems/.../my-company-omnibus-software/config/software/foo.rb
257
264
  /Users/sethvargo/.gems/.../omnibus-software/config/software/foo.rb
258
265
  ```
259
266
 
260
267
  The first instance of `foo.rb` that is encountered will be used. Please note that **local** (vendored) softare definitions take precedence!
261
268
 
269
+ ## Building
270
+
271
+ Once you've created your package and software definitions you can build with:
272
+
273
+ ```shell
274
+ ./bin/omnibus build $MY_PACKAGE_NAME
275
+ ```
276
+
277
+ However there are several caveats to be aware of:
278
+
279
+ 1. You will almost certainly want to uncomment the `base_dir` in `omnibus.rb`,
280
+ or at the very least change `cache_dir` and `build_dir` as otherwise it'll try
281
+ to use `/var/cache/omnibus` and `/opt/$MY_PROJECT_NAME`, requiring root.
282
+ 1. The default configuration created for you references a lot of things
283
+ that are in the default config that come from the `omnibus-software` gem.
284
+ So you want to use those you'll need to either uncomment it in the `Gemfile`,
285
+ or fork it, and then reference your own
286
+ 1. If this is a ruby project and you want binstubs in `/opt/$project/bin`, you
287
+ will either need to use [appbundler](https://github.com/chef/appbundler), or
288
+ you will need to have a post install step to create those binstubs.
289
+ - Side note, appbundler requires that you include your Gemfile and gemspec
290
+ in your gem.
291
+ - Also, needs to be in your Gemfile for you to use it, as it also must
292
+ be in the resulting gem.
293
+ 1. If you specify an override of the version of the `ruby`, you will also need
294
+ to override `rubygems` and `bundler` to match the versions in that version of
295
+ `ruby` or you'll get failures around bundler version mismatches.
296
+
297
+ The build command above will of course build on your local host thus being
298
+ specific to the OS and base system you are on. But the skeleten setup by
299
+ `omnibus new` already setup kitchen for you so that it's easy to build for
300
+ a variety of OSes, See the `README.md` in your generated omnibus directory
301
+ for details.
302
+
262
303
  ## Version Manifest
263
304
 
264
305
  Git-based software definitions may specify branches as their default_version. In this case, the exact git revision to use will be determined at build-time unless a project override (see below) or external version manifest is used. To generate a version manifest use the `omnibus manifest` command:
@@ -273,7 +314,7 @@ This will output a JSON-formatted manifest containing the resolved version of ev
273
314
 
274
315
  Sometimes a platform has libraries that need to be whitelisted so the healthcheck can pass. The whitelist found in the [healthcheck](https://github.com/chef/omnibus/blob/master/lib/omnibus/health_check.rb) code comprises the minimal required for successful builds on supported platforms.
275
316
 
276
- To add your own whitelisted library, simply add the a regex to your software definition in your omnibus project as follows:
317
+ To add your own whitelisted library, simply add a regex to your software definition in your omnibus project as follows:
277
318
 
278
319
  ```
279
320
  whitelist_file /libpcrecpp\.so\..+/
@@ -289,11 +330,11 @@ STATUS: _EXPERIMENTAL_
289
330
 
290
331
  `omnibus changelog generate` will generate a changelog for an omnibus project. This command currently assumes:
291
332
 
292
- - version-manifest.json is checked into the project root
293
- - the project is a git repository
294
- - each version is tagged with a SemVer compliant annotated tag
333
+ - A version-manifest.json file is checked into the project root
334
+ - The project is a git repository
335
+ - Each version is tagged with a SemVer compliant annotated tag
295
336
  - Any git-based sources are checked out at ../COMPONENT_NAME
296
- - Any commit message line prepended with ChangeLog-Entry: should be added to the changelog.
337
+ - Any commit message line prepended with ChangeLog-Entry: should be added to the changelog
297
338
 
298
339
  These assumptions _will_ change as we determine what works best for a number of our projects.
299
340
 
data/bin/omnibus CHANGED
@@ -4,7 +4,7 @@
4
4
  # https://twitter.com/mitchellh/status/283014103189053442
5
5
  Signal.trap("INT") { exit 1 }
6
6
 
7
- $:.push File.expand_path("../../lib", __FILE__)
7
+ $:.push File.expand_path("../lib", __dir__)
8
8
  $stdout.sync = true
9
9
 
10
10
  require "omnibus/cli"
data/lib/omnibus.rb CHANGED
@@ -17,7 +17,7 @@
17
17
  require "omnibus/core_extensions"
18
18
 
19
19
  require "cleanroom"
20
- require "pathname"
20
+ require "pathname" unless defined?(Pathname)
21
21
 
22
22
  require "omnibus/digestable"
23
23
  require "omnibus/exceptions"
@@ -208,7 +208,7 @@ module Omnibus
208
208
  # @return [Pathname]
209
209
  #
210
210
  def source_root
211
- @source_root ||= Pathname.new(File.expand_path("../..", __FILE__))
211
+ @source_root ||= Pathname.new(File.expand_path("..", __dir__))
212
212
  end
213
213
 
214
214
  #
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "time"
17
+ require "time" unless defined?(Time.zone_offset)
18
18
 
19
19
  module Omnibus
20
20
  # Provides methods for generating Omnibus project build version
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "time"
17
+ require "time" unless defined?(Time.zone_offset)
18
18
 
19
19
  module Omnibus
20
20
  class BuildVersionDSL
@@ -136,12 +136,10 @@ module Omnibus
136
136
  return false if build_info.nil?
137
137
 
138
138
  build_info.split(".").any? do |part|
139
- begin
140
- Time.strptime(part, Omnibus::BuildVersion::TIMESTAMP_FORMAT)
141
- true
142
- rescue ArgumentError
143
- false
144
- end
139
+ Time.strptime(part, Omnibus::BuildVersion::TIMESTAMP_FORMAT)
140
+ true
141
+ rescue ArgumentError
142
+ false
145
143
  end
146
144
  end
147
145
 
@@ -14,10 +14,10 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "fileutils"
18
- require "mixlib/shellout"
19
- require "ostruct"
20
- require "pathname"
17
+ require "fileutils" unless defined?(FileUtils)
18
+ require "mixlib/shellout" unless defined?(Mixlib::ShellOut)
19
+ require "ostruct" unless defined?(OpenStruct)
20
+ require "pathname" unless defined?(Pathname)
21
21
  require "omnibus/whitelist"
22
22
 
23
23
  module Omnibus
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "thor"
17
+ require "thor" unless defined?(Thor)
18
18
 
19
19
  module Omnibus
20
20
  class Cleaner < Thor::Group
data/lib/omnibus/cli.rb CHANGED
@@ -14,9 +14,9 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "thor"
17
+ require "thor" unless defined?(Thor)
18
18
  require "omnibus"
19
- require "ffi_yajl"
19
+ require "ffi_yajl" unless defined?(FFI_Yajl)
20
20
 
21
21
  module Omnibus
22
22
  class CLI < Command::Base
@@ -18,7 +18,7 @@ require "omnibus/changelog"
18
18
  require "omnibus/changelog_printer"
19
19
  require "omnibus/manifest_diff"
20
20
  require "omnibus/semantic_version"
21
- require "ffi_yajl"
21
+ require "ffi_yajl" unless defined?(FFI_Yajl)
22
22
 
23
23
  module Omnibus
24
24
  class Command::ChangeLog < Command::Base
@@ -49,10 +49,10 @@ module Omnibus
49
49
  end
50
50
 
51
51
  if compressors.include?(:tgz)
52
- return TGZ
52
+ TGZ
53
53
  else
54
54
  log.info(log_key) { "No compressor defined for `#{family}'." }
55
- return Null
55
+ Null
56
56
  end
57
57
  end
58
58
  module_function :for_current_system
@@ -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
 
19
19
  module Omnibus
20
20
  class Compressor::Base < Packager::Base
@@ -30,7 +30,7 @@ module Omnibus
30
30
  # @param [Project] project
31
31
  #
32
32
  def initialize(project)
33
- @project = project
33
+ @project = project
34
34
 
35
35
  # There can now be multiple packagers per platform
36
36
  # but windows is the only platform that uses multiple
@@ -259,8 +259,11 @@ module Omnibus
259
259
  sync
260
260
  hdiutil unmount "#{@device}"
261
261
  # Give some time to the system so unmount dmg
262
- sleep 5
263
- hdiutil detach "#{@device}" && \
262
+ ATTEMPTS=1
263
+ until [ $ATTEMPTS -eq 6 ] || hdiutil detach "#{@device}"; do
264
+ sleep 10
265
+ echo Attempt number $(( ATTEMPTS++ ))
266
+ done
264
267
  hdiutil convert \\
265
268
  "#{writable_dmg}" \\
266
269
  -format UDZO \\
@@ -14,8 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "rubygems/package"
18
- require "zlib"
17
+ require "rubygems/package" unless defined?(Gem::Package)
18
+ require "zlib" unless defined?(Zlib)
19
19
 
20
20
  module Omnibus
21
21
  class Compressor::TGZ < Compressor::Base
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "singleton"
17
+ require "singleton" unless defined?(Singleton)
18
18
 
19
19
  module Omnibus
20
20
  class Config
@@ -285,7 +285,7 @@ module Omnibus
285
285
  #
286
286
  # @return [String, nil]
287
287
  default(:s3_access_key) do
288
- if s3_profile
288
+ if s3_profile || s3_iam_role_arn
289
289
  nil
290
290
  else
291
291
  raise MissingRequiredAttribute.new(self, :s3_access_key, "'ABCD1234'")
@@ -296,7 +296,7 @@ module Omnibus
296
296
  #
297
297
  # @return [String, nil]
298
298
  default(:s3_secret_key) do
299
- if s3_profile
299
+ if s3_profile || s3_iam_role_arn
300
300
  nil
301
301
  else
302
302
  raise MissingRequiredAttribute.new(self, :s3_secret_key, "'EFGH5678'")
@@ -308,6 +308,11 @@ module Omnibus
308
308
  # @return [String, nil]
309
309
  default(:s3_profile, nil)
310
310
 
311
+ # The AWS IAM role arn to use with S3 caching.
312
+ #
313
+ # @return [String, nil]
314
+ default(:s3_iam_role_arn, nil)
315
+
311
316
  # The region of the S3 bucket you want to cache software artifacts in.
312
317
  # Defaults to 'us-east-1'
313
318
  #
@@ -455,6 +460,11 @@ module Omnibus
455
460
  # @return [String, nil]
456
461
  default(:publish_s3_profile, nil)
457
462
 
463
+ # The AWS IAM role arn to use with S3 publisher.
464
+ #
465
+ # @return [String, nil]
466
+ default(:publish_s3_iam_role_arn, nil)
467
+
458
468
  # Directory pattern for the S3 publisher.
459
469
  # Interpolation of metadata keys is supported.
460
470
  #
@@ -1,4 +1,4 @@
1
- require "open-uri"
1
+ require "open-uri" unless defined?(OpenURI)
2
2
 
3
3
  module OpenURI
4
4
  class << self
@@ -14,8 +14,8 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "openssl"
18
- require "pathname"
17
+ require "openssl" unless defined?(OpenSSL)
18
+ require "pathname" unless defined?(Pathname)
19
19
  require "omnibus/logging"
20
20
 
21
21
  module Omnibus
@@ -14,7 +14,7 @@
14
14
  # limitations under the License.
15
15
  #
16
16
 
17
- require "open-uri"
17
+ require "open-uri" unless defined?(OpenURI)
18
18
  require "ruby-progressbar"
19
19
 
20
20
  module Omnibus
@@ -77,7 +77,11 @@ module Omnibus
77
77
  end
78
78
  end
79
79
 
80
- file = open(from_url, options)
80
+ if RUBY_VERSION.to_f < 2.7
81
+ file = open(from_url, options)
82
+ else
83
+ file = URI.open(from_url, options)
84
+ end
81
85
  # This is a temporary file. Close and flush it before attempting to copy
82
86
  # it over.
83
87
  file.close
@@ -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
 
19
19
  module Omnibus
20
20
  class FileFetcher < Fetcher
@@ -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/download_helpers"
19
19
 
20
20
  module Omnibus
@@ -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
 
19
19
  module Omnibus
20
20
  class PathFetcher < Fetcher