omnibus 6.1.4 → 7.0.34

Sign up to get free protection for your applications and to get access to all the features.
Files changed (99) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -4
  3. data/README.md +54 -12
  4. data/Rakefile +1 -1
  5. data/bin/omnibus +1 -1
  6. data/lib/omnibus.rb +2 -2
  7. data/lib/omnibus/build_version.rb +1 -1
  8. data/lib/omnibus/build_version_dsl.rb +6 -7
  9. data/lib/omnibus/builder.rb +10 -9
  10. data/lib/omnibus/changelog_printer.rb +7 -4
  11. data/lib/omnibus/cleaner.rb +4 -1
  12. data/lib/omnibus/cli.rb +2 -2
  13. data/lib/omnibus/cli/changelog.rb +25 -25
  14. data/lib/omnibus/compressor.rb +2 -2
  15. data/lib/omnibus/compressors/base.rb +2 -2
  16. data/lib/omnibus/compressors/dmg.rb +3 -4
  17. data/lib/omnibus/compressors/tgz.rb +2 -2
  18. data/lib/omnibus/config.rb +13 -3
  19. data/lib/omnibus/core_extensions/open_uri.rb +1 -1
  20. data/lib/omnibus/digestable.rb +2 -2
  21. data/lib/omnibus/download_helpers.rb +6 -2
  22. data/lib/omnibus/fetchers/file_fetcher.rb +1 -1
  23. data/lib/omnibus/fetchers/git_fetcher.rb +1 -0
  24. data/lib/omnibus/fetchers/net_fetcher.rb +3 -4
  25. data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
  26. data/lib/omnibus/file_syncer.rb +1 -1
  27. data/lib/omnibus/generator.rb +2 -2
  28. data/lib/omnibus/generator_files/README.md.erb +20 -16
  29. data/lib/omnibus/generator_files/config/software/preparation.rb.erb +1 -1
  30. data/lib/omnibus/generator_files/omnibus.rb.erb +5 -4
  31. data/lib/omnibus/git_cache.rb +2 -2
  32. data/lib/omnibus/health_check.rb +3 -1
  33. data/lib/omnibus/licensing.rb +5 -6
  34. data/lib/omnibus/logger.rb +3 -2
  35. data/lib/omnibus/manifest.rb +2 -2
  36. data/lib/omnibus/metadata.rb +3 -3
  37. data/lib/omnibus/ohai.rb +1 -1
  38. data/lib/omnibus/package.rb +1 -1
  39. data/lib/omnibus/packager.rb +1 -0
  40. data/lib/omnibus/packagers/appx.rb +1 -2
  41. data/lib/omnibus/packagers/base.rb +2 -1
  42. data/lib/omnibus/packagers/bff.rb +6 -8
  43. data/lib/omnibus/packagers/deb.rb +7 -10
  44. data/lib/omnibus/packagers/ips.rb +3 -6
  45. data/lib/omnibus/packagers/makeself.rb +1 -2
  46. data/lib/omnibus/packagers/msi.rb +13 -12
  47. data/lib/omnibus/packagers/pkg.rb +125 -9
  48. data/lib/omnibus/packagers/rpm.rb +11 -12
  49. data/lib/omnibus/packagers/solaris.rb +5 -5
  50. data/lib/omnibus/packagers/windows_base.rb +7 -6
  51. data/lib/omnibus/project.rb +3 -2
  52. data/lib/omnibus/publisher.rb +2 -2
  53. data/lib/omnibus/publishers/artifactory_publisher.rb +2 -2
  54. data/lib/omnibus/publishers/s3_publisher.rb +6 -4
  55. data/lib/omnibus/s3_cache.rb +4 -2
  56. data/lib/omnibus/s3_helpers.rb +7 -7
  57. data/lib/omnibus/software.rb +68 -32
  58. data/lib/omnibus/templating.rb +2 -2
  59. data/lib/omnibus/thread_pool.rb +0 -2
  60. data/lib/omnibus/util.rb +4 -3
  61. data/lib/omnibus/version.rb +1 -1
  62. data/lib/omnibus/whitelist.rb +27 -1
  63. data/omnibus.gemspec +8 -9
  64. data/resources/ips/doc-transform.erb +1 -0
  65. data/resources/msi/CustomActionFastMsi.CA.dll +0 -0
  66. data/resources/rpm/signing.erb +7 -10
  67. data/spec/functional/builder_spec.rb +2 -1
  68. data/spec/functional/fetchers/file_fetcher_spec.rb +4 -4
  69. data/spec/functional/fetchers/git_fetcher_spec.rb +4 -4
  70. data/spec/functional/fetchers/net_fetcher_spec.rb +5 -6
  71. data/spec/functional/fetchers/path_fetcher_spec.rb +4 -4
  72. data/spec/functional/licensing_spec.rb +5 -5
  73. data/spec/support/examples.rb +3 -4
  74. data/spec/support/path_helpers.rb +2 -2
  75. data/spec/unit/builder_spec.rb +9 -9
  76. data/spec/unit/changelogprinter_spec.rb +8 -6
  77. data/spec/unit/compressor_spec.rb +3 -3
  78. data/spec/unit/fetchers/net_fetcher_spec.rb +16 -17
  79. data/spec/unit/health_check_spec.rb +2 -6
  80. data/spec/unit/library_spec.rb +2 -1
  81. data/spec/unit/manifest_diff_spec.rb +2 -2
  82. data/spec/unit/manifest_spec.rb +1 -1
  83. data/spec/unit/metadata_spec.rb +9 -11
  84. data/spec/unit/omnibus_spec.rb +1 -1
  85. data/spec/unit/packagers/bff_spec.rb +2 -2
  86. data/spec/unit/packagers/ips_spec.rb +1 -0
  87. data/spec/unit/packagers/msi_spec.rb +2 -2
  88. data/spec/unit/packagers/pkg_spec.rb +354 -0
  89. data/spec/unit/packagers/pkgsrc_spec.rb +1 -1
  90. data/spec/unit/packagers/solaris_spec.rb +7 -7
  91. data/spec/unit/project_spec.rb +2 -2
  92. data/spec/unit/publisher_spec.rb +1 -2
  93. data/spec/unit/publishers/artifactory_publisher_spec.rb +2 -4
  94. data/spec/unit/publishers/s3_publisher_spec.rb +2 -4
  95. data/spec/unit/s3_cacher_spec.rb +19 -6
  96. data/spec/unit/s3_helpers_spec.rb +22 -3
  97. data/spec/unit/software_spec.rb +72 -42
  98. data/spec/unit/util_spec.rb +1 -2
  99. metadata +18 -18
