omnibus 6.0.25 → 7.0.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +4 -3
  3. data/README.md +25 -9
  4. data/Rakefile +1 -1
  5. data/lib/omnibus/build_version_dsl.rb +1 -0
  6. data/lib/omnibus/builder.rb +10 -7
  7. data/lib/omnibus/changelog_printer.rb +7 -4
  8. data/lib/omnibus/cleaner.rb +3 -0
  9. data/lib/omnibus/cli.rb +1 -1
  10. data/lib/omnibus/cli/changelog.rb +24 -24
  11. data/lib/omnibus/cli/publish.rb +5 -5
  12. data/lib/omnibus/compressor.rb +2 -2
  13. data/lib/omnibus/compressors/base.rb +1 -1
  14. data/lib/omnibus/compressors/dmg.rb +45 -7
  15. data/lib/omnibus/config.rb +12 -2
  16. data/lib/omnibus/fetchers/git_fetcher.rb +1 -0
  17. data/lib/omnibus/fetchers/net_fetcher.rb +2 -3
  18. data/lib/omnibus/file_syncer.rb +2 -2
  19. data/lib/omnibus/generator.rb +1 -0
  20. data/lib/omnibus/generator_files/Gemfile.erb +2 -2
  21. data/lib/omnibus/generator_files/README.md.erb +18 -15
  22. data/lib/omnibus/generator_files/config/projects/project.rb.erb +0 -3
  23. data/lib/omnibus/generator_files/config/software/preparation.rb.erb +30 -0
  24. data/lib/omnibus/generator_files/omnibus.rb.erb +5 -4
  25. data/lib/omnibus/health_check.rb +1 -1
  26. data/lib/omnibus/licensing.rb +3 -4
  27. data/lib/omnibus/logger.rb +2 -1
  28. data/lib/omnibus/manifest.rb +1 -1
  29. data/lib/omnibus/metadata.rb +2 -2
  30. data/lib/omnibus/packagers/appx.rb +1 -2
  31. data/lib/omnibus/packagers/base.rb +1 -0
  32. data/lib/omnibus/packagers/bff.rb +6 -8
  33. data/lib/omnibus/packagers/deb.rb +7 -10
  34. data/lib/omnibus/packagers/ips.rb +3 -6
  35. data/lib/omnibus/packagers/makeself.rb +1 -2
  36. data/lib/omnibus/packagers/msi.rb +12 -11
  37. data/lib/omnibus/packagers/pkg.rb +125 -9
  38. data/lib/omnibus/packagers/rpm.rb +13 -12
  39. data/lib/omnibus/packagers/solaris.rb +4 -4
  40. data/lib/omnibus/packagers/windows_base.rb +7 -6
  41. data/lib/omnibus/project.rb +1 -0
  42. data/lib/omnibus/publisher.rb +14 -12
  43. data/lib/omnibus/publishers/s3_publisher.rb +6 -4
  44. data/lib/omnibus/s3_cache.rb +3 -1
  45. data/lib/omnibus/s3_helpers.rb +6 -6
  46. data/lib/omnibus/software.rb +66 -30
  47. data/lib/omnibus/templating.rb +1 -1
  48. data/lib/omnibus/util.rb +3 -2
  49. data/lib/omnibus/version.rb +1 -1
  50. data/lib/omnibus/whitelist.rb +6 -1
  51. data/omnibus.gemspec +7 -6
  52. data/resources/rpm/signing.erb +7 -10
  53. data/spec/functional/builder_spec.rb +2 -1
  54. data/spec/functional/fetchers/file_fetcher_spec.rb +4 -4
  55. data/spec/functional/fetchers/git_fetcher_spec.rb +4 -4
  56. data/spec/functional/fetchers/net_fetcher_spec.rb +5 -6
  57. data/spec/functional/fetchers/path_fetcher_spec.rb +4 -4
  58. data/spec/functional/file_syncer_spec.rb +42 -0
  59. data/spec/functional/licensing_spec.rb +5 -5
  60. data/spec/spec_helper.rb +6 -0
  61. data/spec/support/examples.rb +3 -4
  62. data/spec/unit/builder_spec.rb +9 -9
  63. data/spec/unit/changelogprinter_spec.rb +8 -6
  64. data/spec/unit/compressor_spec.rb +3 -3
  65. data/spec/unit/compressors/dmg_spec.rb +43 -4
  66. data/spec/unit/fetchers/net_fetcher_spec.rb +16 -17
  67. data/spec/unit/generator_spec.rb +1 -0
  68. data/spec/unit/health_check_spec.rb +2 -6
  69. data/spec/unit/library_spec.rb +2 -1
  70. data/spec/unit/manifest_diff_spec.rb +2 -2
  71. data/spec/unit/manifest_spec.rb +1 -1
  72. data/spec/unit/metadata_spec.rb +9 -11
  73. data/spec/unit/omnibus_spec.rb +1 -1
  74. data/spec/unit/packagers/bff_spec.rb +2 -2
  75. data/spec/unit/packagers/msi_spec.rb +2 -2
  76. data/spec/unit/packagers/pkg_spec.rb +354 -0
  77. data/spec/unit/packagers/pkgsrc_spec.rb +1 -1
  78. data/spec/unit/packagers/solaris_spec.rb +7 -7
  79. data/spec/unit/project_spec.rb +2 -2
  80. data/spec/unit/publisher_spec.rb +8 -9
  81. data/spec/unit/publishers/artifactory_publisher_spec.rb +2 -4
  82. data/spec/unit/publishers/s3_publisher_spec.rb +2 -4
  83. data/spec/unit/s3_cacher_spec.rb +19 -6
  84. data/spec/unit/s3_helpers_spec.rb +22 -3
  85. data/spec/unit/software_spec.rb +72 -42
  86. data/spec/unit/util_spec.rb +1 -2
  87. metadata +32 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6e008e08071c850bbd9e8021ce0eb22eb8415aaba92060de5380b399de8841fe
