omnibus 7.0.13 → 8.1.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 +1 -6
  3. data/README.md +38 -6
  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 +16 -11
  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/compressors/base.rb +1 -1
  13. data/lib/omnibus/compressors/dmg.rb +5 -2
  14. data/lib/omnibus/compressors/tgz.rb +2 -2
  15. data/lib/omnibus/config.rb +1 -1
  16. data/lib/omnibus/core_extensions/open_uri.rb +1 -1
  17. data/lib/omnibus/digestable.rb +2 -2
  18. data/lib/omnibus/download_helpers.rb +6 -2
  19. data/lib/omnibus/fetchers/file_fetcher.rb +1 -1
  20. data/lib/omnibus/fetchers/net_fetcher.rb +1 -1
  21. data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
  22. data/lib/omnibus/file_syncer.rb +1 -1
  23. data/lib/omnibus/generator.rb +2 -2
  24. data/lib/omnibus/generator_files/README.md.erb +2 -1
  25. data/lib/omnibus/git_cache.rb +2 -2
  26. data/lib/omnibus/health_check.rb +2 -0
  27. data/lib/omnibus/licensing.rb +2 -2
  28. data/lib/omnibus/logger.rb +1 -1
  29. data/lib/omnibus/manifest.rb +1 -1
  30. data/lib/omnibus/manifest_diff.rb +7 -13
  31. data/lib/omnibus/metadata.rb +8 -4
  32. data/lib/omnibus/ohai.rb +1 -1
  33. data/lib/omnibus/package.rb +1 -1
  34. data/lib/omnibus/packager.rb +6 -14
  35. data/lib/omnibus/packagers/base.rb +1 -1
  36. data/lib/omnibus/packagers/msi.rb +1 -1
  37. data/lib/omnibus/packagers/pkg.rb +14 -4
  38. data/lib/omnibus/packagers/rpm.rb +23 -9
  39. data/lib/omnibus/packagers/solaris.rb +1 -1
  40. data/lib/omnibus/project.rb +2 -2
  41. data/lib/omnibus/publishers/artifactory_publisher.rb +2 -2
  42. data/lib/omnibus/s3_cache.rb +1 -1
  43. data/lib/omnibus/s3_helpers.rb +1 -1
  44. data/lib/omnibus/software.rb +5 -16
  45. data/lib/omnibus/sugarable.rb +5 -14
  46. data/lib/omnibus/templating.rb +1 -1
  47. data/lib/omnibus/thread_pool.rb +0 -2
  48. data/lib/omnibus/util.rb +1 -1
  49. data/lib/omnibus/version.rb +1 -1
  50. data/lib/omnibus/whitelist.rb +22 -0
  51. data/omnibus.gemspec +8 -8
  52. data/resources/ips/doc-transform.erb +1 -0
  53. data/resources/msi/CustomActionFastMsi.CA.dll +0 -0
  54. data/resources/msi/source.wxs.erb +2 -10
  55. data/resources/pkg/distribution.xml.erb +1 -1
  56. data/resources/rpm/spec.erb +2 -2
  57. data/spec/functional/fetchers/net_fetcher_spec.rb +2 -11
  58. data/spec/support/path_helpers.rb +2 -2
  59. data/spec/unit/compressor_spec.rb +2 -2
  60. data/spec/unit/compressors/dmg_spec.rb +12 -9
  61. data/spec/unit/compressors/tgz_spec.rb +4 -4
  62. data/spec/unit/fetchers/net_fetcher_spec.rb +5 -1
  63. data/spec/unit/metadata_spec.rb +8 -6
  64. data/spec/unit/packager_spec.rb +7 -14
  65. data/spec/unit/packagers/ips_spec.rb +1 -0
  66. data/spec/unit/packagers/pkg_spec.rb +20 -4
  67. data/spec/unit/packagers/rpm_spec.rb +15 -5
  68. data/spec/unit/project_spec.rb +6 -6
  69. data/spec/unit/software_spec.rb +29 -120
  70. metadata +36 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b8e292781fd46583f4195ce255dbec39378b8d992b3e631d252c5b910c0ddb39
4
- data.tar.gz: aea8d5eadd707ea46c044b6daba1ccbfe0e8e773a11a6fe370f5a26889e37aab
3
+ metadata.gz: af309d0053f4ea4f740cbf3268c4e4d0087e014ab9abfaca3899c279b41a7a88
4
+ data.tar.gz: f7c125f7f25811d2b74a7aa03b7065594e4b887f520ff7432e7409b7855ab898
5
5
  SHA512:
