omnibus 6.1.7 → 6.1.9

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.
Files changed (62) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +1 -1
  3. data/lib/omnibus/build_version_dsl.rb +1 -0
  4. data/lib/omnibus/builder.rb +6 -5
  5. data/lib/omnibus/changelog_printer.rb +7 -4
  6. data/lib/omnibus/cleaner.rb +3 -0
  7. data/lib/omnibus/cli/changelog.rb +24 -24
  8. data/lib/omnibus/compressors/dmg.rb +3 -4
  9. data/lib/omnibus/fetchers/git_fetcher.rb +1 -0
  10. data/lib/omnibus/fetchers/net_fetcher.rb +2 -3
  11. data/lib/omnibus/health_check.rb +1 -1
  12. data/lib/omnibus/licensing.rb +2 -3
  13. data/lib/omnibus/logger.rb +2 -1
  14. data/lib/omnibus/manifest.rb +1 -1
  15. data/lib/omnibus/packagers/appx.rb +1 -2
  16. data/lib/omnibus/packagers/base.rb +1 -0
  17. data/lib/omnibus/packagers/bff.rb +6 -8
  18. data/lib/omnibus/packagers/deb.rb +7 -10
  19. data/lib/omnibus/packagers/ips.rb +3 -6
  20. data/lib/omnibus/packagers/makeself.rb +1 -2
  21. data/lib/omnibus/packagers/msi.rb +12 -11
  22. data/lib/omnibus/packagers/pkg.rb +3 -6
  23. data/lib/omnibus/packagers/rpm.rb +11 -12
  24. data/lib/omnibus/packagers/solaris.rb +4 -4
  25. data/lib/omnibus/packagers/windows_base.rb +7 -6
  26. data/lib/omnibus/project.rb +1 -0
  27. data/lib/omnibus/publisher.rb +2 -2
  28. data/lib/omnibus/software.rb +18 -11
  29. data/lib/omnibus/templating.rb +1 -1
  30. data/lib/omnibus/util.rb +3 -2
  31. data/lib/omnibus/version.rb +1 -1
  32. data/omnibus.gemspec +2 -2
  33. data/spec/functional/builder_spec.rb +2 -1
  34. data/spec/functional/fetchers/file_fetcher_spec.rb +4 -4
  35. data/spec/functional/fetchers/git_fetcher_spec.rb +4 -4
  36. data/spec/functional/fetchers/net_fetcher_spec.rb +5 -6
  37. data/spec/functional/fetchers/path_fetcher_spec.rb +4 -4
  38. data/spec/functional/licensing_spec.rb +5 -5
  39. data/spec/support/examples.rb +3 -4
  40. data/spec/unit/builder_spec.rb +9 -9
  41. data/spec/unit/changelogprinter_spec.rb +8 -6
  42. data/spec/unit/compressor_spec.rb +3 -3
  43. data/spec/unit/fetchers/net_fetcher_spec.rb +16 -17
  44. data/spec/unit/health_check_spec.rb +2 -6
  45. data/spec/unit/library_spec.rb +2 -1
  46. data/spec/unit/manifest_diff_spec.rb +2 -2
  47. data/spec/unit/manifest_spec.rb +1 -1
  48. data/spec/unit/metadata_spec.rb +8 -11
  49. data/spec/unit/omnibus_spec.rb +1 -1
  50. data/spec/unit/packagers/bff_spec.rb +2 -2
  51. data/spec/unit/packagers/msi_spec.rb +2 -2
  52. data/spec/unit/packagers/pkgsrc_spec.rb +1 -1
  53. data/spec/unit/packagers/solaris_spec.rb +7 -7
  54. data/spec/unit/project_spec.rb +2 -2
  55. data/spec/unit/publisher_spec.rb +1 -2
  56. data/spec/unit/publishers/artifactory_publisher_spec.rb +2 -4
  57. data/spec/unit/publishers/s3_publisher_spec.rb +2 -4
  58. data/spec/unit/s3_cacher_spec.rb +2 -6
  59. data/spec/unit/s3_helpers_spec.rb +2 -2
  60. data/spec/unit/software_spec.rb +9 -9
  61. data/spec/unit/util_spec.rb +1 -2
  62. metadata +4 -4
