omnibus 3.2.0.rc.1 → 3.2.0.rc.2
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -2
- data/Rakefile +2 -2
- data/lib/omnibus.rb +13 -4
- data/lib/omnibus/builder.rb +596 -248
- data/lib/omnibus/cleanroom.rb +7 -7
- data/lib/omnibus/cli/deprecated.rb +1 -1
- data/lib/omnibus/exceptions.rb +36 -5
- data/lib/omnibus/fetchers/net_fetcher.rb +4 -0
- data/lib/omnibus/git_cache.rb +3 -3
- data/lib/omnibus/instrumentation.rb +29 -0
- data/lib/omnibus/package.rb +98 -5
- data/lib/omnibus/packagers/base.rb +1 -0
- data/lib/omnibus/project.rb +5 -64
- data/lib/omnibus/publishers/artifactory_publisher.rb +4 -1
- data/lib/omnibus/software.rb +52 -29
- data/lib/omnibus/util.rb +11 -1
- data/lib/omnibus/version.rb +1 -1
- data/omnibus.gemspec +2 -3
- data/spec/data/complicated/config/software/libyaml-windows.rb +1 -1
- data/spec/functional/builder_spec.rb +305 -0
- data/spec/{functional → integration}/packagers/mac_spec.rb +0 -0
- data/spec/{functional → integration}/packagers/windows_spec.rb +0 -0
- data/spec/spec_helper.rb +8 -7
- data/spec/unit/build_version_dsl_spec.rb +77 -75
- data/spec/unit/build_version_spec.rb +4 -4
- data/spec/unit/builder_spec.rb +49 -0
- data/spec/unit/config_spec.rb +1 -1
- data/spec/unit/fetchers/git_fetcher_spec.rb +11 -11
- data/spec/unit/fetchers/net_fetcher_spec.rb +3 -5
- data/spec/unit/git_cache_spec.rb +2 -2
- data/spec/unit/package_spec.rb +118 -11
- data/spec/unit/packagers/base_spec.rb +17 -17
- data/spec/unit/packagers/mac_pkg_spec.rb +1 -1
- data/spec/unit/project_spec.rb +27 -101
- data/spec/unit/publisher_spec.rb +2 -2
- data/spec/unit/publishers/artifactory_publisher_spec.rb +8 -7
- data/spec/unit/publishers/s3_publisher_spec.rb +3 -3
- data/spec/unit/s3_cacher_spec.rb +2 -2
- data/spec/unit/software_spec.rb +26 -18
- metadata +27 -22
data/lib/omnibus/cleanroom.rb
CHANGED
|
@@ -68,20 +68,20 @@ module Omnibus
|
|
|
68
68
|
raise NameError, "undefined method `#{name}' for class `#{self.name}'"
|
|
69
69
|
end
|
|
70
70
|
|
|
71
|
-
|
|
71
|
+
exposed_methods[name] = true
|
|
72
72
|
end
|
|
73
73
|
|
|
74
|
-
private
|
|
75
|
-
|
|
76
74
|
#
|
|
77
75
|
# The list of exposed methods.
|
|
78
76
|
#
|
|
79
77
|
# @return [Hash]
|
|
80
78
|
#
|
|
81
|
-
def
|
|
82
|
-
@
|
|
79
|
+
def exposed_methods
|
|
80
|
+
@exposed_methods ||= {}
|
|
83
81
|
end
|
|
84
82
|
|
|
83
|
+
private
|
|
84
|
+
|
|
85
85
|
#
|
|
86
86
|
# The cleanroom instance for this class. This method is intentionally
|
|
87
87
|
# NOT cached!
|
|
@@ -89,7 +89,7 @@ module Omnibus
|
|
|
89
89
|
# @return [Class]
|
|
90
90
|
#
|
|
91
91
|
def cleanroom
|
|
92
|
-
|
|
92
|
+
exposed = exposed_methods.keys
|
|
93
93
|
parent = self.name
|
|
94
94
|
|
|
95
95
|
Class.new do
|
|
@@ -97,7 +97,7 @@ module Omnibus
|
|
|
97
97
|
@instance = instance
|
|
98
98
|
end
|
|
99
99
|
|
|
100
|
-
|
|
100
|
+
exposed.each do |exposed_method|
|
|
101
101
|
define_method(exposed_method) do |*args, &block|
|
|
102
102
|
@instance.send(exposed_method, *args, &block)
|
|
103
103
|
end
|
|
@@ -68,7 +68,7 @@ module Omnibus
|
|
|
68
68
|
# $ omnibus build project PROJECT
|
|
69
69
|
#
|
|
70
70
|
if args[0..1] == %w(build project)
|
|
71
|
-
warn("The interface for building a project has changed. Please use 'omnibus build
|
|
71
|
+
warn("The interface for building a project has changed. Please use 'omnibus build #{args[2]}' instead.")
|
|
72
72
|
args.delete_at(1)
|
|
73
73
|
return old_dispatch(m, args, options, config)
|
|
74
74
|
end
|
data/lib/omnibus/exceptions.rb
CHANGED
|
@@ -290,17 +290,17 @@ EOH
|
|
|
290
290
|
end
|
|
291
291
|
|
|
292
292
|
#
|
|
293
|
-
# Raised when Omnibus encounters a
|
|
293
|
+
# Raised when Omnibus encounters a platform it does not know how to
|
|
294
294
|
# build/check/handle.
|
|
295
295
|
#
|
|
296
|
-
class
|
|
297
|
-
def initialize(
|
|
298
|
-
@
|
|
296
|
+
class UnknownPlatform < Error
|
|
297
|
+
def initialize(platform)
|
|
298
|
+
@platform = platform
|
|
299
299
|
end
|
|
300
300
|
|
|
301
301
|
def to_s
|
|
302
302
|
<<-EOH
|
|
303
|
-
Unknown platform
|
|
303
|
+
Unknown platform `#{@platform}'!
|
|
304
304
|
I do not know how to proceed!"
|
|
305
305
|
EOH
|
|
306
306
|
end
|
|
@@ -327,6 +327,37 @@ EOH
|
|
|
327
327
|
def to_s
|
|
328
328
|
<<-EOH
|
|
329
329
|
The health check failed! Please see above for important information.
|
|
330
|
+
EOH
|
|
331
|
+
end
|
|
332
|
+
end
|
|
333
|
+
|
|
334
|
+
class MissingBuildBlock < Error
|
|
335
|
+
def initialize(software)
|
|
336
|
+
@software = software
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
def to_s
|
|
340
|
+
<<-EOH
|
|
341
|
+
The software definition `#{@software.name}' does not define a build block. In
|
|
342
|
+
order to build the software, you must define a build block like:
|
|
343
|
+
|
|
344
|
+
build do
|
|
345
|
+
# Build steps here
|
|
346
|
+
end
|
|
347
|
+
EOH
|
|
348
|
+
end
|
|
349
|
+
end
|
|
350
|
+
|
|
351
|
+
class MissingSoftwareSourceURI < Error
|
|
352
|
+
def initialize(software)
|
|
353
|
+
@software = software
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
def to_s
|
|
357
|
+
<<-EOH
|
|
358
|
+
The software `#{@software.name}' does not declare a `source' attribute which is
|
|
359
|
+
a URL. This is not a required attribute, but you are attempting to access
|
|
360
|
+
another attribute or method that requires a `source' (URI) is defined.
|
|
330
361
|
EOH
|
|
331
362
|
end
|
|
332
363
|
end
|
data/lib/omnibus/git_cache.rb
CHANGED
|
@@ -116,13 +116,13 @@ module Omnibus
|
|
|
116
116
|
remove_git_dirs
|
|
117
117
|
|
|
118
118
|
shellout!(%Q(git --git-dir=#{cache_path} --work-tree=#{install_dir} add -A -f))
|
|
119
|
+
|
|
119
120
|
begin
|
|
120
121
|
shellout!(%Q(git --git-dir=#{cache_path} --work-tree=#{install_dir} commit -q -m "Backup of #{tag}"))
|
|
121
122
|
rescue Mixlib::ShellOut::ShellCommandFailed => e
|
|
122
|
-
|
|
123
|
-
raise
|
|
124
|
-
end
|
|
123
|
+
raise unless e.message.include?('nothing to commit')
|
|
125
124
|
end
|
|
125
|
+
|
|
126
126
|
shellout!(%Q(git --git-dir=#{cache_path} --work-tree=#{install_dir} tag -f "#{tag}"))
|
|
127
127
|
end
|
|
128
128
|
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright 2013-2014 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
|
+
module Omnibus
|
|
18
|
+
module Instrumentation
|
|
19
|
+
include Logging
|
|
20
|
+
|
|
21
|
+
def measure(label, &block)
|
|
22
|
+
start = Time.now
|
|
23
|
+
block.call
|
|
24
|
+
ensure
|
|
25
|
+
elapsed = Time.now - start
|
|
26
|
+
log.info(log_key) { "#{label}: #{elapsed.to_f.round(4)}s" }
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
data/lib/omnibus/package.rb
CHANGED
|
@@ -33,11 +33,14 @@ module Omnibus
|
|
|
33
33
|
#
|
|
34
34
|
def generate(package, data = {})
|
|
35
35
|
data = {
|
|
36
|
-
basename:
|
|
37
|
-
md5:
|
|
38
|
-
sha1:
|
|
39
|
-
sha256:
|
|
40
|
-
sha512:
|
|
36
|
+
basename: package.name,
|
|
37
|
+
md5: package.md5,
|
|
38
|
+
sha1: package.sha1,
|
|
39
|
+
sha256: package.sha256,
|
|
40
|
+
sha512: package.sha512,
|
|
41
|
+
platform: platform_shortname,
|
|
42
|
+
platform_version: platform_version,
|
|
43
|
+
arch: arch,
|
|
41
44
|
}.merge(data)
|
|
42
45
|
|
|
43
46
|
instance = new(package, data)
|
|
@@ -56,6 +59,10 @@ module Omnibus
|
|
|
56
59
|
def for_package(package)
|
|
57
60
|
data = File.read(path_for(package))
|
|
58
61
|
hash = JSON.parse(data, symbolize_names: true)
|
|
62
|
+
|
|
63
|
+
# Ensure an interation exists
|
|
64
|
+
hash[:iteration] ||= 1
|
|
65
|
+
|
|
59
66
|
new(package, hash)
|
|
60
67
|
rescue Errno::ENOENT
|
|
61
68
|
raise NoPackageMetadataFile.new(package.path)
|
|
@@ -72,6 +79,92 @@ module Omnibus
|
|
|
72
79
|
def path_for(package)
|
|
73
80
|
"#{package.path}.metadata.json"
|
|
74
81
|
end
|
|
82
|
+
|
|
83
|
+
#
|
|
84
|
+
# The architecture for this machine, as reported from Ohai.
|
|
85
|
+
#
|
|
86
|
+
# @return [String]
|
|
87
|
+
#
|
|
88
|
+
def arch
|
|
89
|
+
Ohai['kernel']['machine']
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
#
|
|
93
|
+
# On certain platforms we don't care about the full MAJOR.MINOR.PATCH platform
|
|
94
|
+
# version. This method will properly truncate the version down to a more human
|
|
95
|
+
# friendly version. This version can also be thought of as a 'marketing'
|
|
96
|
+
# version.
|
|
97
|
+
#
|
|
98
|
+
# @param [String] platform_version
|
|
99
|
+
# the platform version to truncate
|
|
100
|
+
# @param [String] platform_shortname
|
|
101
|
+
# the platform shortname. this might be an Ohai-returned platform or
|
|
102
|
+
# platform family but it also might be a shortname like `el`
|
|
103
|
+
#
|
|
104
|
+
def platform_version
|
|
105
|
+
case platform_shortname
|
|
106
|
+
when 'centos', 'debian', 'fedora', 'freebsd', 'rhel', 'el'
|
|
107
|
+
# Only want MAJOR (e.g. Debian 7)
|
|
108
|
+
Ohai['platform_version'].split('.').first
|
|
109
|
+
when 'aix', 'arch', 'gentoo', 'mac_os_x', 'openbsd', 'slackware', 'solaris2', 'suse', 'ubuntu'
|
|
110
|
+
# Only want MAJOR.MINOR (e.g. Mac OS X 10.9, Ubuntu 12.04)
|
|
111
|
+
Ohai['platform_version'].split('.')[0..1].join('.')
|
|
112
|
+
when 'omnios', 'smartos'
|
|
113
|
+
# Only want MAJOR (e.g OmniOS r151006, SmartOS 20120809T221258Z)
|
|
114
|
+
Ohai['platform_version'].split('.').first
|
|
115
|
+
when 'windows'
|
|
116
|
+
# Windows has this really awesome "feature", where their version numbers
|
|
117
|
+
# internally do not match the "marketing" name.
|
|
118
|
+
#
|
|
119
|
+
# Definitively computing the Windows marketing name actually takes more
|
|
120
|
+
# than the platform version. Take a look at the following file for the
|
|
121
|
+
# details:
|
|
122
|
+
#
|
|
123
|
+
# https://github.com/opscode/chef/blob/master/lib/chef/win32/version.rb
|
|
124
|
+
#
|
|
125
|
+
# As we don't need to be exact here the simple mapping below is based on:
|
|
126
|
+
#
|
|
127
|
+
# http://www.jrsoftware.org/ishelp/index.php?topic=winvernotes
|
|
128
|
+
#
|
|
129
|
+
case Ohai['platform_version']
|
|
130
|
+
when '5.0.2195', '2000' then '2000'
|
|
131
|
+
when '5.1.2600', 'xp' then 'xp'
|
|
132
|
+
when '5.2.3790', '2003r2' then '2003r2'
|
|
133
|
+
when '6.0.6001', '2008' then '2008'
|
|
134
|
+
when '6.1.7600', '7' then '7'
|
|
135
|
+
when '6.1.7601', '2008r2' then '2008r2'
|
|
136
|
+
when '6.2.9200', '8' then '8'
|
|
137
|
+
# The following `when` will never match since Windows 2012's platform
|
|
138
|
+
# version is the same as Windows 8. It's only here for completeness and
|
|
139
|
+
# documentation.
|
|
140
|
+
when '6.2.9200', '2012' then '2012'
|
|
141
|
+
when '6.3.9200', '8.1' then '8.1'
|
|
142
|
+
# The following `when` will never match since Windows 2012R2's platform
|
|
143
|
+
# version is the same as Windows 8.1. It's only here for completeness
|
|
144
|
+
# and documentation.
|
|
145
|
+
when '6.3.9200', '2012r2' then '2012r2'
|
|
146
|
+
else
|
|
147
|
+
raise UnknownPlatformVersion.new(platform_shortname, Ohai['platform_version'])
|
|
148
|
+
end
|
|
149
|
+
else
|
|
150
|
+
raise UnknownPlatform.new(platform_shortname)
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
|
|
154
|
+
#
|
|
155
|
+
# Platform name to be used when creating metadata for the artifact.
|
|
156
|
+
# rhel/centos become "el", all others are just platform
|
|
157
|
+
#
|
|
158
|
+
# @return [String]
|
|
159
|
+
# the platform family short name
|
|
160
|
+
#
|
|
161
|
+
def platform_shortname
|
|
162
|
+
if Ohai['platform_family'] == 'rhel'
|
|
163
|
+
'el'
|
|
164
|
+
else
|
|
165
|
+
Ohai['platform']
|
|
166
|
+
end
|
|
167
|
+
end
|
|
75
168
|
end
|
|
76
169
|
|
|
77
170
|
#
|
data/lib/omnibus/project.rb
CHANGED
|
@@ -185,7 +185,7 @@ module Omnibus
|
|
|
185
185
|
if null?(val)
|
|
186
186
|
@install_dir || raise(MissingProjectConfiguration.new('install_dir', '/opt/chef'))
|
|
187
187
|
else
|
|
188
|
-
@install_dir = windows_safe_path(val)
|
|
188
|
+
@install_dir = File.expand_path(windows_safe_path(val))
|
|
189
189
|
end
|
|
190
190
|
end
|
|
191
191
|
expose :install_dir
|
|
@@ -223,7 +223,7 @@ module Omnibus
|
|
|
223
223
|
# path to the files directory
|
|
224
224
|
#
|
|
225
225
|
def files_path
|
|
226
|
-
"#{Config.project_root}/files"
|
|
226
|
+
File.expand_path("#{Config.project_root}/files")
|
|
227
227
|
end
|
|
228
228
|
expose :files_path
|
|
229
229
|
|
|
@@ -521,7 +521,7 @@ module Omnibus
|
|
|
521
521
|
if null?(val)
|
|
522
522
|
@resources_path
|
|
523
523
|
else
|
|
524
|
-
@resources_path = val
|
|
524
|
+
@resources_path = File.expand_path(val)
|
|
525
525
|
end
|
|
526
526
|
end
|
|
527
527
|
expose :resources_path
|
|
@@ -556,7 +556,7 @@ module Omnibus
|
|
|
556
556
|
if null?(arg)
|
|
557
557
|
@package_scripts_path || "#{Config.project_root}/package-scripts/#{name}"
|
|
558
558
|
else
|
|
559
|
-
@package_scripts_path = arg
|
|
559
|
+
@package_scripts_path = File.expand_path(arg)
|
|
560
560
|
end
|
|
561
561
|
end
|
|
562
562
|
expose :package_scripts_path
|
|
@@ -836,7 +836,7 @@ module Omnibus
|
|
|
836
836
|
# @return [Array<String>]
|
|
837
837
|
#
|
|
838
838
|
def runtime_dependencies
|
|
839
|
-
runtime_dependencies ||= []
|
|
839
|
+
@runtime_dependencies ||= []
|
|
840
840
|
end
|
|
841
841
|
|
|
842
842
|
#
|
|
@@ -1122,62 +1122,6 @@ module Omnibus
|
|
|
1122
1122
|
end
|
|
1123
1123
|
end
|
|
1124
1124
|
|
|
1125
|
-
#
|
|
1126
|
-
# Platform version to be used in package metadata. For rhel, the minor
|
|
1127
|
-
# version is removed, e.g., "5.6" becomes "5". For all other platforms,
|
|
1128
|
-
# this is just the platform_version.
|
|
1129
|
-
#
|
|
1130
|
-
# @return [String]
|
|
1131
|
-
# the platform version
|
|
1132
|
-
#
|
|
1133
|
-
def platform_version_for_package
|
|
1134
|
-
case Ohai['platform_family']
|
|
1135
|
-
when 'debian', 'fedora', 'freebsd', 'rhel'
|
|
1136
|
-
if Ohai['platform'] == 'ubuntu'
|
|
1137
|
-
# Only want MAJOR.MINOR (Ubuntu 12.04)
|
|
1138
|
-
Ohai['platform_version'].split('.')[0..1].join('.')
|
|
1139
|
-
else
|
|
1140
|
-
# Only want MAJOR (Debian 7)
|
|
1141
|
-
Ohai['platform_version'].split('.').first
|
|
1142
|
-
end
|
|
1143
|
-
when 'aix', 'arch', 'gentoo', 'mac_os_x', 'openbsd', 'slackware', 'solaris2', 'suse'
|
|
1144
|
-
# Only want MAJOR.MINOR
|
|
1145
|
-
Ohai['platform_version'].split('.')[0..1].join('.')
|
|
1146
|
-
when 'omnios', 'smartos'
|
|
1147
|
-
# Only want MAJOR
|
|
1148
|
-
Ohai['platform_version'].split('.').first
|
|
1149
|
-
when 'windows'
|
|
1150
|
-
# Windows has this really awesome "feature", where their version numbers
|
|
1151
|
-
# internally do not match the "marketing" name. Dear Microsoft, this is
|
|
1152
|
-
# why we cannot have nice things.
|
|
1153
|
-
case Ohai['platform_version']
|
|
1154
|
-
when '6.1.7600' then '7'
|
|
1155
|
-
when '6.1.7601' then '2008r2'
|
|
1156
|
-
when '6.2.9200' then '8'
|
|
1157
|
-
when '6.3.9200' then '8.1'
|
|
1158
|
-
else
|
|
1159
|
-
raise UnknownPlatformVersion.new(Ohai['platform'], Ohai['platform_version'])
|
|
1160
|
-
end
|
|
1161
|
-
else
|
|
1162
|
-
raise UnknownPlatformFamily.new(Ohai['platform_family'])
|
|
1163
|
-
end
|
|
1164
|
-
end
|
|
1165
|
-
|
|
1166
|
-
#
|
|
1167
|
-
# Platform name to be used when creating metadata for the artifact.
|
|
1168
|
-
# rhel/centos become "el", all others are just platform
|
|
1169
|
-
#
|
|
1170
|
-
# @return [String]
|
|
1171
|
-
# the platform family short name
|
|
1172
|
-
#
|
|
1173
|
-
def platform_shortname
|
|
1174
|
-
if Ohai['platform_family'] == 'rhel'
|
|
1175
|
-
'el'
|
|
1176
|
-
else
|
|
1177
|
-
Ohai['platform']
|
|
1178
|
-
end
|
|
1179
|
-
end
|
|
1180
|
-
|
|
1181
1125
|
def render_metadata(pkg_type)
|
|
1182
1126
|
basename = output_package(pkg_type)
|
|
1183
1127
|
pkg_path = "#{Config.package_dir}/#{basename}"
|
|
@@ -1191,9 +1135,6 @@ module Omnibus
|
|
|
1191
1135
|
name: name,
|
|
1192
1136
|
friendly_name: friendly_name,
|
|
1193
1137
|
homepage: homepage,
|
|
1194
|
-
platform: platform_shortname,
|
|
1195
|
-
platform_version: platform_version_for_package,
|
|
1196
|
-
arch: Ohai['kernel']['machine'],
|
|
1197
1138
|
version: build_version,
|
|
1198
1139
|
iteration: build_iteration,
|
|
1199
1140
|
)
|
|
@@ -93,8 +93,9 @@ module Omnibus
|
|
|
93
93
|
'omnibus.project' => package.metadata[:name],
|
|
94
94
|
'omnibus.platform' => package.metadata[:platform],
|
|
95
95
|
'omnibus.platform_version' => package.metadata[:platform_version],
|
|
96
|
-
'omnibus.
|
|
96
|
+
'omnibus.architecture' => package.metadata[:arch],
|
|
97
97
|
'omnibus.version' => package.metadata[:version],
|
|
98
|
+
'omnibus.iteration' => package.metadata[:iteration],
|
|
98
99
|
'omnibus.md5' => package.metadata[:md5],
|
|
99
100
|
'omnibus.sha1' => package.metadata[:sha1],
|
|
100
101
|
'omnibus.sha256' => package.metadata[:sha256],
|
|
@@ -137,6 +138,8 @@ module Omnibus
|
|
|
137
138
|
*domain_parts,
|
|
138
139
|
package.metadata[:name],
|
|
139
140
|
package.metadata[:version],
|
|
141
|
+
package.metadata[:platform],
|
|
142
|
+
package.metadata[:platform_version],
|
|
140
143
|
package.metadata[:basename],
|
|
141
144
|
)
|
|
142
145
|
end
|
data/lib/omnibus/software.rb
CHANGED
|
@@ -72,16 +72,6 @@ module Omnibus
|
|
|
72
72
|
@repo_overrides = repo_overrides
|
|
73
73
|
end
|
|
74
74
|
|
|
75
|
-
#
|
|
76
|
-
# The builder for this softare. This defaults to a {NullBuilder}, but
|
|
77
|
-
# can be specified using the {#build} DSL method.
|
|
78
|
-
#
|
|
79
|
-
# @return [Builder]
|
|
80
|
-
#
|
|
81
|
-
def builder
|
|
82
|
-
@builder ||= NullBuilder.new(self)
|
|
83
|
-
end
|
|
84
|
-
|
|
85
75
|
#
|
|
86
76
|
# Compare two software projects (by name).
|
|
87
77
|
#
|
|
@@ -363,7 +353,7 @@ module Omnibus
|
|
|
363
353
|
# @return [String]
|
|
364
354
|
#
|
|
365
355
|
def project_dir
|
|
366
|
-
|
|
356
|
+
File.expand_path("#{Config.source_dir}/#{relative_path}")
|
|
367
357
|
end
|
|
368
358
|
expose :project_dir
|
|
369
359
|
|
|
@@ -373,7 +363,7 @@ module Omnibus
|
|
|
373
363
|
# @return [String]
|
|
374
364
|
#
|
|
375
365
|
def build_dir
|
|
376
|
-
"#{Config.build_dir}/#{project.name}"
|
|
366
|
+
File.expand_path("#{Config.build_dir}/#{project.name}")
|
|
377
367
|
end
|
|
378
368
|
expose :build_dir
|
|
379
369
|
|
|
@@ -441,7 +431,7 @@ module Omnibus
|
|
|
441
431
|
expose :architecture
|
|
442
432
|
|
|
443
433
|
#
|
|
444
|
-
# Define a series of {Builder} DSL commands that are
|
|
434
|
+
# Define a series of {Builder} DSL commands that are executed to build the
|
|
445
435
|
# software.
|
|
446
436
|
#
|
|
447
437
|
# @see Builder
|
|
@@ -449,18 +439,43 @@ module Omnibus
|
|
|
449
439
|
# @param [Proc] block
|
|
450
440
|
# a block of build commands
|
|
451
441
|
#
|
|
452
|
-
# @return [
|
|
453
|
-
# the
|
|
454
|
-
#
|
|
455
|
-
# @todo Seems like this renders the setting of @builder in the initializer
|
|
456
|
-
# moot
|
|
442
|
+
# @return [Proc]
|
|
443
|
+
# the build block
|
|
457
444
|
#
|
|
458
445
|
def build(&block)
|
|
459
|
-
|
|
460
|
-
@builder
|
|
446
|
+
builder.evaluate(&block)
|
|
461
447
|
end
|
|
462
448
|
expose :build
|
|
463
449
|
|
|
450
|
+
#
|
|
451
|
+
# The path on disk to the downloaded asset. This method requires the
|
|
452
|
+
# presence of a +source_uri+.
|
|
453
|
+
#
|
|
454
|
+
# @todo This is really a property of the {NetFetcher} and should be
|
|
455
|
+
# implemented on that class.
|
|
456
|
+
#
|
|
457
|
+
def downloaded_file
|
|
458
|
+
@downloaded_file ||= begin
|
|
459
|
+
raise MissingSoftwareSourceURI.new(self) unless source_uri
|
|
460
|
+
|
|
461
|
+
filename = source_uri.path.split('/').last
|
|
462
|
+
"#{Config.cache_dir}/#{filename}"
|
|
463
|
+
end
|
|
464
|
+
end
|
|
465
|
+
expose :downloaded_file
|
|
466
|
+
|
|
467
|
+
#
|
|
468
|
+
# @deprecated Use {#downloaded_file} instead
|
|
469
|
+
#
|
|
470
|
+
def project_file
|
|
471
|
+
log.deprecated(log_key) do
|
|
472
|
+
"project_file (DSL). Please use `downloaded_file' instead."
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
downloaded_file
|
|
476
|
+
end
|
|
477
|
+
expose :project_file
|
|
478
|
+
|
|
464
479
|
#
|
|
465
480
|
# Add standard compiler flags to the environment hash to produce omnibus
|
|
466
481
|
# binaries (correct RPATH, etc).
|
|
@@ -510,6 +525,11 @@ module Omnibus
|
|
|
510
525
|
"LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc",
|
|
511
526
|
"CFLAGS" => "-I#{install_dir}/embedded/include",
|
|
512
527
|
}
|
|
528
|
+
when "freebsd"
|
|
529
|
+
{
|
|
530
|
+
"LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
|
|
531
|
+
"CFLAGS" => "-I#{install_dir}/embedded/include",
|
|
532
|
+
}
|
|
513
533
|
else
|
|
514
534
|
{
|
|
515
535
|
"LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
|
|
@@ -671,6 +691,15 @@ module Omnibus
|
|
|
671
691
|
# be the "public API" for a software.
|
|
672
692
|
# --------------------------------------------------
|
|
673
693
|
|
|
694
|
+
#
|
|
695
|
+
# The builder object for this software definition.
|
|
696
|
+
#
|
|
697
|
+
# @return [Builder]
|
|
698
|
+
#
|
|
699
|
+
def builder
|
|
700
|
+
@builder ||= Builder.new(self)
|
|
701
|
+
end
|
|
702
|
+
|
|
674
703
|
#
|
|
675
704
|
# Fetch the software definition using the appropriate fetcher. This may
|
|
676
705
|
# fetch the software from a local path location, git location, or download
|
|
@@ -801,14 +830,6 @@ module Omnibus
|
|
|
801
830
|
source[:md5]
|
|
802
831
|
end
|
|
803
832
|
|
|
804
|
-
# @todo See comments for {#source_uri}... same applies here. If
|
|
805
|
-
# this is called in a non-source-software context, bad things will
|
|
806
|
-
# happen.
|
|
807
|
-
def project_file
|
|
808
|
-
filename = source_uri.path.split('/').last
|
|
809
|
-
"#{Config.cache_dir}/#{filename}"
|
|
810
|
-
end
|
|
811
|
-
|
|
812
833
|
# The fetcher for this software.
|
|
813
834
|
#
|
|
814
835
|
# @return [Fetcher]
|
|
@@ -870,11 +891,13 @@ module Omnibus
|
|
|
870
891
|
digest = Digest::SHA256.new
|
|
871
892
|
|
|
872
893
|
log.debug(log_key) { "project (SHA): #{project.shasum.inspect}" }
|
|
894
|
+
log.debug(log_key) { "builder (SHA): #{builder.shasum.inspect}" }
|
|
873
895
|
log.debug(log_key) { "name: #{name.inspect}" }
|
|
874
896
|
log.debug(log_key) { "version_for_cache: #{version_for_cache.inspect}" }
|
|
875
897
|
log.debug(log_key) { "overrides: #{overrides.inspect}" }
|
|
876
898
|
|
|
877
899
|
update_with_string(digest, project.shasum)
|
|
900
|
+
update_with_string(digest, builder.shasum)
|
|
878
901
|
update_with_string(digest, name)
|
|
879
902
|
update_with_string(digest, version_for_cache)
|
|
880
903
|
update_with_string(digest, JSON.fast_generate(overrides))
|
|
@@ -955,7 +978,7 @@ module Omnibus
|
|
|
955
978
|
|
|
956
979
|
def execute_build(fetcher)
|
|
957
980
|
fetcher.clean
|
|
958
|
-
|
|
981
|
+
builder.build
|
|
959
982
|
|
|
960
983
|
if Config.use_git_caching
|
|
961
984
|
log.info(log_key) { 'Caching build' }
|