6
- metadata.gz: 7216812fbdc500947bbdc3f9c8143304937e6abbcc063b4afb404b2f1971018239fe3125327fbcd6622ca082736fe729f28f2fafbaf62d4d4e706f62259fcd91
7
- data.tar.gz: f93962e1f2d9c90e67c4c549937573fb9812c19fddc5f2ad09219214892e2f0b3818d2d206d6eb5138962b2697679ff785a831a41f551f967084de9f1c9e7b81
6
+ metadata.gz: 1227ee4ad5223279042ed600811c2348f10d78abe08859b27a4552a4dd81bdd554842b007ed43ee7aa79403cc9512117733a5db50b9f16dd104d0033a63ef45b
7
+ data.tar.gz: 8683b174eeb40459b16bf337c7d1e0421b9642172e34e4a61d93348296d45b0fcf9d1272971ac43cdfeee4eb899659c8856ffc2fc0cbc84138b57f481e231107
data/Gemfile CHANGED
@@ -11,10 +11,5 @@ end
11
11
  group :debug do
12
12
  gem "pry"
13
13
  gem "pry-byebug"
14
- gem "pry-stack_explorer", "~> 0.4.0" # 0.4 allows us to still test Ruby 2.5
15
- end
16
-
17
- if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.5")
18
- gem "ohai", "<15"
19
- gem "activesupport", "~> 5.0"
14
+ gem "pry-stack_explorer"
20
15
  end
data/README.md CHANGED
@@ -2,7 +2,6 @@
2
2
 