@@ -209,8 +209,7 @@ module Omnibus
209
209
  destination: transform_file,
210
210
  variables: {
211
211
  pathdir: project.install_dir.split("/")[1],
212
- }
213
- )
212
+ })
214
213
  end
215
214
 
216
215
  #
@@ -242,8 +241,7 @@ module Omnibus
242
241
  render_template_content(resource_path(symlinks_file),
243
242
  {
244
243
  projectdir: project.install_dir,
245
- }
246
- )
244
+ })
247
245
  end
248
246
 
249
247
  #
@@ -262,8 +260,7 @@ module Omnibus
262
260
  description: project.description,
263
261
  summary: project.friendly_name,
264
262
  arch: safe_architecture,
265
- }
266
- )
263
+ })
267
264
 
268
265
  # Append the contents of symlinks_file if it exists
269
266
  if symlinks_file
@@ -81,8 +81,7 @@ module Omnibus
81
81
  destination: makeselfinst_staging_path,
82
82
  variables: {
83
83
  install_dir: project.install_dir,
84
- }
85
- )
84
+ })
86
85
  FileUtils.chmod(0755, makeselfinst_staging_path)
87
86
  end
88
87
 
@@ -181,10 +181,12 @@ module Omnibus
181
181
  unless val.is_a?(TrueClass) || val.is_a?(FalseClass)
182
182
  raise InvalidValue.new(:iwix_light_delay_validation, "be TrueClass or FalseClass")
183
183
  end
184
+
184
185
  @delay_validation ||= val
185
186
  unless @delay_validation
186
187
  return ""
187
188
  end
189
+
188
190
  "-sval"
189
191
  end
190
192
  expose :wix_light_delay_validation
@@ -225,6 +227,7 @@ module Omnibus
225
227
  unless val.is_a?(TrueClass) || val.is_a?(FalseClass)
226
228
  raise InvalidValue.new(:bundle_msi, "be TrueClass or FalseClass")
227
229
  end
230
+
228
231
  @bundle_msi ||= val
229
232
  end
230
233
  expose :bundle_msi
@@ -244,6 +247,7 @@ module Omnibus
244
247
  unless val.is_a?(TrueClass) || val.is_a?(FalseClass)
245
248
  raise InvalidValue.new(:fast_msi, "be TrueClass or FalseClass")
246
249
  end
250
+
247
251
  @fast_msi ||= val
248
252
  end
249
253
  expose :fast_msi
@@ -298,6 +302,7 @@ module Omnibus
298
302
 
299
303
  raise "Could not find `#{search_pattern}'!" if file_paths.none?
300
304
  raise "Multiple possible matches of `#{search_pattern}'! : #{file_paths}" if file_paths.count > 1
305
+
301
306
  file_paths.first.relative_path_from(install_path).to_s
302
307
  end
303
308
  expose :gem_path
@@ -340,8 +345,7 @@ module Omnibus
340
345
  name: project.package_name,
341
346
  friendly_name: project.friendly_name,
342
347
  maintainer: project.maintainer,
343
- }
344
- )
348
+ })
345
349
  end
346
350
 
347
351
  #
@@ -360,8 +364,7 @@ module Omnibus
360
364
  parameters: parameters,
361
365
  version: windows_package_version,
362
366
  display_version: msi_display_version,
363
- }
364
- )
367
+ })
365
368
  end
366
369
 
367
370
  #
@@ -408,8 +411,7 @@ module Omnibus
408
411
  hierarchy: hierarchy,
409
412
  fastmsi: fast_msi,
410
413
  wix_install_dir: wix_install_dir,
411
- }
412
- )
414
+ })
413
415
  end
414
416
 
415
417
  #
@@ -429,8 +431,7 @@ module Omnibus
429
431
  version: windows_package_version,
