omnibus 1.2.0 → 1.3.0
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.
- data/CHANGELOG.md +68 -0
- data/README.md +2 -0
- data/lib/omnibus.rb +12 -3
- data/lib/omnibus/builder.rb +32 -1
- data/lib/omnibus/cli/application.rb +1 -1
- data/lib/omnibus/config.rb +7 -0
- data/lib/omnibus/exceptions.rb +15 -0
- data/lib/omnibus/fetchers/git_fetcher.rb +1 -1
- data/lib/omnibus/fetchers/net_fetcher.rb +33 -1
- data/lib/omnibus/health_check.rb +2 -1
- data/lib/omnibus/project.rb +120 -8
- data/lib/omnibus/software.rb +1 -1
- data/lib/omnibus/templates/Gemfile.erb +1 -1
- data/lib/omnibus/templates/Vagrantfile.erb +27 -47
- data/lib/omnibus/templates/omnibus.rb.example.erb +1 -0
- data/lib/omnibus/templates/package_scripts/preinst.erb +7 -0
- data/lib/omnibus/templates/package_scripts/prerm.erb +15 -0
- data/lib/omnibus/templates/software/c-example.rb.erb +1 -1
- data/lib/omnibus/version.rb +1 -1
- data/omnibus.gemspec +3 -3
- data/spec/build_version_spec.rb +9 -9
- data/spec/fetchers/git_fetcher_spec.rb +93 -0
- data/spec/fetchers/net_fetcher_spec.rb +110 -1
- data/spec/package_release_spec.rb +2 -2
- data/spec/s3_cacher_spec.rb +6 -6
- data/spec/software_dirs_spec.rb +34 -0
- data/spec/software_spec.rb +2 -2
- metadata +15 -9
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,39 @@
|
|
1
|
+
## 1.3.0 (December 6, 2013)
|
2
|
+
|
3
|
+
FEATURES:
|
4
|
+
|
5
|
+
* Add `build_retries` global config value (still 3 by default). ([@fujin][], [#63][])
|
6
|
+
* Add support for pre-install scripts. ([@christophermaier][])
|
7
|
+
* Add support for `*.tar.xz` files. ([@jf647][], [#71][])
|
8
|
+
* Add `erb` builder command. ([@ohlol][], [#79][])
|
9
|
+
* Add `package_user`, `package_group` to project definitions for setting
|
10
|
+
user and group ownership for of deb/rpm/solaris packages. ([@ohlol][], [#80][])
|
11
|
+
* Add `config_file` to project definitions for passing `--config-files`
|
12
|
+
options to the `fpm` builder commands. ([@christophergeers][], [#85][])
|
13
|
+
|
14
|
+
IMPROVEMENTS:
|
15
|
+
|
16
|
+
* Bump default cpus to get better throughput when Ohai is wrong. ([@lamont-granquist][])
|
17
|
+
* Whitelist `libnsl` on Arch Linux. ([@sl4mmy][], [#67][])
|
18
|
+
* Switch to using pkgmk for Solaris. ([@lamont-granquist][], [#72][])
|
19
|
+
* Remove make install from c-example. ([@johntdyer][], [#73][])
|
20
|
+
* Update Vagrantfile template to use provisionerless base boxes. ([@schisamo][], [#74][])
|
21
|
+
* Allow access to `Omnibus.project_root` in builder blocks. ([@ohlol][], [#78][])
|
22
|
+
* Refactor how we handle loading dirs for software files. ([@benjaminws][], [#82][])
|
23
|
+
* Update depdencies: ([@schisamo][], [#86][])
|
24
|
+
* fpm 1.0.0
|
25
|
+
* mixlib-config 2.1.0
|
26
|
+
* mixlib-shellout 1.3.0
|
27
|
+
|
28
|
+
BUG FIXES:
|
29
|
+
|
30
|
+
* Properly handle `HTTP_PROXY_USER` and `HTTP_PROXY_PASS`. ([@databus23][], [#77][])
|
31
|
+
* Fix the incorrect error message logged when the Git fetcher failed to
|
32
|
+
resolve refs to commits. ([@mumoshu][], [#81][])
|
33
|
+
* Removin unsupported `config.ssh.max_tries` and `config.ssh.timeout`
|
34
|
+
from Vagrantfile template. ([@totally][], [#83][])
|
35
|
+
* Mention the required Vagrant plugins. ([@jacobvosmaer][], [#70][])
|
36
|
+
|
1
37
|
## 1.2.0 (July 12, 2013)
|
2
38
|
|
3
39
|
FEATURES:
|
@@ -94,3 +130,35 @@ BUG FIXES:
|
|
94
130
|
## 1.0.0 (April 21, 2013)
|
95
131
|
|
96
132
|
* The initial release.
|
133
|
+
|
134
|
+
<!--- The following link definition list is generated by PimpMyChangelog --->
|
135
|
+
[#63]: https://github.com/opscode/omnibus-ruby/issues/63
|
136
|
+
[#67]: https://github.com/opscode/omnibus-ruby/issues/67
|
137
|
+
[#70]: https://github.com/opscode/omnibus-ruby/issues/70
|
138
|
+
[#71]: https://github.com/opscode/omnibus-ruby/issues/71
|
139
|
+
[#72]: https://github.com/opscode/omnibus-ruby/issues/72
|
140
|
+
[#73]: https://github.com/opscode/omnibus-ruby/issues/73
|
141
|
+
[#74]: https://github.com/opscode/omnibus-ruby/issues/74
|
142
|
+
[#77]: https://github.com/opscode/omnibus-ruby/issues/77
|
143
|
+
[#78]: https://github.com/opscode/omnibus-ruby/issues/78
|
144
|
+
[#79]: https://github.com/opscode/omnibus-ruby/issues/79
|
145
|
+
[#80]: https://github.com/opscode/omnibus-ruby/issues/80
|
146
|
+
[#81]: https://github.com/opscode/omnibus-ruby/issues/81
|
147
|
+
[#82]: https://github.com/opscode/omnibus-ruby/issues/82
|
148
|
+
[#83]: https://github.com/opscode/omnibus-ruby/issues/83
|
149
|
+
[#85]: https://github.com/opscode/omnibus-ruby/issues/85
|
150
|
+
[#86]: https://github.com/opscode/omnibus-ruby/issues/86
|
151
|
+
[@benjaminws]: https://github.com/benjaminws
|
152
|
+
[@christophergeers]: https://github.com/christophergeers
|
153
|
+
[@christophermaier]: https://github.com/christophermaier
|
154
|
+
[@databus23]: https://github.com/databus23
|
155
|
+
[@fujin]: https://github.com/fujin
|
156
|
+
[@jacobvosmaer]: https://github.com/jacobvosmaer
|
157
|
+
[@jf647]: https://github.com/jf647
|
158
|
+
[@johntdyer]: https://github.com/johntdyer
|
159
|
+
[@lamont-granquist]: https://github.com/lamont-granquist
|
160
|
+
[@mumoshu]: https://github.com/mumoshu
|
161
|
+
[@ohlol]: https://github.com/ohlol
|
162
|
+
[@schisamo]: https://github.com/schisamo
|
163
|
+
[@sl4mmy]: https://github.com/sl4mmy
|
164
|
+
[@totally]: https://github.com/totally
|
data/README.md
CHANGED
@@ -23,6 +23,8 @@ need the following:
|
|
23
23
|
Though not *strictly* necessary, Vagrant makes using Omnibus easier,
|
24
24
|
and is highly recommended.
|
25
25
|
- Vagrant 1.2.1 or later (http://www.vagrantup.com)
|
26
|
+
- the vagrant-berkshelf plugin (https://github.com/RiotGames/vagrant-berkshelf)
|
27
|
+
- the vagrant-omnibus plugin (https://github.com/schisamo/vagrant-omnibus)
|
26
28
|
|
27
29
|
## Get Started
|
28
30
|
|
data/lib/omnibus.rb
CHANGED
@@ -154,6 +154,17 @@ module Omnibus
|
|
154
154
|
ruby_files(File.join(project_root, Config.software_dir))
|
155
155
|
end
|
156
156
|
|
157
|
+
# Return directories to search for {Omnibus::Software} DSL files.
|
158
|
+
#
|
159
|
+
# @return [Array<String>]
|
160
|
+
def self.software_dirs
|
161
|
+
@software_dirs ||= begin
|
162
|
+
software_dirs = [File.join(project_root, Config.software_dir)]
|
163
|
+
software_dirs << File.join(omnibus_software_root, 'config', 'software') if omnibus_software_root
|
164
|
+
software_dirs
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
157
168
|
# Backward compat alias
|
158
169
|
#
|
159
170
|
# @todo print a deprecation message
|
@@ -288,9 +299,7 @@ module Omnibus
|
|
288
299
|
dep_file = software_map[dependency_name]
|
289
300
|
|
290
301
|
unless dep_file
|
291
|
-
raise MissingProjectDependency.new(dependency_name,
|
292
|
-
[File.join(project_root, Config.software_dir),
|
293
|
-
File.join(omnibus_software_root, 'config', 'software')])
|
302
|
+
raise MissingProjectDependency.new(dependency_name, software_dirs)
|
294
303
|
end
|
295
304
|
|
296
305
|
dep_software = Omnibus::Software.load(dep_file, project, overrides)
|
data/lib/omnibus/builder.rb
CHANGED
@@ -17,6 +17,7 @@
|
|
17
17
|
|
18
18
|
require 'forwardable'
|
19
19
|
require 'omnibus/exceptions'
|
20
|
+
require 'ostruct'
|
20
21
|
|
21
22
|
module Omnibus
|
22
23
|
class Builder
|
@@ -31,6 +32,7 @@ module Omnibus
|
|
31
32
|
# @todo def_delegators :@builder, :patch, :command, :ruby, ...
|
32
33
|
|
33
34
|
def_delegator :@builder, :patch
|
35
|
+
def_delegator :@builder, :erb
|
34
36
|
def_delegator :@builder, :command
|
35
37
|
def_delegator :@builder, :ruby
|
36
38
|
def_delegator :@builder, :gem
|
@@ -38,6 +40,7 @@ module Omnibus
|
|
38
40
|
def_delegator :@builder, :rake
|
39
41
|
def_delegator :@builder, :block
|
40
42
|
def_delegator :@builder, :name
|
43
|
+
def_delegator :@builder, :project_root
|
41
44
|
|
42
45
|
def initialize(builder, software)
|
43
46
|
@builder, @software = builder, software
|
@@ -149,6 +152,25 @@ module Omnibus
|
|
149
152
|
end
|
150
153
|
end
|
151
154
|
|
155
|
+
def erb(*args)
|
156
|
+
args = args.dup.pop
|
157
|
+
|
158
|
+
source_path = File.expand_path("#{Omnibus.project_root}/config/templates/#{name}/#{args[:source]}")
|
159
|
+
|
160
|
+
unless File.exists?(source_path)
|
161
|
+
raise MissingTemplate.new(args[:source], "#{Omnibus.project_root}/config/templates/#{name}")
|
162
|
+
end
|
163
|
+
|
164
|
+
block do
|
165
|
+
template = ERB.new(File.new(source_path).read, nil, "%")
|
166
|
+
File.open(args[:dest], "w") do |file|
|
167
|
+
file.write(template.result(OpenStruct.new(args[:vars]).instance_eval { binding }))
|
168
|
+
end
|
169
|
+
|
170
|
+
File.chmod(args[:mode], args[:dest])
|
171
|
+
end
|
172
|
+
end
|
173
|
+
|
152
174
|
# @todo all these ruby commands (ruby, gem, bundle, rake) could
|
153
175
|
# all be collapsed into a single underlying implementation, since
|
154
176
|
# they all just differ on the executable being called
|
@@ -172,6 +194,10 @@ module Omnibus
|
|
172
194
|
@build_commands << rb_block
|
173
195
|
end
|
174
196
|
|
197
|
+
def project_root
|
198
|
+
Omnibus.project_root
|
199
|
+
end
|
200
|
+
|
175
201
|
def project_dir
|
176
202
|
@software.project_dir
|
177
203
|
end
|
@@ -213,6 +239,10 @@ module Omnibus
|
|
213
239
|
raise
|
214
240
|
end
|
215
241
|
|
242
|
+
def build_retries
|
243
|
+
Omnibus.config[:build_retries]
|
244
|
+
end
|
245
|
+
|
216
246
|
def execute_sh(cmd)
|
217
247
|
retries ||= 0
|
218
248
|
shell = nil
|
@@ -243,10 +273,11 @@ module Omnibus
|
|
243
273
|
shell.error!
|
244
274
|
end
|
245
275
|
rescue Exception => e
|
276
|
+
raise if build_retries.nil? || build_retries == 0
|
246
277
|
# Getting lots of errors from github, particularly with erlang/rebar
|
247
278
|
# projects fetching tons of deps via git all the time. This isn't a
|
248
279
|
# particularly elegant way to solve that problem. But it should work.
|
249
|
-
if retries >=
|
280
|
+
if retries >= build_retries
|
250
281
|
ErrorReporter.new(e, self).explain("Failed to build #{name} while running `#{cmd_string}` with #{cmd_opts_for_display}")
|
251
282
|
raise
|
252
283
|
else
|
@@ -85,7 +85,7 @@ module Omnibus
|
|
85
85
|
template(File.join("Vagrantfile.erb"), File.join(target, "Vagrantfile"), opts)
|
86
86
|
|
87
87
|
# render out stub packge scripts
|
88
|
-
%w{ makeselfinst postinst postrm }.each do |package_script|
|
88
|
+
%w{ makeselfinst preinst prerm postinst postrm }.each do |package_script|
|
89
89
|
script_path = File.join(target, "package-scripts", name, package_script)
|
90
90
|
template_path = File.join("package_scripts", "#{package_script}.erb")
|
91
91
|
# render the package script
|
data/lib/omnibus/config.rb
CHANGED
@@ -197,6 +197,13 @@ module Omnibus
|
|
197
197
|
|
198
198
|
# # @!endgroup
|
199
199
|
|
200
|
+
# @!group Build Control Parameters
|
201
|
+
|
202
|
+
# @! attribute [rw] build_retries
|
203
|
+
#
|
204
|
+
# @return [Integer, nil]
|
205
|
+
build_retries 3
|
206
|
+
|
200
207
|
# @!group Validation Methods
|
201
208
|
|
202
209
|
# Asserts that the Config object is in a valid state. If invalid
|
data/lib/omnibus/exceptions.rb
CHANGED
@@ -126,6 +126,21 @@ module Omnibus
|
|
126
126
|
end
|
127
127
|
end
|
128
128
|
|
129
|
+
class MissingTemplate < RuntimeError
|
130
|
+
def initialize(template_name, search_paths)
|
131
|
+
@template_name, @search_paths = template_name, search_paths
|
132
|
+
end
|
133
|
+
|
134
|
+
def to_s
|
135
|
+
"""
|
136
|
+
Attempting to evaluate the template #{@template_name}, but it was not
|
137
|
+
found at any of the following locations:
|
138
|
+
|
139
|
+
#{@search_paths.join("\n ")}
|
140
|
+
"""
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
129
144
|
class MissingProjectDependency < RuntimeError
|
130
145
|
def initialize(dep_name, search_paths)
|
131
146
|
@dep_name, @search_paths = dep_name, search_paths
|
@@ -164,7 +164,7 @@ E
|
|
164
164
|
commit_ref
|
165
165
|
rescue Exception => e
|
166
166
|
if retries >= 3
|
167
|
-
ErrorReporter.new(e, self).explain("Failed to
|
167
|
+
ErrorReporter.new(e, self).explain("Failed to find any commits for the ref '#{ref}'")
|
168
168
|
raise
|
169
169
|
else
|
170
170
|
# Deal with github failing all the time :(
|
@@ -88,7 +88,12 @@ E
|
|
88
88
|
end
|
89
89
|
|
90
90
|
req = Net::HTTP::Get.new(url.request_uri, headers)
|
91
|
-
|
91
|
+
|
92
|
+
http_client = if http_proxy && !excluded_from_proxy?(url.host)
|
93
|
+
Net::HTTP::Proxy(http_proxy.host, http_proxy.port, http_proxy.user, http_proxy.password).new(url.host, url.port)
|
94
|
+
else
|
95
|
+
Net::HTTP.new(url.host, url.port)
|
96
|
+
end
|
92
97
|
http_client.use_ssl = (url.scheme == "https")
|
93
98
|
|
94
99
|
response = http_client.start { |http| http.request(req) }
|
@@ -104,6 +109,31 @@ E
|
|
104
109
|
end
|
105
110
|
end
|
106
111
|
|
112
|
+
# search environment variable as given, all lowercase and all upper case
|
113
|
+
def get_env(name)
|
114
|
+
ENV[name] || ENV[name.downcase] || ENV[name.upcase] || nil
|
115
|
+
end
|
116
|
+
|
117
|
+
# constructs a http_proxy uri from HTTP_PROXY* env vars
|
118
|
+
def http_proxy
|
119
|
+
@http_proxy ||= begin
|
120
|
+
proxy = get_env('HTTP_PROXY') or return
|
121
|
+
proxy = "http://#{proxy}" unless proxy =~ /^https?:/
|
122
|
+
uri = URI.parse(proxy)
|
123
|
+
uri.user ||= get_env('HTTP_PROXY_USER')
|
124
|
+
uri.password ||= get_env('HTTP_PROXY_PASS')
|
125
|
+
uri
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
# return true if the host is excluded from proxying via the no_proxy directive.
|
130
|
+
# the 'no_proxy' variable contains a list of host suffixes separated by comma
|
131
|
+
# example: example.com,www.examle.org,localhost
|
132
|
+
def excluded_from_proxy?(host)
|
133
|
+
no_proxy = get_env('no_proxy') || ""
|
134
|
+
no_proxy.split(/\s*,\s*/).any? { |pattern| host.end_with? pattern }
|
135
|
+
end
|
136
|
+
|
107
137
|
def download
|
108
138
|
tries = 5
|
109
139
|
begin
|
@@ -179,6 +209,8 @@ E
|
|
179
209
|
"7z.exe x #{project_file} -o#{source_dir} -r -y"
|
180
210
|
elsif project_file.end_with?(".zip")
|
181
211
|
"unzip #{project_file} -d #{source_dir}"
|
212
|
+
elsif project_file.end_with?(".xz") || project_file.end_with?(".txz")
|
213
|
+
"xz -dc #{project_file} | ( cd #{source_dir} && tar -xf - )"
|
182
214
|
else
|
183
215
|
#if we don't recognize the extension, simply copy over the file
|
184
216
|
Proc.new do
|
data/lib/omnibus/health_check.rb
CHANGED
@@ -44,6 +44,7 @@ module Omnibus
|
|
44
44
|
/libffi\.so/,
|
45
45
|
/libgdbm\.so/,
|
46
46
|
/libm\.so/,
|
47
|
+
/libnsl\.so/,
|
47
48
|
/libpthread\.so/,
|
48
49
|
/librt\.so/,
|
49
50
|
/libutil\.so/
|
@@ -188,7 +189,7 @@ module Omnibus
|
|
188
189
|
log " PROVIDED BY: #{location}"
|
189
190
|
log " FAILED BECAUSE: #{reason}"
|
190
191
|
end
|
191
|
-
|
192
|
+
raise "Health Check Failed"
|
192
193
|
end
|
193
194
|
end
|
194
195
|
|
data/lib/omnibus/project.rb
CHANGED
@@ -18,6 +18,7 @@ require 'omnibus/artifact'
|
|
18
18
|
require 'omnibus/exceptions'
|
19
19
|
require 'omnibus/library'
|
20
20
|
require 'omnibus/util'
|
21
|
+
require 'time'
|
21
22
|
|
22
23
|
module Omnibus
|
23
24
|
|
@@ -65,6 +66,7 @@ module Omnibus
|
|
65
66
|
|
66
67
|
@exclusions = Array.new
|
67
68
|
@conflicts = Array.new
|
69
|
+
@config_files = Array.new
|
68
70
|
@dependencies = Array.new
|
69
71
|
@runtime_dependencies = Array.new
|
70
72
|
instance_eval(io)
|
@@ -240,6 +242,24 @@ module Omnibus
|
|
240
242
|
@build_iteration || 1
|
241
243
|
end
|
242
244
|
|
245
|
+
# Set or retrieve the {deb/rpm/solaris}-user fpm argument.
|
246
|
+
#
|
247
|
+
# @param val [String]
|
248
|
+
# @return [String]
|
249
|
+
def package_user(val=NULL_ARG)
|
250
|
+
@pkg_user = val unless val.equal?(NULL_ARG)
|
251
|
+
@pkg_user
|
252
|
+
end
|
253
|
+
|
254
|
+
# Set or retrieve the {deb/rpm/solaris}-group fpm argument.
|
255
|
+
#
|
256
|
+
# @param val [String]
|
257
|
+
# @return [String]
|
258
|
+
def package_group(val=NULL_ARG)
|
259
|
+
@pkg_group = val unless val.equal?(NULL_ARG)
|
260
|
+
@pkg_group
|
261
|
+
end
|
262
|
+
|
243
263
|
# Add an Omnibus software dependency.
|
244
264
|
#
|
245
265
|
# Note that this is a *build time* dependency. If you need to
|
@@ -295,6 +315,14 @@ module Omnibus
|
|
295
315
|
@exclusions << pattern
|
296
316
|
end
|
297
317
|
|
318
|
+
# Add a config file.
|
319
|
+
#
|
320
|
+
# @param val [String] the name of a config file of your software
|
321
|
+
# @return [void]
|
322
|
+
def config_file(val)
|
323
|
+
@config_files << val
|
324
|
+
end
|
325
|
+
|
298
326
|
# Returns the platform version of the machine on which Omnibus is
|
299
327
|
# running, as determined by Ohai.
|
300
328
|
#
|
@@ -381,7 +409,7 @@ module Omnibus
|
|
381
409
|
when 'aix'
|
382
410
|
[ "bff" ]
|
383
411
|
when 'solaris2'
|
384
|
-
[ "
|
412
|
+
[ "pkgmk" ]
|
385
413
|
when 'windows'
|
386
414
|
[ "msi" ]
|
387
415
|
else
|
@@ -461,6 +489,8 @@ module Omnibus
|
|
461
489
|
"#{package_name}-#{build_version}-#{iteration}.msi"
|
462
490
|
when "bff"
|
463
491
|
"#{package_name}.#{bff_version}.bff"
|
492
|
+
when "pkgmk"
|
493
|
+
"#{package_name}-#{build_version}-#{iteration}.solaris"
|
464
494
|
else # fpm
|
465
495
|
require "fpm/package/#{pkg_type}"
|
466
496
|
pkg = FPM::Package.types[pkg_type].new
|
@@ -503,10 +533,11 @@ module Omnibus
|
|
503
533
|
end
|
504
534
|
|
505
535
|
def bff_command
|
506
|
-
bff_command = ["mkinstallp -d / -T /tmp/bff/gen.template"]
|
536
|
+
bff_command = ["sudo /usr/sbin/mkinstallp -d / -T /tmp/bff/gen.template"]
|
507
537
|
[bff_command.join(" "), {:returns => [0]}]
|
508
538
|
end
|
509
539
|
|
540
|
+
|
510
541
|
# The {https://github.com/jordansissel/fpm fpm} command to
|
511
542
|
# generate a package for RedHat, Ubuntu, Solaris, etc. platforms.
|
512
543
|
#
|
@@ -532,21 +563,29 @@ module Omnibus
|
|
532
563
|
"-m '#{maintainer}'",
|
533
564
|
"--description '#{description}'",
|
534
565
|
"--url #{homepage}"]
|
566
|
+
if File.exist?(File.join(package_scripts_path, "preinst"))
|
567
|
+
command_and_opts << "--before-install '#{File.join(package_scripts_path, "preinst")}'"
|
568
|
+
end
|
569
|
+
|
535
570
|
if File.exist?("#{package_scripts_path}/postinst")
|
536
|
-
command_and_opts << "--
|
571
|
+
command_and_opts << "--after-install '#{File.join(package_scripts_path, "postinst")}'"
|
537
572
|
end
|
538
573
|
# solaris packages don't support --pre-uninstall
|
539
|
-
if File.exist?("#{package_scripts_path}/prerm")
|
540
|
-
command_and_opts << "--
|
574
|
+
if File.exist?("#{package_scripts_path}/prerm")
|
575
|
+
command_and_opts << "--before-remove '#{File.join(package_scripts_path, "prerm")}'"
|
541
576
|
end
|
542
577
|
# solaris packages don't support --post-uninstall
|
543
|
-
if File.exist?("#{package_scripts_path}/postrm")
|
544
|
-
command_and_opts << "--
|
578
|
+
if File.exist?("#{package_scripts_path}/postrm")
|
579
|
+
command_and_opts << "--after-remove '#{File.join(package_scripts_path, "postrm")}'"
|
545
580
|
end
|
546
581
|
|
547
582
|
@exclusions.each do |pattern|
|
548
583
|
command_and_opts << "--exclude '#{pattern}'"
|
549
584
|
end
|
585
|
+
|
586
|
+
@config_files.each do |config_file|
|
587
|
+
command_and_opts << "--config-files '#{config_file}'"
|
588
|
+
end
|
550
589
|
|
551
590
|
@runtime_dependencies.each do |runtime_dep|
|
552
591
|
command_and_opts << "--depends '#{runtime_dep}'"
|
@@ -556,6 +595,18 @@ module Omnibus
|
|
556
595
|
command_and_opts << "--conflicts '#{conflict}'"
|
557
596
|
end
|
558
597
|
|
598
|
+
if @pkg_user
|
599
|
+
%w[ deb rpm solaris ].each do |type|
|
600
|
+
command_and_opts << " --#{type}-user #{@pkg_user}"
|
601
|
+
end
|
602
|
+
end
|
603
|
+
|
604
|
+
if @pkg_group
|
605
|
+
%w[ deb rpm solaris ].each do |type|
|
606
|
+
command_and_opts << " --#{type}-group #{@pkg_group}"
|
607
|
+
end
|
608
|
+
end
|
609
|
+
|
559
610
|
command_and_opts << " --replaces #{@replaces}" if @replaces
|
560
611
|
command_and_opts << install_path
|
561
612
|
command_and_opts
|
@@ -602,7 +653,7 @@ module Omnibus
|
|
602
653
|
end
|
603
654
|
|
604
655
|
def run_bff
|
605
|
-
FileUtils.rm_rf "/.info"
|
656
|
+
FileUtils.rm_rf "/.info/*"
|
606
657
|
FileUtils.rm_rf "/tmp/bff"
|
607
658
|
FileUtils.mkdir "/tmp/bff"
|
608
659
|
|
@@ -621,6 +672,65 @@ module Omnibus
|
|
621
672
|
FileUtils.cp "/tmp/chef.#{bff_version}.bff", "/var/cache/omnibus/pkg/chef.#{bff_version}.bff"
|
622
673
|
end
|
623
674
|
|
675
|
+
def pkgmk_version
|
676
|
+
"#{build_version}-#{iteration}"
|
677
|
+
end
|
678
|
+
|
679
|
+
def run_pkgmk
|
680
|
+
install_dirname = File.dirname(install_path)
|
681
|
+
install_basename = File.basename(install_path)
|
682
|
+
|
683
|
+
system "sudo rm -rf /tmp/pkgmk"
|
684
|
+
FileUtils.mkdir "/tmp/pkgmk"
|
685
|
+
|
686
|
+
system "cd #{install_dirname} && find #{install_basename} -print > /tmp/pkgmk/files"
|
687
|
+
|
688
|
+
prototype_content = <<-EOF
|
689
|
+
i pkginfo
|
690
|
+
i postinstall
|
691
|
+
i postremove
|
692
|
+
EOF
|
693
|
+
|
694
|
+
File.open "/tmp/pkgmk/Prototype", "w+" do |f|
|
695
|
+
f.write prototype_content
|
696
|
+
end
|
697
|
+
|
698
|
+
# generate the prototype's file list
|
699
|
+
system "cd #{install_dirname} && pkgproto < /tmp/pkgmk/files > /tmp/pkgmk/Prototype.files"
|
700
|
+
|
701
|
+
# fix up the user and group in the file list to root
|
702
|
+
system "awk '{ $5 = \"root\"; $6 = \"root\"; print }' < /tmp/pkgmk/Prototype.files >> /tmp/pkgmk/Prototype"
|
703
|
+
|
704
|
+
pkginfo_content = <<-EOF
|
705
|
+
CLASSES=none
|
706
|
+
TZ=PST
|
707
|
+
PATH=/sbin:/usr/sbin:/usr/bin:/usr/sadm/install/bin
|
708
|
+
BASEDIR=#{install_dirname}
|
709
|
+
PKG=#{package_name}
|
710
|
+
NAME=#{package_name}
|
711
|
+
ARCH=#{`uname -p`.chomp}
|
712
|
+
VERSION=#{pkgmk_version}
|
713
|
+
CATEGORY=application
|
714
|
+
DESC=#{description}
|
715
|
+
VENDOR=#{maintainer}
|
716
|
+
EMAIL=#{maintainer}
|
717
|
+
PSTAMP=#{`hostname`.chomp + Time.now.utc.iso8601}
|
718
|
+
EOF
|
719
|
+
|
720
|
+
File.open "/tmp/pkgmk/pkginfo", "w+" do |f|
|
721
|
+
f.write pkginfo_content
|
722
|
+
end
|
723
|
+
|
724
|
+
FileUtils.cp "#{package_scripts_path}/postinst", "/tmp/pkgmk/postinstall"
|
725
|
+
FileUtils.cp "#{package_scripts_path}/postrm", "/tmp/pkgmk/postremove"
|
726
|
+
|
727
|
+
shellout!("pkgmk -o -r #{install_dirname} -d /tmp/pkgmk -f /tmp/pkgmk/Prototype", :timeout => 3600)
|
728
|
+
|
729
|
+
system "pkgchk -vd /tmp/pkgmk chef"
|
730
|
+
|
731
|
+
system "pkgtrans /tmp/pkgmk /var/cache/omnibus/pkg/#{output_package("pkgmk")} chef"
|
732
|
+
end
|
733
|
+
|
624
734
|
# Runs the necessary command to make a package with fpm. As a side-effect,
|
625
735
|
# sets `output_package`
|
626
736
|
# @return void
|
@@ -672,6 +782,8 @@ module Omnibus
|
|
672
782
|
run_msi
|
673
783
|
elsif pkg_type == "bff"
|
674
784
|
run_bff
|
785
|
+
elsif pkg_type == "pkgmk"
|
786
|
+
run_pkgmk
|
675
787
|
else # pkg_type == "fpm"
|
676
788
|
run_fpm(pkg_type)
|
677
789
|
end
|
data/lib/omnibus/software.rb
CHANGED
@@ -1,72 +1,52 @@
|
|
1
1
|
# -*- mode: ruby -*-
|
2
2
|
# vi: set ft=ruby :
|
3
3
|
|
4
|
-
require
|
4
|
+
require 'vagrant'
|
5
5
|
|
6
|
-
if Vagrant::VERSION <
|
7
|
-
raise
|
6
|
+
if Vagrant::VERSION < '1.2.1'
|
7
|
+
raise 'The Omnibus Build Lab is only compatible with Vagrant 1.2.1+'
|
8
8
|
end
|
9
9
|
|
10
|
-
host_project_path = File.expand_path(
|
10
|
+
host_project_path = File.expand_path('..', __FILE__)
|
11
11
|
guest_project_path = "/home/vagrant/#{File.basename(host_project_path)}"
|
12
|
-
project_name =
|
12
|
+
project_name = '<%= config[:name] %>'
|
13
13
|
|
14
|
-
Vagrant.configure(
|
14
|
+
Vagrant.configure('2') do |config|
|
15
15
|
|
16
16
|
config.vm.hostname = "#{project_name}-omnibus-build-lab"
|
17
17
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
c.berkshelf.berksfile_path = "./Berksfile"
|
26
|
-
c.vm.box = "opscode-ubuntu-11.04"
|
27
|
-
c.vm.box_url = "http://opscode-vm.s3.amazonaws.com/vagrant/boxes/opscode-ubuntu-11.04.box"
|
28
|
-
end
|
18
|
+
%w{
|
19
|
+
ubuntu-10.04
|
20
|
+
ubuntu-11.04
|
21
|
+
ubuntu-12.04
|
22
|
+
centos-5.10
|
23
|
+
centos-6.5
|
24
|
+
}.each do |platform|
|
29
25
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
end
|
26
|
+
config.vm.define platform do |c|
|
27
|
+
c.vm.box = "opscode-#{platform}"
|
28
|
+
c.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_#{platform}_chef-provisionerless.box"
|
29
|
+
end
|
35
30
|
|
36
|
-
config.vm.define 'centos-5' do |c|
|
37
|
-
c.berkshelf.berksfile_path = "./Berksfile"
|
38
|
-
c.vm.box = "opscode-centos-5.8"
|
39
|
-
c.vm.box_url = "http://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-5.8_chef-11.2.0.box"
|
40
|
-
end
|
41
|
-
|
42
|
-
config.vm.define 'centos-6' do |c|
|
43
|
-
c.berkshelf.berksfile_path = "./Berksfile"
|
44
|
-
c.vm.box = "opscode-centos-6.3"
|
45
|
-
c.vm.box_url = "http://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.3_chef-11.2.0.box"
|
46
31
|
end
|
47
32
|
|
48
33
|
config.vm.provider :virtualbox do |vb|
|
49
34
|
# Give enough horsepower to build without taking all day.
|
50
35
|
vb.customize [
|
51
|
-
|
52
|
-
|
53
|
-
|
36
|
+
'modifyvm', :id,
|
37
|
+
'--memory', '1536',
|
38
|
+
'--cpus', '2'
|
54
39
|
]
|
55
40
|
end
|
56
41
|
|
57
42
|
# Ensure a recent version of the Chef Omnibus packages are installed
|
58
|
-
config.omnibus.chef_version =
|
43
|
+
config.omnibus.chef_version = '11.6.2'
|
59
44
|
|
60
45
|
# Enable the berkshelf-vagrant plugin
|
61
46
|
config.berkshelf.enabled = true
|
62
|
-
# The path to the Berksfile to use with Vagrant Berkshelf
|
63
|
-
config.berkshelf.berksfile_path = "./Berksfile"
|
64
|
-
|
65
|
-
config.ssh.max_tries = 40
|
66
|
-
config.ssh.timeout = 120
|
67
47
|
config.ssh.forward_agent = true
|
68
48
|
|
69
|
-
host_project_path = File.expand_path(
|
49
|
+
host_project_path = File.expand_path('..', __FILE__)
|
70
50
|
guest_project_path = "/home/vagrant/#{File.basename(host_project_path)}"
|
71
51
|
|
72
52
|
config.vm.synced_folder host_project_path, guest_project_path
|
@@ -74,15 +54,15 @@ Vagrant.configure("2") do |config|
|
|
74
54
|
# prepare VM to be an Omnibus builder
|
75
55
|
config.vm.provision :chef_solo do |chef|
|
76
56
|
chef.json = {
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
57
|
+
'omnibus' => {
|
58
|
+
'build_user' => 'vagrant',
|
59
|
+
'build_dir' => guest_project_path,
|
60
|
+
'install_dir' => "/opt/#{project_name}"
|
81
61
|
}
|
82
62
|
}
|
83
63
|
|
84
64
|
chef.run_list = [
|
85
|
-
|
65
|
+
'recipe[omnibus::default]'
|
86
66
|
]
|
87
67
|
end
|
88
68
|
|
data/lib/omnibus/version.rb
CHANGED
data/omnibus.gemspec
CHANGED
@@ -21,11 +21,11 @@ Gem::Specification.new do |gem|
|
|
21
21
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
22
22
|
gem.require_paths = ["lib"]
|
23
23
|
|
24
|
-
gem.add_dependency "mixlib-shellout", "~> 1.0"
|
25
|
-
gem.add_dependency "mixlib-config", "~>
|
24
|
+
gem.add_dependency "mixlib-shellout", "~> 1.3.0"
|
25
|
+
gem.add_dependency "mixlib-config", "~> 2.1.0"
|
26
26
|
gem.add_dependency "ohai", ">= 0.6.12"
|
27
27
|
gem.add_dependency "rake", ">= 0.9"
|
28
|
-
gem.add_dependency "fpm", "~> 0.
|
28
|
+
gem.add_dependency "fpm", "~> 1.0.0"
|
29
29
|
gem.add_dependency "uber-s3"
|
30
30
|
gem.add_dependency "thor", ">= 0.16.0"
|
31
31
|
|
data/spec/build_version_spec.rb
CHANGED
@@ -30,9 +30,9 @@ describe Omnibus::BuildVersion do
|
|
30
30
|
ENV['BUILD_ID'] = nil
|
31
31
|
ENV['OMNIBUS_APPEND_TIMESTAMP'] = nil
|
32
32
|
Omnibus::BuildVersion.any_instance.stub(:shellout)
|
33
|
-
.and_return(
|
34
|
-
|
35
|
-
|
33
|
+
.and_return(double("ouput",
|
34
|
+
:stdout => git_describe,
|
35
|
+
:exitstatus => 0))
|
36
36
|
end
|
37
37
|
|
38
38
|
describe "git describe parsing" do
|
@@ -239,9 +239,9 @@ fatal: No tags can describe '809ea1afcce67e1148c1bf0822d40a7ef12c380e'.
|
|
239
239
|
Try --always, or create some tags.
|
240
240
|
STDERR
|
241
241
|
build_version.stub(:shellout)
|
242
|
-
.and_return(
|
243
|
-
|
244
|
-
|
242
|
+
.and_return(double("ouput",
|
243
|
+
:stderr => stderr,
|
244
|
+
:exitstatus => 128))
|
245
245
|
end
|
246
246
|
it "sets the version to 0.0.0" do
|
247
247
|
build_version.git_describe.should eq("0.0.0")
|
@@ -257,9 +257,9 @@ Try --always, or create some tags.
|
|
257
257
|
.with("git describe",
|
258
258
|
{:live_stream => nil,
|
259
259
|
:cwd => path})
|
260
|
-
.and_return(
|
261
|
-
|
262
|
-
|
260
|
+
.and_return(double("ouput",
|
261
|
+
:stdout => git_describe,
|
262
|
+
:exitstatus => 0))
|
263
263
|
build_version.git_describe
|
264
264
|
end
|
265
265
|
end
|
@@ -0,0 +1,93 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Omnibus::GitFetcher do
|
4
|
+
let(:shell_out) {
|
5
|
+
shell_out = double('Mixlib::ShellOut')
|
6
|
+
stub_const('Mixlib::ShellOut', shell_out)
|
7
|
+
shell_out
|
8
|
+
}
|
9
|
+
let(:software) {
|
10
|
+
double('software').tap { |s|
|
11
|
+
s.stub :name => 'project',
|
12
|
+
:source => { :git => 'git@example.com:test/project.git' },
|
13
|
+
:version => '0.0.1',
|
14
|
+
:project_dir => '/tmp/project'
|
15
|
+
}
|
16
|
+
}
|
17
|
+
def expect_git_clone_and_ls_remote
|
18
|
+
expect_git_clone
|
19
|
+
expect_git_ls_remote
|
20
|
+
end
|
21
|
+
def expect_git_clone
|
22
|
+
double('git_clone').tap do |g|
|
23
|
+
shell_out.should_receive(:new)
|
24
|
+
.with('git clone git@example.com:test/project.git /tmp/project', :live_stream => STDOUT)
|
25
|
+
.ordered
|
26
|
+
.and_return(g)
|
27
|
+
g.should_receive(:run_command).ordered
|
28
|
+
g.should_receive(:error!).ordered
|
29
|
+
end
|
30
|
+
end
|
31
|
+
def expect_git_ls_remote
|
32
|
+
double('git_ls_remote').tap do |g|
|
33
|
+
shell_out.should_receive(:new)
|
34
|
+
.with('git ls-remote origin 0.0.1*', :live_stream => STDOUT, :cwd => '/tmp/project')
|
35
|
+
.ordered
|
36
|
+
.and_return(g)
|
37
|
+
g.should_receive(:run_command).ordered
|
38
|
+
g.should_receive(:error!).ordered
|
39
|
+
g.stub(:stdout => git_ls_remote_out)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
describe "#fetch" do
|
43
|
+
context "when the project is not cloned yet" do
|
44
|
+
before {
|
45
|
+
File.stub(:exist?).with('/tmp/project/.git').and_return(false)
|
46
|
+
}
|
47
|
+
context "when the source repository is accessible" do
|
48
|
+
subject {
|
49
|
+
Omnibus::GitFetcher.new software
|
50
|
+
}
|
51
|
+
context "when the ref exists" do
|
52
|
+
let(:git_ls_remote_out) {
|
53
|
+
'a2ed66c01f42514bcab77fd628149eccb4ecee28 refs/tags/0.0.1'
|
54
|
+
}
|
55
|
+
it 'should clone the Git repository and then check out the commit' do
|
56
|
+
1.times { expect_git_clone_and_ls_remote }
|
57
|
+
double('git_checkout').tap do |g|
|
58
|
+
shell_out.should_receive(:new)
|
59
|
+
.with('git checkout a2ed66c01f42514bcab77fd628149eccb4ecee28', :live_stream => STDOUT, :cwd => '/tmp/project')
|
60
|
+
.ordered
|
61
|
+
.and_return(g)
|
62
|
+
g.should_receive(:run_command).ordered
|
63
|
+
g.should_receive(:error!).ordered
|
64
|
+
end
|
65
|
+
|
66
|
+
expect { subject.fetch }.to_not raise_error
|
67
|
+
end
|
68
|
+
end
|
69
|
+
context "when the ref does not exist" do
|
70
|
+
let(:git_ls_remote_out) {
|
71
|
+
''
|
72
|
+
}
|
73
|
+
it 'should clone the Git repository and then fail while retrying 3 times' do
|
74
|
+
4.times {
|
75
|
+
expect_git_clone
|
76
|
+
4.times {
|
77
|
+
expect_git_ls_remote
|
78
|
+
}
|
79
|
+
}
|
80
|
+
Omnibus::Fetcher::ErrorReporter.any_instance
|
81
|
+
.should_receive(:explain).with(%q|Failed to find any commits for the ref '0.0.1'|)
|
82
|
+
subject.should_receive(:log).with(%r|git ls-remote failed|).at_least(1).times
|
83
|
+
subject.should_receive(:log).with(%r|git clone/fetch failed|).at_least(1).times
|
84
|
+
# Prevent sleeping to run the spec fast
|
85
|
+
subject.stub(:sleep)
|
86
|
+
expect { subject.fetch }.to raise_error(/Could not parse SHA reference/)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
@@ -2,7 +2,7 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Omnibus::NetFetcher do
|
4
4
|
it "should download and uncompress zip files" do
|
5
|
-
software_mock =
|
5
|
+
software_mock = double('software')
|
6
6
|
software_mock.stub :project_file => 'file.zip',
|
7
7
|
:name => 'file',
|
8
8
|
:source => '/tmp/out',
|
@@ -13,4 +13,113 @@ describe Omnibus::NetFetcher do
|
|
13
13
|
net_fetcher = Omnibus::NetFetcher.new software_mock
|
14
14
|
net_fetcher.extract_cmd.should == 'unzip file.zip -d /tmp/out'
|
15
15
|
end
|
16
|
+
it "should download and uncompress .tar.xz files" do
|
17
|
+
software_mock = double('software')
|
18
|
+
software_mock.stub :project_file => 'file.tar.xz',
|
19
|
+
:name => 'file',
|
20
|
+
:source => '/tmp/out',
|
21
|
+
:checksum => 'abc123',
|
22
|
+
:source_uri => 'http://example.com/file.tar.xz',
|
23
|
+
:source_dir => '/tmp/out',
|
24
|
+
:project_dir => '/tmp/project'
|
25
|
+
net_fetcher = Omnibus::NetFetcher.new software_mock
|
26
|
+
net_fetcher.extract_cmd.should == 'xz -dc file.tar.xz | ( cd /tmp/out && tar -xf - )'
|
27
|
+
end
|
28
|
+
it "should download and uncompress .txz files" do
|
29
|
+
software_mock = double('software')
|
30
|
+
software_mock.stub :project_file => 'file.txz',
|
31
|
+
:name => 'file',
|
32
|
+
:source => '/tmp/out',
|
33
|
+
:checksum => 'abc123',
|
34
|
+
:source_uri => 'http://example.com/file.txz',
|
35
|
+
:source_dir => '/tmp/out',
|
36
|
+
:project_dir => '/tmp/project'
|
37
|
+
net_fetcher = Omnibus::NetFetcher.new software_mock
|
38
|
+
net_fetcher.extract_cmd.should == 'xz -dc file.txz | ( cd /tmp/out && tar -xf - )'
|
39
|
+
end
|
40
|
+
|
41
|
+
describe "http_proxy helper" do
|
42
|
+
before(:each) do
|
43
|
+
software_mock = double('software')
|
44
|
+
software_mock.stub(:project_file => 'file.txz',
|
45
|
+
:name => 'file',
|
46
|
+
:source => '/tmp/out',
|
47
|
+
:checksum => 'abc123',
|
48
|
+
:source_uri => 'http://example.com/file.txz',
|
49
|
+
:source_dir => '/tmp/out',
|
50
|
+
:project_dir => '/tmp/project')
|
51
|
+
@net_fetcher = Omnibus::NetFetcher.new(software_mock)
|
52
|
+
env_vars = ['HTTP_PROXY',
|
53
|
+
'HTTP_PROXY_USER',
|
54
|
+
'HTTP_PROXY_PASS',
|
55
|
+
'http_proxy',
|
56
|
+
'http_proxy_user',
|
57
|
+
'http_proxy_pass']
|
58
|
+
@orig_env = env_vars.inject({}) do |h, var|
|
59
|
+
h[var] = ENV.delete(var)
|
60
|
+
h
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
after(:each) do
|
65
|
+
# restore ENV hash
|
66
|
+
@orig_env.each { |var, val| ENV[var] = val }
|
67
|
+
end
|
68
|
+
|
69
|
+
describe "get_env handles upper and lower case env vars" do
|
70
|
+
it "lower via upper" do
|
71
|
+
ENV['lower'] = "abc"
|
72
|
+
@net_fetcher.get_env('LOWER').should == "abc"
|
73
|
+
@net_fetcher.get_env('lower').should == "abc"
|
74
|
+
end
|
75
|
+
|
76
|
+
it "upper via lower" do
|
77
|
+
ENV['UPPER'] = "abc"
|
78
|
+
@net_fetcher.get_env('upper').should == "abc"
|
79
|
+
@net_fetcher.get_env('UPPER').should == "abc"
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
it "should return nil when no proxy is set in env" do
|
84
|
+
@net_fetcher.http_proxy.should be_nil
|
85
|
+
end
|
86
|
+
|
87
|
+
it "should return a URI object when HTTP_PROXY is set" do
|
88
|
+
ENV['HTTP_PROXY'] = "http://my.proxy"
|
89
|
+
@net_fetcher.http_proxy.should == URI.parse("http://my.proxy")
|
90
|
+
end
|
91
|
+
|
92
|
+
it "sets user and pass from env when set" do
|
93
|
+
ENV['HTTP_PROXY'] = "my.proxy"
|
94
|
+
ENV['HTTP_PROXY_USER'] = "alex"
|
95
|
+
ENV['HTTP_PROXY_PASS'] = "sesame"
|
96
|
+
@net_fetcher.http_proxy.should == URI.parse("http://alex:sesame@my.proxy")
|
97
|
+
end
|
98
|
+
|
99
|
+
it "uses user and pass in URL before those in env" do
|
100
|
+
ENV['HTTP_PROXY'] = "sally:peanut@my.proxy"
|
101
|
+
ENV['HTTP_PROXY_USER'] = "alex"
|
102
|
+
ENV['HTTP_PROXY_PASS'] = "sesame"
|
103
|
+
@net_fetcher.http_proxy.should == URI.parse("http://sally:peanut@my.proxy")
|
104
|
+
end
|
105
|
+
|
106
|
+
it "proxies if host doesn't match exclude list" do
|
107
|
+
ENV['NO_PROXY'] = "google.com,www.buz.org"
|
108
|
+
a_url = URI.parse("http://should.proxy.com/123")
|
109
|
+
@net_fetcher.excluded_from_proxy?(a_url.host).should be_false
|
110
|
+
|
111
|
+
b_url = URI.parse("http://buz.org/123")
|
112
|
+
@net_fetcher.excluded_from_proxy?(b_url.host).should be_false
|
113
|
+
end
|
114
|
+
|
115
|
+
it "does not proxy if host matches exclude list" do
|
116
|
+
ENV['NO_PROXY'] = "google.com,www.buz.org"
|
117
|
+
a_url = URI.parse("http://google.com/hello")
|
118
|
+
@net_fetcher.excluded_from_proxy?(a_url.host).should be_true
|
119
|
+
|
120
|
+
b_url = URI.parse("http://www.buz.org/123")
|
121
|
+
@net_fetcher.excluded_from_proxy?(b_url.host).should be_true
|
122
|
+
end
|
123
|
+
end
|
16
124
|
end
|
125
|
+
|
@@ -47,7 +47,7 @@ describe Omnibus::PackageRelease do
|
|
47
47
|
describe "validating configuration" do
|
48
48
|
|
49
49
|
before do
|
50
|
-
Omnibus.stub
|
50
|
+
Omnibus.stub(:config).and_return(config)
|
51
51
|
end
|
52
52
|
|
53
53
|
it "validates that the s3 key is set" do
|
@@ -104,7 +104,7 @@ describe Omnibus::PackageRelease do
|
|
104
104
|
end
|
105
105
|
|
106
106
|
before do
|
107
|
-
package_release.stub
|
107
|
+
package_release.stub(:config).and_return(config)
|
108
108
|
File.stub(:exist?).with(pkg_metadata_path).and_return(true)
|
109
109
|
File.stub(:exist?).with(pkg_path).and_return(true)
|
110
110
|
IO.stub(:read).with(pkg_metadata_path).and_return(metadata_json)
|
data/spec/s3_cacher_spec.rb
CHANGED
@@ -23,17 +23,17 @@ describe Omnibus::S3Cache do
|
|
23
23
|
describe '#tarball_software' do
|
24
24
|
subject(:tarball_software) { described_class.new.tarball_software }
|
25
25
|
|
26
|
-
let(:source_a) {
|
27
|
-
let(:source_b) {
|
28
|
-
let(:source_c) {
|
26
|
+
let(:source_a) { double(source: { url: 'a' }) }
|
27
|
+
let(:source_b) { double(source: { url: 'b' }) }
|
28
|
+
let(:source_c) { double(source: {}) }
|
29
29
|
let(:projects) { [
|
30
|
-
|
31
|
-
|
30
|
+
double({ library: [source_a, source_c] }),
|
31
|
+
double({ library: [source_c, source_b] })
|
32
32
|
] }
|
33
33
|
let(:software_with_urls) { [source_a, source_b] }
|
34
34
|
|
35
35
|
before do
|
36
|
-
Omnibus.stub(config:
|
36
|
+
Omnibus.stub(config: double({
|
37
37
|
s3_bucket: 'test', s3_access_key: 'test', s3_secret_key: 'test'
|
38
38
|
}))
|
39
39
|
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'omnibus'
|
2
|
+
require 'spec_helper'
|
3
|
+
|
4
|
+
describe Omnibus do
|
5
|
+
|
6
|
+
describe '#software_dirs' do
|
7
|
+
|
8
|
+
before :each do
|
9
|
+
# This is probably really silly, but it works
|
10
|
+
Omnibus.class_eval { @software_dirs = nil }
|
11
|
+
end
|
12
|
+
|
13
|
+
context 'omnibus_software_root not nil' do
|
14
|
+
before :each do
|
15
|
+
Omnibus.stub(:omnibus_software_root) { './data' }
|
16
|
+
end
|
17
|
+
|
18
|
+
it 'will include list of software from omnibus-software gem' do
|
19
|
+
Omnibus.software_dirs.length.should eq 2
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
context 'omnibus_software_root nil' do
|
24
|
+
before :each do
|
25
|
+
Omnibus.stub(:omnibus_software_root) { nil }
|
26
|
+
end
|
27
|
+
|
28
|
+
it 'will not include list of software from omnibus-software gem' do
|
29
|
+
Omnibus.software_dirs.length.should eq 1
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
data/spec/software_spec.rb
CHANGED
@@ -6,8 +6,8 @@ require 'spec_helper'
|
|
6
6
|
describe Omnibus::Software do
|
7
7
|
|
8
8
|
let(:project) do
|
9
|
-
p =
|
10
|
-
p.
|
9
|
+
p = double(Omnibus::Project)
|
10
|
+
p.stub(:install_path).and_return("monkeys")
|
11
11
|
p
|
12
12
|
end
|
13
13
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omnibus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-12-06 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: mixlib-shellout
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ~>
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
21
|
+
version: 1.3.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ~>
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
29
|
+
version: 1.3.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
31
31
|
name: mixlib-config
|
32
32
|
requirement: !ruby/object:Gem::Requirement
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version:
|
37
|
+
version: 2.1.0
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version:
|
45
|
+
version: 2.1.0
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: ohai
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -82,7 +82,7 @@ dependencies:
|
|
82
82
|
requirements:
|
83
83
|
- - ~>
|
84
84
|
- !ruby/object:Gem::Version
|
85
|
-
version: 0.
|
85
|
+
version: 1.0.0
|
86
86
|
type: :runtime
|
87
87
|
prerelease: false
|
88
88
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -90,7 +90,7 @@ dependencies:
|
|
90
90
|
requirements:
|
91
91
|
- - ~>
|
92
92
|
- !ruby/object:Gem::Version
|
93
|
-
version: 0.
|
93
|
+
version: 1.0.0
|
94
94
|
- !ruby/object:Gem::Dependency
|
95
95
|
name: uber-s3
|
96
96
|
requirement: !ruby/object:Gem::Requirement
|
@@ -211,6 +211,8 @@ files:
|
|
211
211
|
- lib/omnibus/templates/package_scripts/makeselfinst.erb
|
212
212
|
- lib/omnibus/templates/package_scripts/postinst.erb
|
213
213
|
- lib/omnibus/templates/package_scripts/postrm.erb
|
214
|
+
- lib/omnibus/templates/package_scripts/preinst.erb
|
215
|
+
- lib/omnibus/templates/package_scripts/prerm.erb
|
214
216
|
- lib/omnibus/templates/project.rb.erb
|
215
217
|
- lib/omnibus/templates/software/c-example.rb.erb
|
216
218
|
- lib/omnibus/templates/software/erlang-example.rb.erb
|
@@ -224,10 +226,12 @@ files:
|
|
224
226
|
- spec/data/overrides/good.overrides
|
225
227
|
- spec/data/overrides/with_dupes.overrides
|
226
228
|
- spec/data/software/erchef.rb
|
229
|
+
- spec/fetchers/git_fetcher_spec.rb
|
227
230
|
- spec/fetchers/net_fetcher_spec.rb
|
228
231
|
- spec/overrides_spec.rb
|
229
232
|
- spec/package_release_spec.rb
|
230
233
|
- spec/s3_cacher_spec.rb
|
234
|
+
- spec/software_dirs_spec.rb
|
231
235
|
- spec/software_spec.rb
|
232
236
|
- spec/spec_helper.rb
|
233
237
|
homepage: https://github.com/opscode/omnibus-ruby
|
@@ -251,7 +255,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
251
255
|
version: '0'
|
252
256
|
segments:
|
253
257
|
- 0
|
254
|
-
hash: -
|
258
|
+
hash: -488059737138888426
|
255
259
|
requirements: []
|
256
260
|
rubyforge_project:
|
257
261
|
rubygems_version: 1.8.23
|
@@ -265,10 +269,12 @@ test_files:
|
|
265
269
|
- spec/data/overrides/good.overrides
|
266
270
|
- spec/data/overrides/with_dupes.overrides
|
267
271
|
- spec/data/software/erchef.rb
|
272
|
+
- spec/fetchers/git_fetcher_spec.rb
|
268
273
|
- spec/fetchers/net_fetcher_spec.rb
|
269
274
|
- spec/overrides_spec.rb
|
270
275
|
- spec/package_release_spec.rb
|
271
276
|
- spec/s3_cacher_spec.rb
|
277
|
+
- spec/software_dirs_spec.rb
|
272
278
|
- spec/software_spec.rb
|
273
279
|
- spec/spec_helper.rb
|
274
280
|
has_rdoc:
|