4
- data.tar.gz: 0260e33da4bf4a91ad49e96d8e3c0f08f9f233b8e4eb58b40208c9e8e126b34b
3
+ metadata.gz: 426773f2a6ca96d0f7b36b5df60e01fb17b52bf747c2a19b040499e03737b20e
4
+ data.tar.gz: 8045d8e96683fafa5fcc1357d83701515ebbcd160d16743e1903c5fcb964284c
5
5
  SHA512:
6
- metadata.gz: d8b30760147a6adf9919e3fce9e34c21d7b5045f6a646f02b4c3ad7f0e35f71ee8589697618088d938e701ead1336c4f93c02a96649ad8133d5d489b098d9ca9
7
- data.tar.gz: 1a72c335607d61739ca95d8954f5b745fa990329e1cc3459460c479273d1345c8ca1c70197f1fd8ae4b5c361163108ebf1dabef69317a050d5f7b6ebe7a67664
6
+ metadata.gz: 427f1194c4141ff9ebd69a7bce99c2fb2f136a836e2fa3b99c842b3ae6d271698113027cf29ea25f7ac8a38a81b6448dd44a29faf2895e69f16ec537c0d789de
7
+ data.tar.gz: 7ae973fddc3895fc2bad09fa17316e5bc58aefb7cfa19efb4630fb44dd6a0d1e479715bde34b4d3195b560f704f5d1f47fe8543efe140913694e9723b20cd187
data/Gemfile CHANGED
@@ -11,8 +11,9 @@ end
11
11
  group :debug do
12
12
  gem "pry"
13
13
  gem "pry-byebug"
14
- gem "pry-stack_explorer"
14
+ gem "pry-stack_explorer", "~> 0.4.0" # 0.4 allows us to still test Ruby 2.5
15
15
  end
16
16
 
17
- # this brings in several fixes to rspec-json_expectations that are causing test failures
18
- gem "rspec-json_expectations", git: "https://github.com/tas50/rspec-json_expectations.git"
17
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new("2.5")
18
+ gem "ohai", "<15"
19
+ end
data/README.md CHANGED
@@ -1,9 +1,17 @@
1
1
  # ![Omnibus Icon](lib/omnibus/assets/README-logo.png) Omnibus