430
432
  display_version: msi_display_version,
431
433
  msi: windows_safe_path(Config.package_dir, msi_name),
432
- }
433
- )
434
+ })
434
435
  end
435
436
 
436
437
  #
@@ -487,7 +488,7 @@ module Omnibus
487
488
  -ext WixBalExtension
488
489
  #{wix_extension_switches(wix_candle_extensions)}
489
490
  -dOmnibusCacheDir="#{windows_safe_path(File.expand_path(Config.cache_dir))}"
490
- "#{windows_safe_path(staging_dir, 'bundle.wxs')}"
491
+ "#{windows_safe_path(staging_dir, "bundle.wxs")}"
491
492
  EOH
492
493
  else
493
494
  <<-EOH.split.join(" ").squeeze(" ").strip
@@ -496,7 +497,7 @@ module Omnibus
496
497
  #{wix_candle_flags}
497
498
  #{wix_extension_switches(wix_candle_extensions)}
498
499
  -dProjectSourceDir="#{windows_safe_path(project.install_dir)}" "project-files.wxs"
499
- "#{windows_safe_path(staging_dir, 'source.wxs')}"
500
+ "#{windows_safe_path(staging_dir, "source.wxs")}"
500
501
  EOH
501
502
  end
502
503
  end
@@ -588,7 +589,7 @@ module Omnibus
588
589
  # @return [String]
589
590
  #
590
591
  def wix_extension_switches(arr)
591
- "#{arr.map { |e| "-ext '#{e}'" }.join(' ')}"
592
+ "#{arr.map { |e| "-ext '#{e}'" }.join(" ")}"
592
593
  end
593
594
  end
594
595
  end
@@ -44,8 +44,7 @@ module Omnibus
44
44
  maintainer: project.maintainer,
45
45
  build_version: project.build_version,
46
46
  package_name: project.package_name,
47
- }
48
- )
47
+ })
49
48
 
50
49
  # Render the welcome template
51
50
  render_template(resource_path("welcome.html.erb"),
@@ -56,8 +55,7 @@ module Omnibus
56
55
  maintainer: project.maintainer,
57
56
  build_version: project.build_version,
58
57
  package_name: project.package_name,
59
- }
60
- )
58
+ })
61
59
 
62
60
  # "Render" the assets
63
61
  copy_file(resource_path("background.png"), "#{resources_dir}/background.png")
@@ -221,8 +219,7 @@ module Omnibus
221
219
  identifier: safe_identifier,
222
220
  version: safe_version,
223
221
  component_pkg: component_pkg,
224
- }
225
- )
222
+ })
226
223
  end
227
224
 
228
225
  #
@@ -243,7 +243,7 @@ module Omnibus
243
243
  if null?(val)
244
244
  @compression_type || :gzip
245
245
  else
246
- unless val.is_a?(Symbol) && [:gzip, :bzip2, :xz].member?(val)
246
+ unless val.is_a?(Symbol) && %i{gzip bzip2 xz}.member?(val)
247
247
  raise InvalidValue.new(:compression_type, "be a Symbol (:gzip, :bzip2, or :xz)")
248
248
  end
249
249
 
@@ -317,7 +317,7 @@ module Omnibus
317
317
  # @return [Array]
318
318
  #
319
319
  def filesystem_directories
320
- @filesystem_directories ||= IO.readlines(resource_path("filesystem_list")).map { |f| f.chomp }
320
+ @filesystem_directories ||= IO.readlines(resource_path("filesystem_list")).map(&:chomp)
321
321
  end
322
322
 
323
323
  #
@@ -356,7 +356,7 @@ module Omnibus
356
356
 
357
357
  # Get a list of all files
358
358
  files = FileSyncer.glob("#{build_dir}/**/*")
359
- .map { |path| build_filepath(path) }
359
+ .map { |path| build_filepath(path) }
360
360
 