@@ -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)
@@ -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
@@ -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"
@@ -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"
@@ -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
 
@@ -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])
@@ -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.
@@ -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
  #
@@ -305,7 +345,7 @@ module Omnibus
305
345
  "only include valid keys. Invalid keys: #{extra_keys.inspect}")
306
346
  end
307
347
 
308
- duplicate_keys = val.keys & [:git, :file, :path, :url]
348
+ duplicate_keys = val.keys & %i{git file path url}
309
349
  unless duplicate_keys.size < 2
310
350
  raise InvalidValue.new(:source,
311
351
  "not include duplicate keys. Duplicate keys: #{duplicate_keys.inspect}")
@@ -509,7 +549,7 @@ module Omnibus
509
549
  # the list of currently whitelisted files
510
550
  #
511
551
  def whitelist_file(file)
512
- file = Regexp.new(file) unless file.kind_of?(Regexp)
552
+ file = Regexp.new(file) unless file.is_a?(Regexp)
513
553
  whitelist_files << file
514
554
  whitelist_files.dup
515
555
  end
@@ -668,33 +708,22 @@ 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",
721
+ "CFLAGS" => "-I#{install_dir}/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
693
722
  }
694
723
  when "suse"
695
724
  suse_flags = {
696
725
  "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
697
- "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
726
+ "CFLAGS" => "-I#{install_dir}/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
698
727
  }
699
728
  # Enable gcc version 4.8 if it is available
700
729
  if which("gcc-4.8") && platform_version.satisfies?("< 12")
@@ -721,7 +750,7 @@ module Omnibus
721
750
  else
722
751
  {
723
752
  "LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
724
- "CFLAGS" => "-I#{install_dir}/embedded/include -O2",
753
+ "CFLAGS" => "-I#{install_dir}/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
725
754
  }
726
755
  end
727
756
 
@@ -987,17 +1016,18 @@ module Omnibus
987
1016
  fetcher.version_guid
988
1017
  end
989
1018
 
1019
+ # This is the real version if one exists (nil if there's no real version)
1020
+ def real_version
1021
+ @real_version ||= fetcher.version_for_cache || version
1022
+ end
1023
+
990
1024
  # Returns the version to be used in cache.
991
1025
  def version_for_cache
992
- @version_for_cache ||= if fetcher.version_for_cache
993
- fetcher.version_for_cache
994
- elsif version
995
- version
1026
+ @version_for_cache ||= if real_version
1027
+ real_version
996
1028
  else
997
1029
  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."
1030
+ "No version given! Git caching disabled." \
1001
1031
  end
1002
1032
 
1003
1033
  "0.0.0"
@@ -1070,7 +1100,13 @@ module Omnibus
1070
1100
  #
1071
1101
  def build_me(build_wrappers = [])
1072
1102
  if Config.use_git_caching
1073
- if project.dirty?
1103
+ if !real_version
1104
+ log.info(log_key) do
1105
+ "Forcing a build because resolved version is nil"
1106
+ end
1107
+ execute_build(build_wrappers)
1108
+ project.dirty!(self) unless project.dirty? # omnibus can only be mildly dirty
1109
+ elsif project.dirty?
1074
1110
  log.info(log_key) do
1075
1111
  "Building because `#{project.culprit.name}' dirtied the cache"
1076
1112
  end