omnibus 4.0.0 → 4.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +8 -0
- data/.travis.yml +3 -11
- data/CHANGELOG.md +50 -0
- data/MAINTAINERS.md +26 -0
- data/README.md +61 -4
- data/appveyor.yml +35 -0
- data/docs/Build Cache.md +28 -3
- data/docs/Building on RHEL.md +1 -1
- data/features/commands/publish.feature +4 -9
- data/features/step_definitions/generator_steps.rb +14 -1
- data/features/support/env.rb +5 -3
- data/lib/omnibus.rb +10 -0
- data/lib/omnibus/build_version.rb +34 -25
- data/lib/omnibus/build_version_dsl.rb +43 -4
- data/lib/omnibus/builder.rb +30 -11
- data/lib/omnibus/changelog.rb +52 -0
- data/lib/omnibus/changelog_printer.rb +77 -0
- data/lib/omnibus/cli.rb +37 -2
- data/lib/omnibus/cli/changelog.rb +149 -0
- data/lib/omnibus/cli/publish.rb +30 -10
- data/lib/omnibus/config.rb +41 -2
- data/lib/omnibus/digestable.rb +6 -1
- data/lib/omnibus/exceptions.rb +15 -1
- data/lib/omnibus/fetcher.rb +78 -34
- data/lib/omnibus/fetchers/git_fetcher.rb +84 -42
- data/lib/omnibus/fetchers/net_fetcher.rb +64 -13
- data/lib/omnibus/fetchers/null_fetcher.rb +8 -1
- data/lib/omnibus/fetchers/path_fetcher.rb +24 -1
- data/lib/omnibus/file_syncer.rb +52 -1
- data/lib/omnibus/generator.rb +22 -21
- data/lib/omnibus/generator_files/.kitchen.yml.erb +8 -12
- data/lib/omnibus/generator_files/Berksfile.erb +4 -4
- data/lib/omnibus/generator_files/Gemfile.erb +3 -3
- data/lib/omnibus/generator_files/README.md.erb +17 -0
- data/lib/omnibus/generator_files/omnibus.rb.erb +6 -0
- data/lib/omnibus/git_repository.rb +43 -0
- data/lib/omnibus/health_check.rb +5 -1
- data/lib/omnibus/manifest.rb +134 -0
- data/lib/omnibus/manifest_diff.rb +88 -0
- data/lib/omnibus/manifest_entry.rb +43 -0
- data/lib/omnibus/metadata.rb +19 -1
- data/lib/omnibus/package.rb +9 -0
- data/lib/omnibus/packagers/base.rb +1 -1
- data/lib/omnibus/packagers/bff.rb +5 -5
- data/lib/omnibus/packagers/deb.rb +11 -4
- data/lib/omnibus/packagers/msi.rb +243 -2
- data/lib/omnibus/packagers/rpm.rb +68 -14
- data/lib/omnibus/packagers/solaris.rb +17 -23
- data/lib/omnibus/project.rb +129 -16
- data/lib/omnibus/publisher.rb +62 -49
- data/lib/omnibus/publishers/artifactory_publisher.rb +96 -5
- data/lib/omnibus/publishers/s3_publisher.rb +20 -25
- data/lib/omnibus/s3_cache.rb +13 -34
- data/lib/omnibus/s3_helpers.rb +119 -0
- data/lib/omnibus/semantic_version.rb +57 -0
- data/lib/omnibus/software.rb +87 -28
- data/lib/omnibus/sugarable.rb +18 -0
- data/lib/omnibus/templating.rb +8 -1
- data/lib/omnibus/version.rb +1 -1
- data/omnibus.gemspec +10 -7
- data/resources/bff/gen.template.erb +1 -1
- data/resources/msi/bundle.wxs.erb +17 -0
- data/resources/msi/localization-en-us.wxl.erb +1 -1
- data/resources/rpm/spec.erb +1 -1
- data/spec/functional/builder_spec.rb +15 -7
- data/spec/functional/fetchers/git_fetcher_spec.rb +44 -12
- data/spec/functional/fetchers/net_fetcher_spec.rb +171 -20
- data/spec/functional/fetchers/path_fetcher_spec.rb +16 -1
- data/spec/functional/file_syncer_spec.rb +58 -5
- data/spec/functional/templating_spec.rb +17 -6
- data/spec/spec_helper.rb +17 -0
- data/spec/support/file_helpers.rb +12 -2
- data/spec/support/git_helpers.rb +23 -18
- data/spec/support/matchers.rb +22 -0
- data/spec/support/output_helpers.rb +29 -0
- data/spec/unit/build_version_dsl_spec.rb +31 -4
- data/spec/unit/build_version_spec.rb +11 -4
- data/spec/unit/builder_spec.rb +33 -0
- data/spec/unit/changelog_spec.rb +55 -0
- data/spec/unit/cleanroom_spec.rb +1 -1
- data/spec/unit/compressors/dmg_spec.rb +3 -3
- data/spec/unit/compressors/tgz_spec.rb +3 -3
- data/spec/unit/config_spec.rb +3 -1
- data/spec/unit/fetcher_spec.rb +35 -0
- data/spec/unit/fetchers/git_fetcher_spec.rb +28 -14
- data/spec/unit/fetchers/net_fetcher_spec.rb +178 -24
- data/spec/unit/fetchers/path_fetcher_spec.rb +8 -7
- data/spec/unit/generator_spec.rb +22 -21
- data/spec/unit/git_repository_spec.rb +60 -0
- data/spec/unit/manifest_diff_spec.rb +75 -0
- data/spec/unit/manifest_spec.rb +116 -0
- data/spec/unit/metadata_spec.rb +11 -0
- data/spec/unit/omnibus_spec.rb +9 -6
- data/spec/unit/package_spec.rb +1 -1
- data/spec/unit/packagers/base_spec.rb +8 -18
- data/spec/unit/packagers/bff_spec.rb +9 -5
- data/spec/unit/packagers/deb_spec.rb +44 -12
- data/spec/unit/packagers/makeself_spec.rb +4 -4
- data/spec/unit/packagers/msi_spec.rb +122 -6
- data/spec/unit/packagers/pkg_spec.rb +3 -3
- data/spec/unit/packagers/rpm_spec.rb +37 -12
- data/spec/unit/project_spec.rb +18 -1
- data/spec/unit/publisher_spec.rb +65 -0
- data/spec/unit/publishers/artifactory_publisher_spec.rb +26 -20
- data/spec/unit/publishers/s3_publisher_spec.rb +14 -30
- data/spec/unit/s3_cacher_spec.rb +1 -1
- data/spec/unit/s3_helpers_spec.rb +32 -0
- data/spec/unit/semantic_version_spec.rb +55 -0
- data/spec/unit/software_spec.rb +112 -4
- metadata +86 -16
@@ -14,11 +14,14 @@
|
|
14
14
|
# limitations under the License.
|
15
15
|
#
|
16
16
|
|
17
|
+
require 'omnibus/s3_helpers'
|
18
|
+
|
17
19
|
module Omnibus
|
18
20
|
class S3Publisher < Publisher
|
21
|
+
include S3Helpers
|
22
|
+
|
19
23
|
def publish(&block)
|
20
24
|
log.info(log_key) { 'Starting S3 publisher' }
|
21
|
-
safe_require('uber-s3')
|
22
25
|
|
23
26
|
packages.each do |package|
|
24
27
|
# Make sure the package is good to go!
|
@@ -27,16 +30,13 @@ module Omnibus
|
|
27
30
|
|
28
31
|
# Upload the metadata first
|
29
32
|
log.debug(log_key) { "Uploading '#{package.metadata.name}'" }
|
30
|
-
|
31
|
-
|
32
|
-
)
|
33
|
+
store_object(key_for(package, package.metadata.name), package.metadata.to_json,
|
34
|
+
nil, access_policy)
|
33
35
|
|
34
36
|
# Upload the actual package
|
35
37
|
log.info(log_key) { "Uploading '#{package.name}'" }
|
36
|
-
|
37
|
-
|
38
|
-
content_md5: package.metadata[:md5],
|
39
|
-
)
|
38
|
+
store_object(key_for(package, package.name), package.content,
|
39
|
+
package.metadata[:md5], access_policy)
|
40
40
|
|
41
41
|
# If a block was given, "yield" the package to the caller
|
42
42
|
block.call(package) if block
|
@@ -45,18 +45,13 @@ module Omnibus
|
|
45
45
|
|
46
46
|
private
|
47
47
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
#
|
53
|
-
def client
|
54
|
-
@client ||= UberS3.new(
|
55
|
-
access_key: Config.publish_s3_access_key,
|
48
|
+
def s3_configuration
|
49
|
+
{
|
50
|
+
region: @options[:region],
|
51
|
+
access_key_id: Config.publish_s3_access_key,
|
56
52
|
secret_access_key: Config.publish_s3_secret_key,
|
57
|
-
|
58
|
-
|
59
|
-
)
|
53
|
+
bucket_name: @options[:bucket],
|
54
|
+
}
|
60
55
|
end
|
61
56
|
|
62
57
|
#
|
@@ -72,8 +67,8 @@ module Omnibus
|
|
72
67
|
#
|
73
68
|
def key_for(package, *stuff)
|
74
69
|
File.join(
|
75
|
-
|
76
|
-
|
70
|
+
package.metadata[:platform],
|
71
|
+
package.metadata[:platform_version],
|
77
72
|
package.metadata[:arch],
|
78
73
|
package.name,
|
79
74
|
*stuff,
|
@@ -85,14 +80,14 @@ module Omnibus
|
|
85
80
|
# initializer option. Any access control that is not the strict string
|
86
81
|
# +"public"+ is assumed to be private.
|
87
82
|
#
|
88
|
-
# @return [
|
89
|
-
# the
|
83
|
+
# @return [String]
|
84
|
+
# the access policy
|
90
85
|
#
|
91
86
|
def access_policy
|
92
87
|
if @options[:acl].to_s == 'public'
|
93
|
-
|
88
|
+
'public-read'
|
94
89
|
else
|
95
|
-
|
90
|
+
'private'
|
96
91
|
end
|
97
92
|
end
|
98
93
|
end
|
data/lib/omnibus/s3_cache.rb
CHANGED
@@ -15,13 +15,14 @@
|
|
15
15
|
#
|
16
16
|
|
17
17
|
require 'fileutils'
|
18
|
-
require '
|
18
|
+
require 'omnibus/s3_helpers'
|
19
19
|
|
20
20
|
module Omnibus
|
21
21
|
class S3Cache
|
22
22
|
include Logging
|
23
23
|
|
24
24
|
class << self
|
25
|
+
include S3Helpers
|
25
26
|
#
|
26
27
|
# List all software in the cache.
|
27
28
|
#
|
@@ -41,7 +42,7 @@ module Omnibus
|
|
41
42
|
# @return [Array<String>]
|
42
43
|
#
|
43
44
|
def keys
|
44
|
-
bucket.objects
|
45
|
+
bucket.objects.map(&:key)
|
45
46
|
end
|
46
47
|
|
47
48
|
#
|
@@ -70,16 +71,14 @@ module Omnibus
|
|
70
71
|
|
71
72
|
key = key_for(software)
|
72
73
|
fetcher = software.fetcher
|
73
|
-
content = IO.read(fetcher.downloaded_file)
|
74
74
|
|
75
75
|
log.info(log_key) do
|
76
76
|
"Caching '#{fetcher.downloaded_file}' to '#{Config.s3_bucket}/#{key}'"
|
77
77
|
end
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
)
|
79
|
+
File.open(fetcher.downloaded_file, 'rb') do |file|
|
80
|
+
store_object(key, file, software.fetcher.checksum, 'public-read')
|
81
|
+
end
|
83
82
|
end
|
84
83
|
|
85
84
|
true
|
@@ -129,33 +128,13 @@ module Omnibus
|
|
129
128
|
|
130
129
|
private
|
131
130
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
access_key: Config.s3_access_key,
|
140
|
-
secret_access_key: Config.s3_secret_key,
|
141
|
-
bucket: Config.s3_bucket,
|
142
|
-
adapter: :net_http,
|
143
|
-
)
|
144
|
-
end
|
145
|
-
|
146
|
-
#
|
147
|
-
# The bucket where the objects live.
|
148
|
-
#
|
149
|
-
# @return [UberS3::Bucket]
|
150
|
-
#
|
151
|
-
def bucket
|
152
|
-
@bucket ||= begin
|
153
|
-
if client.exists?('/')
|
154
|
-
client.bucket
|
155
|
-
else
|
156
|
-
client.connection.put('/')
|
157
|
-
end
|
158
|
-
end
|
131
|
+
def s3_configuration
|
132
|
+
{
|
133
|
+
region: Config.s3_region,
|
134
|
+
access_key_id: Config.s3_access_key,
|
135
|
+
secret_access_key: Config.s3_secret_key,
|
136
|
+
bucket_name: Config.s3_bucket
|
137
|
+
}
|
159
138
|
end
|
160
139
|
|
161
140
|
#
|
@@ -0,0 +1,119 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015 Chef Software, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'aws-sdk'
|
18
|
+
require 'base64'
|
19
|
+
|
20
|
+
module Omnibus
|
21
|
+
module S3Helpers
|
22
|
+
def self.included(base)
|
23
|
+
base.send(:include, InstanceMethods)
|
24
|
+
end
|
25
|
+
|
26
|
+
module InstanceMethods
|
27
|
+
private
|
28
|
+
#
|
29
|
+
# Returns the configuration for S3. You must provide keys
|
30
|
+
# :region,
|
31
|
+
#
|
32
|
+
# @example
|
33
|
+
# {
|
34
|
+
# region: 'us-east-1',
|
35
|
+
# access_key_id: Config.s3_access_key,
|
36
|
+
# secret_access_key: Config.s3_secret_key,
|
37
|
+
# bucket_name: Config.s3_bucket
|
38
|
+
# }
|
39
|
+
#
|
40
|
+
# @return [Hash<String, String>]
|
41
|
+
#
|
42
|
+
def s3_configuration
|
43
|
+
raise "You must override s3_configuration"
|
44
|
+
end
|
45
|
+
|
46
|
+
#
|
47
|
+
# The client to connect to S3 with.
|
48
|
+
#
|
49
|
+
# @return [Aws::S3::Resource]
|
50
|
+
#
|
51
|
+
def client
|
52
|
+
@s3_client ||= Aws::S3::Resource.new(
|
53
|
+
region: s3_configuration[:region],
|
54
|
+
access_key_id: s3_configuration[:access_key_id],
|
55
|
+
secret_access_key: s3_configuration[:secret_access_key]
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
#
|
60
|
+
# The bucket where the objects live.
|
61
|
+
#
|
62
|
+
# @return [Aws::S3::Bucket]
|
63
|
+
#
|
64
|
+
def bucket
|
65
|
+
@s3_bucket ||= begin
|
66
|
+
bucket = client.bucket(s3_configuration[:bucket_name])
|
67
|
+
unless bucket.exists?
|
68
|
+
bucket_config = if s3_configuration[:region] == 'us-east-1'
|
69
|
+
nil
|
70
|
+
else
|
71
|
+
{
|
72
|
+
location_constraint: s3_configuration[:region]
|
73
|
+
}
|
74
|
+
end
|
75
|
+
bucket.create(create_bucket_configuration: bucket_config)
|
76
|
+
end
|
77
|
+
bucket
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
#
|
82
|
+
# Store an object at the specified key
|
83
|
+
#
|
84
|
+
# @param [String] key
|
85
|
+
# @param [File, String] content
|
86
|
+
# @param [String] content_md5
|
87
|
+
# @param [String] acl
|
88
|
+
#
|
89
|
+
# @return [true]
|
90
|
+
#
|
91
|
+
def store_object(key, content, content_md5, acl)
|
92
|
+
bucket.put_object({
|
93
|
+
key: key,
|
94
|
+
body: content,
|
95
|
+
content_md5: to_base64_digest(content_md5),
|
96
|
+
acl: acl
|
97
|
+
})
|
98
|
+
true
|
99
|
+
end
|
100
|
+
|
101
|
+
#
|
102
|
+
# Convert a hex digest into a base64 hex digest
|
103
|
+
#
|
104
|
+
# For example:
|
105
|
+
# to_base64_digest('c3b5247592ce694f7097873aa07d66fe') => 'w7UkdZLOaU9wl4c6oH1m/g=='
|
106
|
+
#
|
107
|
+
# @param [String] content_md5
|
108
|
+
#
|
109
|
+
# @return [String]
|
110
|
+
#
|
111
|
+
def to_base64_digest(content_md5)
|
112
|
+
if content_md5
|
113
|
+
md5_digest = content_md5.unpack('a2'*16).collect {|i| i.hex.chr }.join
|
114
|
+
Base64.encode64(md5_digest).strip
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
#
|
2
|
+
# Copyright 2015 Chef Software, Inc.
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'mixlib/versioning'
|
18
|
+
|
19
|
+
module Omnibus
|
20
|
+
class SemanticVersion
|
21
|
+
|
22
|
+
def initialize(version_string)
|
23
|
+
@prefix = if version_string =~ /^v/
|
24
|
+
"v"
|
25
|
+
else
|
26
|
+
""
|
27
|
+
end
|
28
|
+
@version = Mixlib::Versioning.parse(version_string.gsub(/^v/, ""))
|
29
|
+
if @version.nil?
|
30
|
+
raise InvalidVersion, "#{version_string} could not be parsed as a valid version"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def to_s
|
35
|
+
"#{prefix}#{version}"
|
36
|
+
end
|
37
|
+
|
38
|
+
def next_patch
|
39
|
+
s = [version.major, version.minor, version.patch + 1].join(".")
|
40
|
+
self.class.new("#{prefix}#{s}")
|
41
|
+
end
|
42
|
+
|
43
|
+
def next_minor
|
44
|
+
s = [version.major, version.minor + 1, 0].join(".")
|
45
|
+
self.class.new("#{prefix}#{s}")
|
46
|
+
end
|
47
|
+
|
48
|
+
def next_major
|
49
|
+
s = [version.major + 1, 0, 0].join(".")
|
50
|
+
self.class.new("#{prefix}#{s}")
|
51
|
+
end
|
52
|
+
|
53
|
+
private
|
54
|
+
|
55
|
+
attr_reader :prefix, :version
|
56
|
+
end
|
57
|
+
end
|
data/lib/omnibus/software.rb
CHANGED
@@ -16,6 +16,7 @@
|
|
16
16
|
|
17
17
|
require 'fileutils'
|
18
18
|
require 'uri'
|
19
|
+
require 'omnibus/manifest_entry'
|
19
20
|
|
20
21
|
module Omnibus
|
21
22
|
class Software
|
@@ -28,7 +29,7 @@ module Omnibus
|
|
28
29
|
#
|
29
30
|
# @return [Software]
|
30
31
|
#
|
31
|
-
def load(project, name)
|
32
|
+
def load(project, name, manifest)
|
32
33
|
loaded_softwares[name] ||= begin
|
33
34
|
filepath = Omnibus.software_path(name)
|
34
35
|
|
@@ -40,7 +41,7 @@ module Omnibus
|
|
40
41
|
end
|
41
42
|
end
|
42
43
|
|
43
|
-
instance = new(project, filepath)
|
44
|
+
instance = new(project, filepath, manifest)
|
44
45
|
instance.evaluate_file(filepath)
|
45
46
|
instance.load_dependencies
|
46
47
|
|
@@ -69,6 +70,8 @@ module Omnibus
|
|
69
70
|
include NullArgumentable
|
70
71
|
include Sugarable
|
71
72
|
|
73
|
+
attr_reader :manifest
|
74
|
+
|
72
75
|
#
|
73
76
|
# Create a new software object.
|
74
77
|
#
|
@@ -76,10 +79,12 @@ module Omnibus
|
|
76
79
|
# the Omnibus project that instantiated this software definition
|
77
80
|
# @param [String] filepath
|
78
81
|
# the path to where this software definition lives on disk
|
82
|
+
# @param [String] manifest
|
83
|
+
# the user-supplied software manifest
|
79
84
|
#
|
80
85
|
# @return [Software]
|
81
86
|
#
|
82
|
-
def initialize(project, filepath = nil)
|
87
|
+
def initialize(project, filepath = nil, manifest=nil)
|
83
88
|
unless project.is_a?(Project)
|
84
89
|
raise ArgumentError,
|
85
90
|
"`project' must be a kind of `Omnibus::Project', but was `#{project.class.inspect}'!"
|
@@ -88,11 +93,22 @@ module Omnibus
|
|
88
93
|
# Magical methods
|
89
94
|
@filepath = filepath
|
90
95
|
@project = project
|
96
|
+
@manifest = manifest
|
91
97
|
|
92
98
|
# Overrides
|
93
99
|
@overrides = NULL
|
94
100
|
end
|
95
101
|
|
102
|
+
def manifest_entry
|
103
|
+
@manifest_entry ||= if manifest
|
104
|
+
log.info(log_key) {"Using user-supplied manifest entry for #{name}"}
|
105
|
+
manifest.entry_for(name)
|
106
|
+
else
|
107
|
+
log.info(log_key) {"Resolving manifest entry for #{name}"}
|
108
|
+
to_manifest_entry
|
109
|
+
end
|
110
|
+
end
|
111
|
+
|
96
112
|
#
|
97
113
|
# Compare two software projects (by name).
|
98
114
|
#
|
@@ -204,11 +220,21 @@ module Omnibus
|
|
204
220
|
# @option val [String] :path (nil)
|
205
221
|
# a fully-qualified local file system path
|
206
222
|
# @option val [String] :md5 (nil)
|
207
|
-
# the checksum of the downloaded artifact
|
223
|
+
# the MD5 checksum of the downloaded artifact
|
224
|
+
# @option val [String] :sha1 (nil)
|
225
|
+
# the SHA1 checksum of the downloaded artifact
|
226
|
+
# @option val [String] :sha256 (nil)
|
227
|
+
# the SHA256 checksum of the downloaded artifact
|
228
|
+
# @option val [String] :sha512 (nil)
|
229
|
+
# the SHA512 checksum of the downloaded artifact
|
208
230
|
# @option val [String] :cookie (nil)
|
209
231
|
# a cookie to set
|
210
232
|
# @option val [String] :warning (nil)
|
211
233
|
# a warning message to print when downloading
|
234
|
+
# @option val [Boolean] :submodules (false)
|
235
|
+
# clone git submodules
|
236
|
+
#
|
237
|
+
# If multiple checksum types are provided, only the strongest will be used.
|
212
238
|
#
|
213
239
|
# @return [Hash]
|
214
240
|
#
|
@@ -219,7 +245,8 @@ module Omnibus
|
|
219
245
|
"be a kind of `Hash', but was `#{val.class.inspect}'")
|
220
246
|
end
|
221
247
|
|
222
|
-
extra_keys = val.keys - [:git, :path, :url, :md5, :
|
248
|
+
extra_keys = val.keys - [:git, :path, :url, :md5, :sha1, :sha256, :sha512,
|
249
|
+
:cookie, :warning, :unsafe, :options, :submodules]
|
223
250
|
unless extra_keys.empty?
|
224
251
|
raise InvalidValue.new(:source,
|
225
252
|
"only include valid keys. Invalid keys: #{extra_keys.inspect}")
|
@@ -240,13 +267,14 @@ module Omnibus
|
|
240
267
|
expose :source
|
241
268
|
|
242
269
|
#
|
243
|
-
# Set or
|
270
|
+
# Set or retrieve the {#default_version} of the software to build.
|
244
271
|
#
|
245
272
|
# @example
|
246
273
|
# default_version '1.2.3'
|
247
274
|
#
|
248
275
|
# @param [String] val
|
249
|
-
# the default version to set for the software
|
276
|
+
# the default version to set for the software.
|
277
|
+
# For a git source, the default version may be a git ref (e.g. tag, branch name, or sha).
|
250
278
|
#
|
251
279
|
# @return [String]
|
252
280
|
#
|
@@ -435,7 +463,6 @@ module Omnibus
|
|
435
463
|
"CC" => "xlc_r -q64",
|
436
464
|
"CXX" => "xlC_r -q64",
|
437
465
|
"CFLAGS" => "-q64 -I#{install_dir}/embedded/include -D_LARGE_FILES -O",
|
438
|
-
"CXXFLAGS" => "-q64 -I#{install_dir}/embedded/include -D_LARGE_FILES -O",
|
439
466
|
"LDFLAGS" => "-q64 -L#{install_dir}/embedded/lib -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib",
|
440
467
|
"LD" => "ld -b64",
|
441
468
|
"OBJECT_MODE" => "64",
|
@@ -484,21 +511,36 @@ module Omnibus
|
|
484
511
|
extra_linker_flags = {
|
485
512
|
"LD_RUN_PATH" => "#{install_dir}/embedded/lib"
|
486
513
|
}
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
514
|
+
|
515
|
+
if solaris2?
|
516
|
+
# in order to provide compatibility for earlier versions of libc on solaris 10,
|
517
|
+
# we need to specify a mapfile that restricts the version of system libraries
|
518
|
+
# used. See http://docs.oracle.com/cd/E23824_01/html/819-0690/chapter5-1.html
|
519
|
+
# for more information
|
520
|
+
# use the mapfile if it exists, otherwise ignore it
|
521
|
+
ld_options = "-R#{install_dir}/embedded/lib"
|
522
|
+
mapfile_path = File.expand_path(Config.solaris_linker_mapfile, Config.project_root)
|
523
|
+
ld_options << " -M #{mapfile_path}" if File.exist?(mapfile_path)
|
524
|
+
|
525
|
+
# solaris linker can also use LD_OPTIONS, so we throw the kitchen sink against
|
526
|
+
# the linker, to find every way to make it use our rpath. This is also required
|
527
|
+
# to use the aforementioned mapfile.
|
528
|
+
extra_linker_flags.merge!(
|
529
|
+
{
|
530
|
+
"LD_OPTIONS" => ld_options
|
531
|
+
}
|
532
|
+
)
|
533
|
+
end
|
534
|
+
|
494
535
|
env.merge(compiler_flags).
|
495
536
|
merge(extra_linker_flags).
|
496
537
|
# always want to favor pkg-config from embedded location to not hose
|
497
538
|
# configure scripts which try to be too clever and ignore our explicit
|
498
539
|
# CFLAGS and LDFLAGS in favor of pkg-config info
|
499
540
|
merge({"PKG_CONFIG_PATH" => "#{install_dir}/embedded/lib/pkgconfig"}).
|
500
|
-
# Set default values for CXXFLAGS.
|
501
|
-
merge('CXXFLAGS' => compiler_flags['CFLAGS'])
|
541
|
+
# Set default values for CXXFLAGS and CPPFLAGS.
|
542
|
+
merge('CXXFLAGS' => compiler_flags['CFLAGS']).
|
543
|
+
merge('CPPFLAGS' => compiler_flags['CFLAGS'])
|
502
544
|
end
|
503
545
|
expose :with_standard_compiler_flags
|
504
546
|
|
@@ -566,7 +608,7 @@ module Omnibus
|
|
566
608
|
#
|
567
609
|
def load_dependencies
|
568
610
|
dependencies.each do |dependency|
|
569
|
-
|
611
|
+
Software.load(project, dependency, manifest)
|
570
612
|
end
|
571
613
|
|
572
614
|
true
|
@@ -581,6 +623,14 @@ module Omnibus
|
|
581
623
|
@builder ||= Builder.new(self)
|
582
624
|
end
|
583
625
|
|
626
|
+
def to_manifest_entry
|
627
|
+
Omnibus::ManifestEntry.new(name, {
|
628
|
+
source_type: source_type,
|
629
|
+
described_version: version,
|
630
|
+
locked_version: Fetcher.resolve_version(version, source),
|
631
|
+
locked_source: source})
|
632
|
+
end
|
633
|
+
|
584
634
|
#
|
585
635
|
# Fetch the software definition using the appropriate fetcher. This may
|
586
636
|
# fetch the software from a local path location, git location, or download
|
@@ -684,25 +734,30 @@ module Omnibus
|
|
684
734
|
end
|
685
735
|
|
686
736
|
#
|
687
|
-
# The fetcher for this software
|
688
|
-
#
|
689
|
-
# - +:url+ - {NetFetcher}
|
690
|
-
# - +:git+ - {GitFetcher}
|
691
|
-
# - +:path+ - {PathFetcher}
|
737
|
+
# The fetcher for this software
|
692
738
|
#
|
693
739
|
# @return [Fetcher]
|
694
740
|
#
|
695
741
|
def fetcher
|
696
|
-
@fetcher ||=
|
742
|
+
@fetcher ||= Fetcher.fetcher_class_for_source(self.source).new(manifest_entry, project_dir, build_dir)
|
743
|
+
end
|
744
|
+
|
745
|
+
#
|
746
|
+
# The type of source specified for this software defintion.
|
747
|
+
#
|
748
|
+
# @return [String]
|
749
|
+
#
|
750
|
+
def source_type
|
751
|
+
if source
|
697
752
|
if source[:url]
|
698
|
-
|
753
|
+
:url
|
699
754
|
elsif source[:git]
|
700
|
-
|
755
|
+
:git
|
701
756
|
elsif source[:path]
|
702
|
-
|
757
|
+
:path
|
703
758
|
end
|
704
759
|
else
|
705
|
-
|
760
|
+
:project_local
|
706
761
|
end
|
707
762
|
end
|
708
763
|
|
@@ -862,5 +917,9 @@ module Omnibus
|
|
862
917
|
def log_key
|
863
918
|
@log_key ||= "#{super}: #{name}"
|
864
919
|
end
|
920
|
+
|
921
|
+
def to_s
|
922
|
+
"#{name}[#{filepath}]"
|
923
|
+
end
|
865
924
|
end
|
866
925
|
end
|