361
361
  render_template(resource_path("spec.erb"),
362
362
  destination: spec_file,
@@ -383,8 +383,7 @@ module Omnibus
383
383
  build_dir: build_dir,
384
384
  platform_family: Ohai["platform_family"],
385
385
  compression: compression,
386
- }
387
- )
386
+ })
388
387
  end
389
388
 
390
389
  #
@@ -422,8 +421,8 @@ module Omnibus
422
421
  if signing_passphrase
423
422
  log.info(log_key) { "Signing enabled for .rpm file" }
424
423
 
425
- if File.exist?("#{ENV['HOME']}/.rpmmacros")
426
- log.info(log_key) { "Detected .rpmmacros file at `#{ENV['HOME']}'" }
424
+ if File.exist?("#{ENV["HOME"]}/.rpmmacros")
425
+ log.info(log_key) { "Detected .rpmmacros file at `#{ENV["HOME"]}'" }
427
426
  home = ENV["HOME"]
428
427
  else
429
428
  log.info(log_key) { "Using default .rpmmacros file from Omnibus" }
@@ -435,9 +434,8 @@ module Omnibus
435
434
  destination: "#{home}/.rpmmacros",
436
435
  variables: {
437
436
  gpg_name: project.maintainer,
438
- gpg_path: "#{ENV['HOME']}/.gnupg", # TODO: Make this configurable
439
- }
440
- )
437
+ gpg_path: "#{ENV["HOME"]}/.gnupg", # TODO: Make this configurable
438
+ })
441
439
  end
442
440
 
443
441
  command << " --sign"
@@ -466,11 +464,13 @@ module Omnibus
466
464
  def build_filepath(path)
467
465
  filepath = rpm_safe("/" + path.gsub("#{build_dir}/", ""))
468
466
  return if config_files.include?(filepath)
467
+
469
468
  full_path = build_dir + filepath.gsub("[%]", "%")
470
469
  # FileSyncer.glob quotes pathnames that contain spaces, which is a problem on el7
471
470
  full_path.delete!('"')
472
471
  # Mark directories with the %dir directive to prevent rpmbuild from counting their contents twice.
473
472
  return mark_filesystem_directories(filepath) if !File.symlink?(full_path) && File.directory?(full_path)
473
+
474
474
  filepath
475
475
  end
476
476
 
@@ -502,8 +502,7 @@ module Omnibus
502
502
  mode: 0700,
503
503
  variables: {
504
504
  passphrase: signing_passphrase,
505
- }
506
- )
505
+ })
507
506
 
508
507
  # Yield the destination to the block
509
508
  yield(destination)
@@ -76,7 +76,7 @@ module Omnibus
76
76
  # Generate a Prototype file for solaris build
77
77
  #
78
78
  def write_prototype_file
79
- shellout! "cd #{install_dirname} && find #{install_basename} -print > #{staging_dir_path('files')}"
79
+ shellout! "cd #{install_dirname} && find #{install_basename} -print > #{staging_dir_path("files")}"
80
80
 
81
81
  File.open staging_dir_path("files.clean"), "w+" do |fout|
82
82
  File.open staging_dir_path("files") do |fin|
@@ -100,10 +100,10 @@ module Omnibus
100
100
  end
101
101
 
102
102
  # generate the prototype's file list
103
- shellout! "cd #{install_dirname} && pkgproto < #{staging_dir_path('files.clean')} > #{staging_dir_path('Prototype.files')}"
103
+ shellout! "cd #{install_dirname} && pkgproto < #{staging_dir_path("files.clean")} > #{staging_dir_path("Prototype.files")}"
104
104
 
105
105
  # fix up the user and group in the file list to root
106
- shellout! "awk '{ $5 = \"root\"; $6 = \"root\"; print }' < #{staging_dir_path('Prototype.files')} >> #{staging_dir_path('Prototype')}"
106
+ shellout! "awk '{ $5 = \"root\"; $6 = \"root\"; print }' < #{staging_dir_path("Prototype.files")} >> #{staging_dir_path("Prototype")}"
107
107
  end
108
108
 
109
109
  #
@@ -139,7 +139,7 @@ module Omnibus
139
139
  # @return [void]