2
2
 
3
3
  [![Gem Version](http://img.shields.io/gem/v/omnibus.svg)][gem]
4
- [![Travis Build Status](http://img.shields.io/travis/chef/omnibus.svg?label=Travis%20CI)][travis]
4
+ [![Build Status](https://badge.buildkite.com/446fd6049a9a5eeab50112aba117d3b7670ec085acb91f78dd.svg?branch=master)](https://buildkite.com/chef-oss/chef-omnibus-master-verify)
5
5
  [![AppVeyor Build Status](http://img.shields.io/appveyor/ci/chef/omnibus.svg?label=AppVeyor)][appveyor]
6
6
 
7
+ **Umbrella Project**: [Chef Foundation](https://github.com/chef/chef-oss-practices/blob/master/projects/chef-foundation.md)
8
+
9
+ **Project State**: [Active](https://github.com/chef/chef-oss-practices/blob/master/repo-management/repo-states.md#active)
10
+
11
+ **Issues [Response Time Maximum](https://github.com/chef/chef-oss-practices/blob/master/repo-management/repo-states.md)**: 14 days
12
+
13
+ **Pull Request [Response Time Maximum](https://github.com/chef/chef-oss-practices/blob/master/repo-management/repo-states.md)**: 14 days
14
+
7
15
  Easily create full-stack installers for your project across a variety of platforms.
8
16
 
9
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**:
@@ -76,11 +84,19 @@ use_git_caching false
76
84
  # Enable S3 asset caching
77
85
  # ------------------------------
78
86
  use_s3_caching true
87
+ s3_bucket ENV['S3_BUCKET']
88
+
89
+ # There are three ways to authenticate to the S3 bucket
90
+
91
+ # 1. set `s3_access_key` and `s3_secret_key`
79
92
  s3_access_key ENV['S3_ACCESS_KEY']
80
93
  s3_secret_key ENV['S3_SECRET_KEY']
81
- # You can use the Shared Credentials files in place of the s3_access_key and s3_secret_key.
94
+
95
+ # 2. set `s3_profile` to use an AWS profile in the Shared Credentials files
82
96
  #s3_profile ENV['S3_PROFILE']
83
- s3_bucket ENV['S3_BUCKET']
97
+
98
+ # 3. set `s3_iam_role_arn` to use an AWS IAM role
99
+ #s3_iam_role_arn ENV['S3_IAM_ROLE_ARN']
84
100
  ```
85
101
 
86
102
  For more information, please see the [`Config` documentation](http://www.rubydoc.info/github/chef/omnibus/Omnibus/Config).
@@ -245,7 +261,7 @@ For all of these paths, **order matters**, so it is possible to depend on local
245
261
  $PWD/config/software/foo.rb
246
262
  /path/to/software/config/software/foo.rb
247
263
  /other/path/to/software/config/software/foo.rb
248
- /Users/sethvargo/.gems/.../my-comany-omnibus-software/config/software/foo.rb
264
+ /Users/sethvargo/.gems/.../my-company-omnibus-software/config/software/foo.rb
249
265
  /Users/sethvargo/.gems/.../omnibus-software/config/software/foo.rb
250
266
  ```
251
267
 
@@ -265,7 +281,7 @@ This will output a JSON-formatted manifest containing the resolved version of ev
265
281
 
266
282
  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.
267
283
 
268
- To add your own whitelisted library, simply add the a regex to your software definition in your omnibus project as follows:
284
+ To add your own whitelisted library, simply add a regex to your software definition in your omnibus project as follows:
269
285
 
270
286
  ```
271
287
  whitelist_file /libpcrecpp\.so\..+/
@@ -281,11 +297,11 @@ STATUS: _EXPERIMENTAL_
281
297
 
282
298
  `omnibus changelog generate` will generate a changelog for an omnibus project. This command currently assumes:
283
299
 
284
- - version-manifest.json is checked into the project root
285
- - the project is a git repository
286
- - each version is tagged with a SemVer compliant annotated tag
300
+ - A version-manifest.json file is checked into the project root
301
+ - The project is a git repository
302
+ - Each version is tagged with a SemVer compliant annotated tag
287
303
  - Any git-based sources are checked out at ../COMPONENT_NAME
288
- - Any commit message line prepended with ChangeLog-Entry: should be added to the changelog.
304
+ - Any commit message line prepended with ChangeLog-Entry: should be added to the changelog
289
305
 
290
306
  These assumptions _will_ change as we determine what works best for a number of our projects.
291
307
 
data/Rakefile CHANGED
@@ -1,7 +1,7 @@
1
1
  require "bundler/gem_tasks"
2
2
 
3
3
  require "rspec/core/rake_task"
4
- [:unit, :functional].each do |type|
4
+ %i{unit functional}.each do |type|
5
5
  RSpec::Core::RakeTask.new(type) do |t|
6
6
  t.pattern = "spec/#{type}/**/*_spec.rb"
7
7
  t.rspec_opts = [].tap do |a|
@@ -134,6 +134,7 @@ module Omnibus
134
134
  def has_timestamp?(version)
135
135
  _ver, build_info = version.split("+")
136
136
  return false if build_info.nil?
137
+
137
138
  build_info.split(".").any? do |part|
138
139
  begin
139
140
  Time.strptime(part, Omnibus::BuildVersion::TIMESTAMP_FORMAT)
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2012-2018, Chef Software Inc.
2
+ # Copyright 2012-2019, 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.
@@ -235,7 +235,8 @@ module Omnibus
235
235
  clean_patch_path = patch_path
236
236
  if windows?
237
237
  clean_patch_path = Pathname.new(patch_path).relative_path_from(
238
- Pathname.new(software.project_dir)).to_s
238
+ Pathname.new(software.project_dir)
239
+ ).to_s
239
240
  end
240
241
 
241
242
  if target
@@ -372,7 +373,7 @@ module Omnibus
372
373
  # @param (see #command)
373
374
  # @return (see #command)
374
375
  #
375
- def appbundle(software_name, lockdir: nil, gem: nil, without: nil, **options)
376
+ def appbundle(software_name, lockdir: nil, gem: nil, without: nil, extra_bin_files: nil , **options)
376
377
  build_commands << BuildCommand.new("appbundle `#{software_name}'") do
377
378
  bin_dir = "#{install_dir}/bin"
378
379
  appbundler_bin = embedded_bin("appbundler")
@@ -385,6 +386,7 @@ module Omnibus
385
386
  if app_software.nil?
386
387
  raise "could not find software definition for #{software_name}, add a dependency to it, or pass a lockdir argument to appbundle command."
387
388
  end
389
+
388
390
  app_software.project_dir
389
391
  end
390
392
 
@@ -400,6 +402,8 @@ module Omnibus
400
402
  # get `--without` support, you will likely wind up going down a sad path).
401
403
  command << [ "--without", without.join(",") ] unless without.nil?
402
404
 
405
+ command << [ "--extra-bin-files", extra_bin_files.join(",") ] unless extra_bin_files.nil? || extra_bin_files.empty?
406
+
403
407
  # Ensure the main bin dir exists
404
408
  FileUtils.mkdir_p(bin_dir)
405
409
 
@@ -498,8 +502,7 @@ module Omnibus
498
502
  render_template(source_path,
499
503
  destination: dest,
500
504
  mode: mode,
501
- variables: vars
502
- )
505
+ variables: vars)
503
506
  end
504
507
  end
505
508
  expose :erb
@@ -594,7 +597,7 @@ module Omnibus
594
597
  #
595
598
  def strip(path)
596
599
  regexp_ends = ".*(" + IGNORED_ENDINGS.map { |e| e.gsub(/\./, '\.') }.join("|") + ")$"
597
- regexp_patterns = IGNORED_PATTERNS.map { |e| ".*" + e.gsub(/\//, '\/') + ".*" }.join("|")
600
+ regexp_patterns = IGNORED_PATTERNS.map { |e| ".*" + e.gsub(%r{/}, '\/') + ".*" }.join("|")
598
601
  regexp = regexp_ends + "|" + regexp_patterns
599
602
 
600
603
  # Do not actually care if strip runs on non-strippable file, as its a no-op. Hence the `|| true` appended.
@@ -725,7 +728,7 @@ module Omnibus
725
728
  # config.guess.to. Default: "."
726
729
  # install [Array<Symbol>] parts of config.guess to copy.
727
730
  # Default: [:config_guess, :config_sub]
728
- def update_config_guess(target: ".", install: [:config_guess, :config_sub])
731
+ def update_config_guess(target: ".", install: %i{config_guess config_sub})
729
732
  build_commands << BuildCommand.new("update_config_guess `target: #{target} install: #{install.inspect}'") do
730
733
  config_guess_dir = "#{install_dir}/embedded/lib/config_guess"
731
734
  %w{config.guess config.sub}.each do |c|
@@ -8,9 +8,9 @@ module Omnibus
8
8
  end
9
9
 
10
10
  def print(new_version)
11
- puts "## #{new_version} (#{Time.now.strftime('%Y-%m-%d')})"
11
+ puts "## #{new_version} (#{Time.now.strftime("%Y-%m-%d")})"
12
12
  print_changelog
13
- if !diff.empty?
13
+ unless diff.empty?
14
14
  print_components
15
15
  puts ""
16
16
  end
@@ -23,7 +23,7 @@ module Omnibus
23
23
 
24
24
  def print_changelog(cl = changelog, indent = 0)
25
25
  cl.changelog_entries.each do |entry|
26
- puts "#{' ' * indent}* #{entry.sub("\n", "\n #{' ' * indent}")}\n"
26
+ puts "#{" " * indent}* #{entry.sub("\n", "\n #{" " * indent}")}\n"
27
27
  end
28
28
  end
29
29
 
@@ -36,6 +36,7 @@ module Omnibus
36
36
 
37
37
  def print_new_components
38
38
  return if diff.added.empty?
39
+
39
40
  puts "New Components"
40
41
  diff.added.each do |entry|
41
42
  puts "* #{entry[:name]} (#{entry[:new_version]})"
@@ -45,10 +46,11 @@ module Omnibus
45
46
 
46
47
  def print_updated_components
47
48
  return if diff.updated.empty?
49
+
48
50
  puts "Updated Components"
49
51
  diff.updated.each do |entry|
50
52
  puts sprintf("* %s (%.8s -> %.8s)",
51
- entry[:name], entry[:old_version], entry[:new_version])
53
+ entry[:name], entry[:old_version], entry[:new_version])
52
54
  repo_path = ::File.join(source_path, entry[:name].to_s)
53
55
  if entry[:source_type] == :git && ::File.directory?("#{repo_path}/.git")
54
56
  cl = ChangeLog.new(entry[:old_version], entry[:new_version], GitRepository.new("#{repo_path}"))
@@ -60,6 +62,7 @@ module Omnibus
60
62
 
61
63
  def print_removed_components
62
64
  return if diff.removed.empty?
65
+
63
66
  puts "Removed Components"
64
67
  diff.removed.each do |entry|
65
68
  puts "* #{entry[:name]} (#{entry[:old_version]})"
@@ -48,16 +48,19 @@ module Omnibus
48
48
 
49
49
  def clean_package_dir
50
50
  return unless purge?
51
+
51
52
  FileSyncer.glob("#{Config.package_dir}/**/*").each(&method(:remove_file))
52
53
  end
53
54
 
54
55
  def clean_cache_dir
55
56
  return unless purge?
57
+
56
58
  FileSyncer.glob("#{Config.cache_dir}/**/*").each(&method(:remove_file))
57
59
  end
58
60
 
59
61
  def clean_install_dir
60
62
  return unless purge?
63
+
61
64
  remove_file(@project.install_dir)
62
65
  end
63
66
 
@@ -91,7 +91,7 @@ module Omnibus
91
91
  if @options[:output_manifest]
92
92
  FileUtils.mkdir_p("pkg")
93
93
  File.open(::File.join("pkg", "version-manifest.json"), "w") do |f|
94
- f.write(FFI_Yajl::Encoder.encode(project.built_manifest.to_hash))
94
+ f.write(FFI_Yajl::Encoder.encode(project.built_manifest.to_hash, pretty: true))
95
95
  end
96
96
  end
97
97
  end
@@ -30,42 +30,42 @@ module Omnibus
30
30
  # $ omnibus changelog generate
31
31
  #
32
32
  method_option :source_path,
33
- desc: "Path to local checkout of git dependencies",
34
- type: :string,
35
- default: "../"
33
+ desc: "Path to local checkout of git dependencies",
34
+ type: :string,
35
+ default: "../"
36
36
 
37
37
  method_option :starting_manifest,
38
- desc: "Path to version-manifest from the last version (we attempt to pull it from the git history if not given)",
39
- type: :string
38
+ desc: "Path to version-manifest from the last version (we attempt to pull it from the git history if not given)",
39
+ type: :string
40
40
 
41
41
  method_option :ending_manifest,
42
- desc: "Path to the version-manifest from the current version",
43
- type: :string,
44
- default: "version-manifest.json"
42
+ desc: "Path to the version-manifest from the current version",
43
+ type: :string,
44
+ default: "version-manifest.json"
45
45
 
46
46
  method_option :skip_components,
47
- desc: "Don't include component changes in the changelog",
48
- type: :boolean,
49
- default: false
47
+ desc: "Don't include component changes in the changelog",
48
+ type: :boolean,
49
+ default: false
50
50
 
51
51
  method_option :major,
52
- desc: "Bump the major version",
53
- type: :boolean,
54
- default: false
52
+ desc: "Bump the major version",
53
+ type: :boolean,
54
+ default: false
55
55
 
56
56
  method_option :minor,
57
- desc: "Bump the minor version",
58
- type: :boolean,
59
- default: true
57
+ desc: "Bump the minor version",
58
+ type: :boolean,
59
+ default: true
60
60
 
61
61
  method_option :patch,
62
- desc: "Bump the patch version",
63
- type: :boolean,
64
- default: false
62
+ desc: "Bump the patch version",
63
+ type: :boolean,
64
+ default: false
65
65
 
66
66
  method_option :version,
67
- desc: "Explicit version for this changelog",
68
- type: :string
67
+ desc: "Explicit version for this changelog",
68
+ type: :string
69
69
 
70
70
  desc "generate [START] [END]", "Generate a changelog for a new release"
71
71
  def generate(start_ref = nil, end_ref = nil)
@@ -78,8 +78,8 @@ module Omnibus
78
78
  end
79
79
 
80
80
  Omnibus::ChangeLogPrinter.new(ChangeLog.new(starting_revision, ending_revision),
81
- diff,
82
- @options[:source_path]).print(new_version)
81
+ diff,
82
+ @options[:source_path]).print(new_version)
83
83
  end
84
84
 
85
85
  private
@@ -26,10 +26,10 @@ module Omnibus
26
26
  #
27
27
  # @example JSON
28
28
  # {
29
- # "ubuntu-10.04": [
30
- # "ubuntu-10.04",
31
- # "ubuntu-12.04",
32
- # "ubuntu-14.04"
29
+ # "ubuntu-10.04-x86_64": [
30
+ # "ubuntu-10.04-x86_64",
31
+ # "ubuntu-12.04-x86_64",
32
+ # "ubuntu-14.04-x86_64"
33
33
  # ]
34
34
  # }
35
35
  #
@@ -99,7 +99,7 @@ module Omnibus
99
99
  end
100
100
 
101
101
  klass.publish(pattern, options) do |package|
102
- say("Published '#{package.name}' for #{package.metadata[:platform]}-#{package.metadata[:platform_version]}", :green)
102
+ say("Published '#{package.name}' for #{package.metadata[:platform]}-#{package.metadata[:platform_version]}-#{package.metadata[:arch]}", :green)
103
103
  end
104
104
  end
105
105
  end
@@ -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
@@ -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
@@ -43,6 +43,8 @@ module Omnibus
43
43
  prettify_dmg
44
44
  compress_dmg
45
45
  set_dmg_icon
46
+ verify_dmg
47
+ remove_writable_dmg
46
48
  end
47
49
 
48
50
  #
@@ -143,7 +145,8 @@ module Omnibus
143
145
  -fs HFS+ \\
144
146
  -fsargs "-c c=64,a=16,e=16" \\
145
147
  -size 512000k \\
146
- "#{writable_dmg}"
148
+ "#{writable_dmg}" \\
149
+ -puppetstrings
147
150
  EOH
148
151
  end
149
152
 
@@ -159,6 +162,7 @@ module Omnibus
159
162
 
160
163
  cmd = shellout! <<-EOH.gsub(/^ {10}/, "")
161
164
  hdiutil attach \\
165
+ -puppetstrings \\
162
166
  -readwrite \\
163
167
  -noverify \\
164
168
  -noautoopen \\
@@ -230,8 +234,7 @@ module Omnibus
230
234
  pkg_name: packager.package_name,
231
235
  window_bounds: window_bounds,
232
236
  pkg_position: pkg_position,
233
- }
234
- )
237
+ })
235
238
 
236
239
  Dir.chdir(staging_dir) do
237
240
  shellout! <<-EOH.gsub(/^ {10}/, "")
@@ -254,13 +257,48 @@ module Omnibus
254
257
  shellout! <<-EOH.gsub(/^ {10}/, "")
255
258
  chmod -Rf go-w "/Volumes/#{volume_name}"
256
259
  sync
257
- hdiutil detach "#{@device}"
260
+ hdiutil unmount "#{@device}"
261
+ # Give some time to the system so unmount dmg
262
+ sleep 5
263
+ hdiutil detach "#{@device}" && \
258
264
  hdiutil convert \\
259
265
  "#{writable_dmg}" \\
260
266
  -format UDZO \\
261
267
  -imagekey \\
262
268
  zlib-level=9 \\
263
- -o "#{package_path}"
269
+ -o "#{package_path}" \\
270
+ -puppetstrings
271
+ EOH
272
+ end
273
+ end
274
+
275
+ #
276
+ # Verify checksum on created dmg.
277
+ #
278
+ # @return [void]
279
+ #
280
+ def verify_dmg
281
+ log.info(log_key) { "Verifying dmg" }
282
+
283
+ Dir.chdir(staging_dir) do
284
+ shellout! <<-EOH.gsub(/^ {10}/, "")
285
+ hdiutil verify \\
286
+ "#{package_path}" \\
287
+ -puppetstrings
288
+ EOH
289
+ end
290
+ end
291
+
292
+ #
293
+ # Remove writable dmg.
294
+ #
295
+ # @return [void]
296
+ #
297
+ def remove_writable_dmg
298
+ log.info(log_key) { "Removing writable dmg" }
299
+
300
+ Dir.chdir(staging_dir) do
301
+ shellout! <<-EOH.gsub(/^ {10}/, "")
264
302
  rm -rf "#{writable_dmg}"
265
303
  EOH
266
304
  end
@@ -277,10 +315,10 @@ module Omnibus
277
315
  Dir.chdir(staging_dir) do
278
316
  shellout! <<-EOH.gsub(/^ {10}/, "")
279
317
  # Convert the png to an icon
280
- sips -i "#{resource_path('icon.png')}"
318
+ sips -i "#{resource_path("icon.png")}"
281
319
 
282
320
  # Extract the icon into its own resource
283
- DeRez -only icns "#{resource_path('icon.png')}" > tmp.rsrc
321
+ DeRez -only icns "#{resource_path("icon.png")}" > tmp.rsrc
284
322
 
285
323
  # Append the icon reosurce to the DMG
286
324
  Rez -append tmp.rsrc -o "#{package_path}"