omnibus 6.1.7 → 8.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile +0 -4
- data/README.md +54 -12
- data/Rakefile +1 -1
- data/bin/omnibus +1 -1
- data/lib/omnibus.rb +2 -2
- data/lib/omnibus/build_version.rb +1 -1
- data/lib/omnibus/build_version_dsl.rb +6 -7
- data/lib/omnibus/builder.rb +10 -9
- data/lib/omnibus/changelog_printer.rb +7 -4
- data/lib/omnibus/cleaner.rb +4 -1
- data/lib/omnibus/cli.rb +2 -2
- data/lib/omnibus/cli/changelog.rb +25 -25
- data/lib/omnibus/compressor.rb +2 -2
- data/lib/omnibus/compressors/base.rb +2 -2
- data/lib/omnibus/compressors/dmg.rb +8 -6
- data/lib/omnibus/compressors/tgz.rb +2 -2
- data/lib/omnibus/config.rb +13 -3
- data/lib/omnibus/core_extensions/open_uri.rb +1 -1
- data/lib/omnibus/digestable.rb +2 -2
- data/lib/omnibus/download_helpers.rb +6 -2
- data/lib/omnibus/fetchers/file_fetcher.rb +1 -1
- data/lib/omnibus/fetchers/git_fetcher.rb +1 -0
- data/lib/omnibus/fetchers/net_fetcher.rb +3 -4
- data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
- data/lib/omnibus/file_syncer.rb +1 -1
- data/lib/omnibus/generator.rb +2 -2
- data/lib/omnibus/generator_files/README.md.erb +20 -16
- data/lib/omnibus/generator_files/config/software/preparation.rb.erb +1 -1
- data/lib/omnibus/generator_files/omnibus.rb.erb +5 -4
- data/lib/omnibus/git_cache.rb +2 -2
- data/lib/omnibus/health_check.rb +3 -1
- data/lib/omnibus/licensing.rb +5 -6
- data/lib/omnibus/logger.rb +3 -2
- data/lib/omnibus/manifest.rb +2 -2
- data/lib/omnibus/metadata.rb +2 -2
- data/lib/omnibus/ohai.rb +1 -1
- data/lib/omnibus/package.rb +1 -1
- data/lib/omnibus/packager.rb +6 -14
- data/lib/omnibus/packagers/appx.rb +1 -2
- data/lib/omnibus/packagers/base.rb +2 -1
- data/lib/omnibus/packagers/bff.rb +6 -8
- data/lib/omnibus/packagers/deb.rb +7 -10
- data/lib/omnibus/packagers/ips.rb +3 -6
- data/lib/omnibus/packagers/makeself.rb +1 -2
- data/lib/omnibus/packagers/msi.rb +13 -12
- data/lib/omnibus/packagers/pkg.rb +125 -9
- data/lib/omnibus/packagers/rpm.rb +11 -12
- data/lib/omnibus/packagers/solaris.rb +5 -5
- data/lib/omnibus/packagers/windows_base.rb +7 -6
- data/lib/omnibus/project.rb +3 -2
- data/lib/omnibus/publisher.rb +2 -2
- data/lib/omnibus/publishers/artifactory_publisher.rb +2 -2
- data/lib/omnibus/publishers/s3_publisher.rb +6 -4
- data/lib/omnibus/s3_cache.rb +4 -2
- data/lib/omnibus/s3_helpers.rb +7 -7
- data/lib/omnibus/software.rb +68 -43
- data/lib/omnibus/sugarable.rb +5 -14
- data/lib/omnibus/templating.rb +2 -2
- data/lib/omnibus/thread_pool.rb +0 -2
- data/lib/omnibus/util.rb +4 -3
- data/lib/omnibus/version.rb +1 -1
- data/lib/omnibus/whitelist.rb +24 -1
- data/omnibus.gemspec +8 -9
- data/resources/ips/doc-transform.erb +1 -0
- data/resources/msi/CustomActionFastMsi.CA.dll +0 -0
- data/resources/msi/source.wxs.erb +2 -10
- data/resources/rpm/signing.erb +7 -10
- data/spec/functional/builder_spec.rb +2 -1
- data/spec/functional/fetchers/file_fetcher_spec.rb +4 -4
- data/spec/functional/fetchers/git_fetcher_spec.rb +4 -4
- data/spec/functional/fetchers/net_fetcher_spec.rb +5 -6
- data/spec/functional/fetchers/path_fetcher_spec.rb +4 -4
- data/spec/functional/licensing_spec.rb +5 -5
- data/spec/support/examples.rb +3 -4
- data/spec/support/path_helpers.rb +2 -2
- data/spec/unit/builder_spec.rb +9 -9
- data/spec/unit/changelogprinter_spec.rb +8 -6
- data/spec/unit/compressor_spec.rb +4 -4
- data/spec/unit/compressors/dmg_spec.rb +5 -2
- data/spec/unit/fetchers/net_fetcher_spec.rb +16 -17
- data/spec/unit/health_check_spec.rb +2 -6
- data/spec/unit/library_spec.rb +2 -1
- data/spec/unit/manifest_diff_spec.rb +2 -2
- data/spec/unit/manifest_spec.rb +1 -1
- data/spec/unit/metadata_spec.rb +14 -17
- data/spec/unit/omnibus_spec.rb +1 -1
- data/spec/unit/packager_spec.rb +6 -13
- data/spec/unit/packagers/bff_spec.rb +2 -2
- data/spec/unit/packagers/ips_spec.rb +1 -0
- data/spec/unit/packagers/msi_spec.rb +2 -2
- data/spec/unit/packagers/pkg_spec.rb +354 -0
- data/spec/unit/packagers/pkgsrc_spec.rb +1 -1
- data/spec/unit/packagers/rpm_spec.rb +5 -5
- data/spec/unit/packagers/solaris_spec.rb +7 -7
- data/spec/unit/project_spec.rb +7 -7
- data/spec/unit/publisher_spec.rb +1 -2
- data/spec/unit/publishers/artifactory_publisher_spec.rb +2 -4
- data/spec/unit/publishers/s3_publisher_spec.rb +2 -4
- data/spec/unit/s3_cacher_spec.rb +19 -6
- data/spec/unit/s3_helpers_spec.rb +22 -3
- data/spec/unit/software_spec.rb +59 -120
- data/spec/unit/util_spec.rb +1 -2
- metadata +21 -21
@@ -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) &&
|
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
|
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
|
-
|
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[
|
426
|
-
log.info(log_key) { "Detected .rpmmacros file at `#{ENV[
|
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[
|
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(
|
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(
|
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(
|
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(
|
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 =
|
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
|
120
|
+
raise FailedToSignWindowsPackage.new unless success
|
121
121
|
end
|
122
122
|
|
123
123
|
def try_sign(package_file, url)
|
124
|
-
cmd =
|
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 =
|
163
|
+
cmd = [].tap do |arr|
|
163
164
|
arr << "powershell.exe"
|
164
165
|
arr << "-ExecutionPolicy Bypass"
|
165
166
|
arr << "-NoProfile"
|
data/lib/omnibus/project.rb
CHANGED
@@ -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
|
|
data/lib/omnibus/publisher.rb
CHANGED
@@ -69,7 +69,7 @@ module Omnibus
|
|
69
69
|
#
|
70
70
|
def packages
|
71
71
|
@packages ||= begin
|
72
|
-
publish_packages =
|
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
|
|
@@ -65,11 +65,13 @@ module Omnibus
|
|
65
65
|
bucket_name: @options[:bucket],
|
66
66
|
}
|
67
67
|
|
68
|
-
if Config.
|
69
|
-
config[:
|
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]
|
72
|
-
config[:secret_access_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
|
data/lib/omnibus/s3_cache.rb
CHANGED
@@ -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.
|
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
|
data/lib/omnibus/s3_helpers.rb
CHANGED
@@ -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[:
|
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])
|
data/lib/omnibus/software.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
#
|
2
|
-
# Copyright 2012-
|
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 &
|
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}")
|
@@ -485,7 +525,7 @@ module Omnibus
|
|
485
525
|
return if final_version.nil?
|
486
526
|
|
487
527
|
begin
|
488
|
-
|
528
|
+
ChefUtils::VersionString.new(final_version)
|
489
529
|
rescue ArgumentError
|
490
530
|
log.warn(log_key) do
|
491
531
|
"Version #{final_version} for software #{name} was not parseable. " \
|
@@ -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.
|
552
|
+
file = Regexp.new(file) unless file.is_a?(Regexp)
|
513
553
|
whitelist_files << file
|
514
554
|
whitelist_files.dup
|
515
555
|
end
|
@@ -668,40 +708,18 @@ module Omnibus
|
|
668
708
|
"ARFLAGS" => "-X64 cru",
|
669
709
|
}
|
670
710
|
when "solaris2"
|
671
|
-
|
672
|
-
|
673
|
-
|
674
|
-
|
675
|
-
|
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
|
-
when "suse"
|
695
|
-
suse_flags = {
|
696
|
-
"LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
|
697
|
-
"CFLAGS" => "-I#{install_dir}/embedded/include -O2",
|
698
|
-
}
|
699
|
-
# Enable gcc version 4.8 if it is available
|
700
|
-
if which("gcc-4.8") && platform_version.satisfies?("< 12")
|
701
|
-
suse_flags["CC"] = "gcc-4.8"
|
702
|
-
suse_flags["CXX"] = "g++-4.8"
|
703
|
-
end
|
704
|
-
suse_flags
|
705
723
|
when "windows"
|
706
724
|
arch_flag = windows_arch_i386? ? "-m32" : "-m64"
|
707
725
|
opt_flag = windows_arch_i386? ? "-march=i686" : "-march=x86-64"
|
@@ -721,7 +739,7 @@ module Omnibus
|
|
721
739
|
else
|
722
740
|
{
|
723
741
|
"LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
|
724
|
-
"CFLAGS" => "-I#{install_dir}/embedded/include -O2",
|
742
|
+
"CFLAGS" => "-I#{install_dir}/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
725
743
|
}
|
726
744
|
end
|
727
745
|
|
@@ -987,17 +1005,18 @@ module Omnibus
|
|
987
1005
|
fetcher.version_guid
|
988
1006
|
end
|
989
1007
|
|
1008
|
+
# This is the real version if one exists (nil if there's no real version)
|
1009
|
+
def real_version
|
1010
|
+
@real_version ||= fetcher.version_for_cache || version
|
1011
|
+
end
|
1012
|
+
|
990
1013
|
# Returns the version to be used in cache.
|
991
1014
|
def version_for_cache
|
992
|
-
@version_for_cache ||= if
|
993
|
-
|
994
|
-
elsif version
|
995
|
-
version
|
1015
|
+
@version_for_cache ||= if real_version
|
1016
|
+
real_version
|
996
1017
|
else
|
997
1018
|
log.warn(log_key) do
|
998
|
-
"No version given!
|
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."
|
1019
|
+
"No version given! Git caching disabled." \
|
1001
1020
|
end
|
1002
1021
|
|
1003
1022
|
"0.0.0"
|
@@ -1070,7 +1089,13 @@ module Omnibus
|
|
1070
1089
|
#
|
1071
1090
|
def build_me(build_wrappers = [])
|
1072
1091
|
if Config.use_git_caching
|
1073
|
-
if
|
1092
|
+
if !real_version
|
1093
|
+
log.info(log_key) do
|
1094
|
+
"Forcing a build because resolved version is nil"
|
1095
|
+
end
|
1096
|
+
execute_build(build_wrappers)
|
1097
|
+
project.dirty!(self) unless project.dirty? # omnibus can only be mildly dirty
|
1098
|
+
elsif project.dirty?
|
1074
1099
|
log.info(log_key) do
|
1075
1100
|
"Building because `#{project.culprit.name}' dirtied the cache"
|
1076
1101
|
end
|