140
140
  #
141
141
  def create_solaris_file
142
- shellout! "pkgmk -o -r #{install_dirname} -d #{staging_dir} -f #{staging_dir_path('Prototype')}"
142
+ shellout! "pkgmk -o -r #{install_dirname} -d #{staging_dir} -f #{staging_dir_path("Prototype")}"
143
143
  shellout! "pkgchk -vd #{staging_dir} #{project.package_name}"
144
144
  shellout! "pkgtrans #{staging_dir} #{package_path} #{project.package_name}"
145
145
  end
@@ -59,11 +59,11 @@ module Omnibus
59
59
  raise InvalidValue.new(:params, "be a Hash")
60
60
  end
61
61
 
62
- valid_keys = [:store, :timestamp_servers, :machine_store, :algorithm]
62
+ valid_keys = %i{store timestamp_servers machine_store algorithm}
63
63
  invalid_keys = params.keys - valid_keys
64
64
  unless invalid_keys.empty?
65
- raise InvalidValue.new(:params, "contain keys from [#{valid_keys.join(', ')}]. "\
66
- "Found invalid keys [#{invalid_keys.join(', ')}]")
65
+ raise InvalidValue.new(:params, "contain keys from [#{valid_keys.join(", ")}]. "\
66
+ "Found invalid keys [#{invalid_keys.join(", ")}]")
67
67
  end
68
68
 
69
69
  if !params[:machine_store].nil? && !(
@@ -117,11 +117,11 @@ module Omnibus
117
117
  success = try_sign(package_file, ts)
118
118
  break if success
119
119
  end
120
- raise FailedToSignWindowsPackage.new if !success
120
+ raise FailedToSignWindowsPackage.new unless success
121
121
  end
122
122
 
123
123
  def try_sign(package_file, url)
124
- cmd = Array.new.tap do |arr|
124
+ cmd = [].tap do |arr|
125
125
  arr << "signtool.exe"
126
126
  arr << "sign /v"
127
127
  arr << "/t #{url}"
@@ -158,8 +158,9 @@ module Omnibus
158
158
  #
159
159
  def certificate_subject
160
160
  return "CN=#{project.package_name}" unless signing_identity
161
+
161
162
  store = machine_store? ? "LocalMachine" : "CurrentUser"
162
- cmd = Array.new.tap do |arr|
163
+ cmd = [].tap do |arr|
163
164
  arr << "powershell.exe"
164
165
  arr << "-ExecutionPolicy Bypass"
165
166
  arr << "-NoProfile"
@@ -1007,6 +1007,7 @@ module Omnibus
1007
1007
  #
1008
1008
  def dirty!(software)
1009
1009
  raise ProjectAlreadyDirty.new(self) if culprit
1010
+
1010
1011
  @culprit = software
1011
1012
  end
1012
1013
 
@@ -69,7 +69,7 @@ module Omnibus
69
69
  #
70
70
  def packages
71
71
  @packages ||= begin
72
- publish_packages = Array.new
72
+ publish_packages = []
73
73
  build_packages = FileSyncer.glob(@pattern).map { |path| Package.new(path) }
74
74
 
75
75
  if @options[:platform_mappings]
@@ -88,7 +88,7 @@ module Omnibus
88
88
  if packages.empty?
89
89
  log.warn(log_key) do
90
90
  "Could not locate a package for build platform #{build_platform}-#{build_platform_version}-#{build_architecture}. " \
91
- "Publishing will be skipped for: #{publish_platforms.join(', ')}"
91
+ "Publishing will be skipped for: #{publish_platforms.join(", ")}"
92
92
  end
93
93
  end
94
94
 
@@ -1,5 +1,5 @@
1
1
  #
2
- # Copyright 2012-2017, Chef Software Inc.
2
+ # Copyright 2012-2018, 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.
@@ -305,7 +305,7 @@ module Omnibus
305
305
  "only include valid keys. Invalid keys: #{extra_keys.inspect}")
306
306
  end
307
307
 