3
3
  [![Gem Version](http://img.shields.io/gem/v/omnibus.svg)][gem]
4
4
  [![Build Status](https://badge.buildkite.com/446fd6049a9a5eeab50112aba117d3b7670ec085acb91f78dd.svg?branch=master)](https://buildkite.com/chef-oss/chef-omnibus-master-verify)
5
- [![AppVeyor Build Status](http://img.shields.io/appveyor/ci/chef/omnibus.svg?label=AppVeyor)][appveyor]
6
5
 
7
6
  **Umbrella Project**: [Chef Foundation](https://github.com/chef/chef-oss-practices/blob/master/projects/chef-foundation.md)
8
7
 
@@ -16,7 +15,6 @@ Easily create full-stack installers for your project across a variety of platfor
16
15
 
17
16
  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
17
 
19
- - [Video](http://www.youtube.com/watch?v=q8iJAntXCNY)
20
18
  - [Slides](https://speakerdeck.com/schisamo/eat-the-whole-bowl-building-a-full-stack-installer-with-omnibus)
21
19
 
22
20
  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 +23,7 @@ This project is managed by the CHEF Release Engineering team. For more informati
25
23
 
26
24
  Omnibus is designed to run with a minimal set of prerequisites. You will need the following:
27
25
 
28
- - Ruby 2.4+
29
- - Bundler
26
+ - Ruby 2.6+
30
27
 
31
28
  ## Get Started
32
29
 
@@ -46,10 +43,11 @@ $ omnibus new $MY_PROJECT_NAME
46
43
 
47
44
  This will generate a complete project skeleton in the directory `omnibus-$MY_PROJECT_NAME`
48
45
 
46
+ 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.
47
+
49
48
  ```bash
50
49
  $ cd omnibus-$MY_PROJECT_NAME
51
50
  $ bundle install --binstubs
52
- $ bin/omnibus build $MY_PROJECT_NAME
53
51
  ```
54
52
 
55
53
  More details can be found in the generated project's README file.
@@ -143,7 +141,7 @@ DSL Method | Description
143
141
  `package` | Invoke a packager-specific DSL
144
142
  `compress` | Invoke a compressor-specific DSL
145
143
 
146
- 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.
144
+ 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.
147
145
 
148
146
  For more information, please see the [`Project` documentation](http://www.rubydoc.info/github/chef/omnibus/Omnibus/Project).
149
147
 
@@ -267,6 +265,40 @@ $PWD/config/software/foo.rb
267
265
 
268
266
  The first instance of `foo.rb` that is encountered will be used. Please note that **local** (vendored) softare definitions take precedence!
269
267
 
268
+ ## Building
269
+
270
+ Once you've created your package and software definitions you can build with:
271
+
272
+ ```shell
273
+ ./bin/omnibus build $MY_PACKAGE_NAME
274
+ ```
275
+
276
+ However there are several caveats to be aware of:
277
+
278
+ 1. You will almost certainly want to uncomment the `base_dir` in `omnibus.rb`,
279
+ or at the very least change `cache_dir` and `build_dir` as otherwise it'll try
280
+ to use `/var/cache/omnibus` and `/opt/$MY_PROJECT_NAME`, requiring root.
281
+ 1. The default configuration created for you references a lot of things
282
+ that are in the default config that come from the `omnibus-software` gem.
283
+ So you want to use those you'll need to either uncomment it in the `Gemfile`,
284
+ or fork it, and then reference your own
285
+ 1. If this is a ruby project and you want binstubs in `/opt/$project/bin`, you
286
+ will either need to use [appbundler](https://github.com/chef/appbundler), or
287
+ you will need to have a post install step to create those binstubs.
288
+ - Side note, appbundler requires that you include your Gemfile and gemspec
289
+ in your gem.
290
+ - Also, needs to be in your Gemfile for you to use it, as it also must
291
+ be in the resulting gem.
292
+ 1. If you specify an override of the version of the `ruby`, you will also need
293
+ to override `rubygems` and `bundler` to match the versions in that version of
294
+ `ruby` or you'll get failures around bundler version mismatches.
295
+
296
+ The build command above will of course build on your local host thus being
297
+ specific to the OS and base system you are on. But the skeleten setup by
298
+ `omnibus new` already setup kitchen for you so that it's easy to build for
299
+ a variety of OSes, See the `README.md` in your generated omnibus directory
300
+ for details.
301
+
270
302
  ## Version Manifest
271
303
 
272
304
  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:
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
@@ -373,11 +373,16 @@ module Omnibus
373
373
  # @param (see #command)
374
374
  # @return (see #command)
375
375
  #
376
- def appbundle(software_name, lockdir: nil, gem: nil, without: nil, extra_bin_files: nil , **options)
376
+ def appbundle(software_name, options = {})
377
377
  build_commands << BuildCommand.new("appbundle `#{software_name}'") do
378
378
  bin_dir = "#{install_dir}/bin"
379
379
  appbundler_bin = embedded_bin("appbundler")
380
380
 
381
+ lockdir = options.delete(:lockdir)
382
+ gem = options.delete(:gem)
383
+ without = options.delete(:without)
384
+ extra_bin_files = options.delete(:extra_bin_files)
385
+
381
386
  lockdir ||=
382
387
  begin
383
388
  app_software = project.softwares.find do |p|
@@ -535,7 +540,7 @@ module Omnibus
535
540
  def mkdir(directory, options = {})
536
541
  build_commands << BuildCommand.new("mkdir `#{directory}'") do
537
542
  Dir.chdir(software.project_dir) do
538
- FileUtils.mkdir_p(directory, options)
543
+ FileUtils.mkdir_p(directory, **options)
539
544
  end
540
545
  end
541
546
  end
@@ -557,7 +562,7 @@ module Omnibus
557
562
  parent = File.dirname(file)
558
563
  FileUtils.mkdir_p(parent) unless File.directory?(parent)
559
564
 
560
- FileUtils.touch(file, options)
565
+ FileUtils.touch(file, **options)
561
566
  end
562
567
  end
563
568
  end
@@ -578,7 +583,7 @@ module Omnibus
578
583
  build_commands << BuildCommand.new("delete `#{path}'") do
579
584
  Dir.chdir(software.project_dir) do
580
585
  FileSyncer.glob(path).each do |file|
581
- FileUtils.rm_rf(file, options)
586
+ FileUtils.rm_rf(file, **options)
582
587
  end
583
588
  end
584
589
  end
@@ -629,7 +634,7 @@ module Omnibus
629
634
  log.warn(log_key) { "no matched files for glob #{command}" }
630
635
  else
631
636
  files.each do |file|
632
- FileUtils.cp_r(file, destination, options)
637
+ FileUtils.cp_r(file, destination, **options)
633
638
  end
634
639
  end
635
640
  end
@@ -658,7 +663,7 @@ module Omnibus
658
663
  log.warn(log_key) { "no matched files for glob #{command}" }
659
664
  else
660
665
  files.each do |file|
661
- FileUtils.mv(file, destination, options)
666
+ FileUtils.mv(file, destination, **options)
662
667
  end
663
668
  end
664
669
  end
@@ -690,7 +695,7 @@ module Omnibus
690
695
  log.warn(log_key) { "no matched files for glob #{command}" }
691
696
  else
692
697
  files.each do |file|
693
- FileUtils.ln_s(file, destination, options)
698
+ FileUtils.ln_s(file, destination, **options)
694
699
  end
695
700
  end
696
701
  end
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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
  module FileSyncer
@@ -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 Generator < Thor::Group
@@ -73,7 +73,7 @@ module Omnibus
73
73
  class << self
74
74
  # Set the source root for Thor
75
75
  def source_root
76
- File.expand_path("../generator_files", __FILE__)
76
+ File.expand_path("generator_files", __dir__)
77
77
  end
78
78
  end
79
79
 
@@ -114,7 +114,8 @@ section:
114
114
  ```shell
115
115
  $ bin/kitchen login ubuntu-1804
116
116
  [vagrant@ubuntu...] $ . load-omnibus-toolchain.sh
117
- [vagrant@ubuntu...] $ cd <%= config[:name] %>
117
+ [vagrant@ubuntu...] $ [ -e .bundle ] && sudo chown -R vagrant:vagrant .bundle
118
+ [vagrant@ubuntu...] $ cd <%= config[:name] %> # or 'cd <%= config[:name] %>/omnibus' if your omnibus project is embedded in your main project
118
119
  [vagrant@ubuntu...] $ bundle install
119
120
  [vagrant@ubuntu...] $ bin/omnibus build <%= config[:name] %>
120
121
  ```