308
- duplicate_keys = val.keys & [:git, :file, :path, :url]
308
+ duplicate_keys = val.keys & %i{git file path url}
309
309
  unless duplicate_keys.size < 2
310
310
  raise InvalidValue.new(:source,
311
311
  "not include duplicate keys. Duplicate keys: #{duplicate_keys.inspect}")
@@ -509,7 +509,7 @@ module Omnibus
509
509
  # the list of currently whitelisted files
510
510
  #
511
511
  def whitelist_file(file)
512
- file = Regexp.new(file) unless file.kind_of?(Regexp)
512
+ file = Regexp.new(file) unless file.is_a?(Regexp)
513
513
  whitelist_files << file
514
514
  whitelist_files.dup
515
515
  end
@@ -987,17 +987,18 @@ module Omnibus
987
987
  fetcher.version_guid
988
988
  end
989
989
 
990
+ # This is the real version if one exists (nil if there's no real version)
991
+ def real_version
992
+ @real_version ||= fetcher.version_for_cache || version
993
+ end
994
+
990
995
  # Returns the version to be used in cache.
991
996
  def version_for_cache
992
- @version_for_cache ||= if fetcher.version_for_cache
993
- fetcher.version_for_cache
994
- elsif version
995
- version
997
+ @version_for_cache ||= if real_version
998
+ real_version
996
999
  else
997
1000
  log.warn(log_key) do
998
- "No version given! This is probably a bad thing. I am going to " \
999
- "assume the version `0.0.0', but that is most certainly not your " \
1000
- "desired behavior. If git caching seems off, this is probably why."
1001
+ "No version given! Git caching disabled." \
1001
1002
  end
1002
1003
 
1003
1004
  "0.0.0"
@@ -1070,7 +1071,13 @@ module Omnibus
1070
1071
  #
1071
1072
  def build_me(build_wrappers = [])
1072
1073
  if Config.use_git_caching
1073
- if project.dirty?
1074
+ if !real_version
1075
+ log.info(log_key) do
1076
+ "Forcing a build because resolved version is nil"
1077
+ end
1078
+ execute_build
1079
+ project.dirty!(self)
1080
+ elsif project.dirty?
1074
1081
  log.info(log_key) do
1075
1082
  "Building because `#{project.culprit.name}' dirtied the cache"
1076
1083
  end
@@ -73,7 +73,7 @@ module Omnibus
73
73
 
74
74
  unless options.empty?
75
75
  raise ArgumentError,
76
- "Unknown option(s): #{options.keys.map(&:inspect).join(', ')}"
76
+ "Unknown option(s): #{options.keys.map(&:inspect).join(", ")}"
77
77
  end
78
78
 
79
79
  # String value returned from #render_template_content
@@ -80,7 +80,7 @@ module Omnibus
80
80
  # populated with results of the command.
81
81
  #
82
82
  def shellout(*args)
83
- options = args.last.kind_of?(Hash) ? args.pop : {}
83
+ options = args.last.is_a?(Hash) ? args.pop : {}
84
84
  options = SHELLOUT_OPTIONS.merge(options)
85
85
 
86
86
  command_string = args.join(" ")
@@ -158,6 +158,7 @@ module Omnibus
158
158
  yield
159
159
  rescue Exception => e
160
160
  raise e unless retried_exceptions.any? { |eclass| e.is_a?(eclass) }
161
+
161
162
  if retries != 0
162
163
  log.info(log_key) { "Retrying failed #{logstr} due to #{e} (#{retries} retries left)..." }
163
164
  retries -= 1
@@ -196,7 +197,7 @@ module Omnibus
196
197
  #
197
198
  def compiler_safe_path(*pieces)
198
199
  path = File.join(*pieces)
199
- path = path.sub(/^([A-Za-z]):\//, "/\\1/") if ENV["MSYSTEM"]
200
+ path = path.sub(%r{^([A-Za-z]):/}, "/\\1/") if ENV["MSYSTEM"]
200
201
  path
201
202
  end
202
203