omnibus 4.0.0.rc.1 → 4.0.0.rc.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/lib/omnibus/compressors/dmg.rb +5 -12
- data/lib/omnibus/generator_files/.kitchen.yml.erb +21 -6
- data/lib/omnibus/generator_files/Berksfile.erb +6 -4
- data/lib/omnibus/generator_files/omnibus.rb.erb +1 -0
- data/lib/omnibus/health_check.rb +2 -0
- data/lib/omnibus/metadata.rb +8 -7
- data/lib/omnibus/packagers/bff.rb +34 -6
- data/lib/omnibus/packagers/deb.rb +6 -0
- data/lib/omnibus/packagers/makeself.rb +24 -5
- data/lib/omnibus/packagers/rpm.rb +10 -1
- data/lib/omnibus/software.rb +33 -22
- data/lib/omnibus/util.rb +1 -1
- data/lib/omnibus/version.rb +1 -1
- data/resources/bff/gen.template.erb +2 -2
- data/resources/makeself/makeselfinst.erb +35 -0
- data/resources/rpm/spec.erb +1 -1
- data/spec/unit/compressors/dmg_spec.rb +9 -1
- data/spec/unit/metadata_spec.rb +20 -12
- data/spec/unit/packagers/bff_spec.rb +15 -8
- data/spec/unit/packagers/deb_spec.rb +15 -0
- data/spec/unit/packagers/makeself_spec.rb +19 -46
- data/spec/unit/packagers/rpm_spec.rb +17 -0
- data/spec/unit/software_spec.rb +76 -46
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 67c9874074d2cec13ed5734f8e6f420ccfb157d7
|
4
|
+
data.tar.gz: 9fff24c7c26e8ef92175dac8c01b5c0883e2e2e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e2bbe215dd2606a272c04d1be03126d67cf0db748032616cfee7d699f355fef833f3d7b7bc29767c57bcd7e9c4dba8e1fde145d412ef8eb00b9d2eecbe53a9f0
|
7
|
+
data.tar.gz: 250b20df2e0c254335c29e0fb4490a764e8ce52044804e057c625b75034b638d868d3d91cb7b0593bf18742daf010187cb7f2e9b41a52b7a006fbe3c75d3129b
|
data/CHANGELOG.md
CHANGED
@@ -1,6 +1,32 @@
|
|
1
1
|
Omnibus CHANGELOG
|
2
2
|
=================
|
3
3
|
|
4
|
+
v4.0.0.rc.2 (November 10, 2014)
|
5
|
+
-------------------------------
|
6
|
+
|
7
|
+
### New Features
|
8
|
+
|
9
|
+
#### Platforms
|
10
|
+
- Raspberry Pi platform support (currently Raspbian and Pidora)
|
11
|
+
- AIX
|
12
|
+
- XL C is the default compiler on AIX.
|
13
|
+
- FreeBSD 10
|
14
|
+
- Clang is the default compiler on FreeBSD 10+
|
15
|
+
- Add `libgcc` and `libelf` to the FreeBSD whitelist
|
16
|
+
- Solaris
|
17
|
+
- Make compilation default `-static-libgcc`
|
18
|
+
|
19
|
+
### Bugfixes
|
20
|
+
|
21
|
+
- Set default values for `CXXFLAGS`.
|
22
|
+
- Retrieve the correct path_key from the ENV on Windows.
|
23
|
+
- openSUSE/SLES fixes for OHAI-339.
|
24
|
+
- Properly truncate platform version on Arch Linux.
|
25
|
+
- Ensure final `*.dmg` name matches actual `*.pkg` name.
|
26
|
+
- Change `makeself` package extension back to `.sh`.
|
27
|
+
- Generate a default `makeselfinst` which fires at following install.
|
28
|
+
- Map `Omnibus::Project#replaces` to RPM Spec file's `Obsoletes:`.
|
29
|
+
|
4
30
|
v4.0.0.rc.1 (September 23, 2014)
|
5
31
|
--------------------------------
|
6
32
|
|
@@ -248,7 +248,7 @@ module Omnibus
|
|
248
248
|
-format UDZO \\
|
249
249
|
-imagekey \\
|
250
250
|
zlib-level=9 \\
|
251
|
-
-o "#{
|
251
|
+
-o "#{package_path}"
|
252
252
|
rm -rf "#{writable_dmg}"
|
253
253
|
EOH
|
254
254
|
end
|
@@ -271,17 +271,18 @@ module Omnibus
|
|
271
271
|
DeRez -only icns "#{resource_path('icon.png')}" > tmp.rsrc
|
272
272
|
|
273
273
|
# Append the icon reosurce to the DMG
|
274
|
-
Rez -append tmp.rsrc -o "#{
|
274
|
+
Rez -append tmp.rsrc -o "#{package_path}"
|
275
275
|
|
276
276
|
# Source the icon
|
277
|
-
SetFile -a C "#{
|
277
|
+
SetFile -a C "#{package_path}"
|
278
278
|
EOH
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
282
282
|
# @see Base#package_name
|
283
283
|
def package_name
|
284
|
-
|
284
|
+
extname = File.extname(packager.package_name)
|
285
|
+
packager.package_name.sub(extname, '.dmg')
|
285
286
|
end
|
286
287
|
|
287
288
|
# The path to the writable dmg on disk.
|
@@ -291,14 +292,6 @@ module Omnibus
|
|
291
292
|
File.expand_path("#{staging_dir}/#{project.name}-writable.dmg")
|
292
293
|
end
|
293
294
|
|
294
|
-
# The path where the final dmg will be produced.
|
295
|
-
#
|
296
|
-
# @return [String]
|
297
|
-
def final_dmg
|
298
|
-
dmg_name = packager.package_name.sub('.pkg', '.dmg')
|
299
|
-
File.expand_path("#{Config.package_dir}/#{dmg_name}")
|
300
|
-
end
|
301
|
-
|
302
295
|
#
|
303
296
|
# The name of the volume to create. By defauly, this is the project's
|
304
297
|
# friendly name.
|
@@ -9,9 +9,25 @@ driver:
|
|
9
9
|
|
10
10
|
provisioner:
|
11
11
|
name: chef_zero
|
12
|
-
require_chef_omnibus: 11.
|
12
|
+
require_chef_omnibus: 11.16.4
|
13
13
|
|
14
14
|
platforms:
|
15
|
+
- name: centos-7.0
|
16
|
+
run_list: yum-epel::default
|
17
|
+
- name: centos-6.5
|
18
|
+
run_list: yum-epel::default
|
19
|
+
- name: centos-5.10
|
20
|
+
run_list: yum-epel::default
|
21
|
+
- name: debian-7.2.0
|
22
|
+
run_list: apt::default
|
23
|
+
- name: debian-6.0.8
|
24
|
+
run_list: apt::default
|
25
|
+
- name: freebsd-10.0
|
26
|
+
run_list: freebsd::portsnap
|
27
|
+
- name: freebsd-9.2
|
28
|
+
run_list:
|
29
|
+
- freebsd::portsnap
|
30
|
+
- freebsd::pkgng
|
15
31
|
- name: ubuntu-14.04
|
16
32
|
run_list: apt::default
|
17
33
|
- name: ubuntu-12.04
|
@@ -20,14 +36,13 @@ platforms:
|
|
20
36
|
run_list: apt::default
|
21
37
|
- name: ubuntu-10.04
|
22
38
|
run_list: apt::default
|
23
|
-
- name: centos-5.10
|
24
|
-
- name: centos-6.5
|
25
39
|
|
26
40
|
suites:
|
27
41
|
- name: default
|
28
42
|
run_list: omnibus::default
|
29
43
|
attributes:
|
30
44
|
omnibus:
|
31
|
-
build_user:
|
32
|
-
|
33
|
-
|
45
|
+
build_user: vagrant
|
46
|
+
build_user_group: vagrant
|
47
|
+
build_user_password: vagrant
|
48
|
+
install_dir: /opt/<%= config[:name] %>
|
@@ -1,10 +1,12 @@
|
|
1
1
|
source 'https://api.berkshelf.com'
|
2
2
|
|
3
|
-
# The apt cookbook is required to bring the apt cache up-to-date on Ubuntu
|
4
|
-
# systems, since the cache can become stale on older boxes.
|
5
|
-
cookbook 'apt', '~> 2.0'
|
6
|
-
|
7
3
|
cookbook 'omnibus'
|
8
4
|
|
9
5
|
# Uncomment to use the latest version of the Omnibus cookbook from GitHub
|
10
6
|
# cookbook 'omnibus', github: 'opscode-cookbooks/omnibus'
|
7
|
+
|
8
|
+
group :integration do
|
9
|
+
cookbook 'apt', '~> 2.3'
|
10
|
+
cookbook 'freebsd', '~> 0.1'
|
11
|
+
cookbook 'yum-epel', '~> 0.3'
|
12
|
+
end
|
data/lib/omnibus/health_check.rb
CHANGED
data/lib/omnibus/metadata.rb
CHANGED
@@ -123,7 +123,6 @@ module Omnibus
|
|
123
123
|
|
124
124
|
#
|
125
125
|
# Platform name to be used when creating metadata for the artifact.
|
126
|
-
# rhel/centos become "el", all others are just platform
|
127
126
|
#
|
128
127
|
# @return [String]
|
129
128
|
# the platform family short name
|
@@ -131,6 +130,8 @@ module Omnibus
|
|
131
130
|
def platform_shortname
|
132
131
|
if Ohai['platform_family'] == 'rhel'
|
133
132
|
'el'
|
133
|
+
elsif Ohai['platform'] == 'suse'
|
134
|
+
'sles'
|
134
135
|
else
|
135
136
|
Ohai['platform']
|
136
137
|
end
|
@@ -152,15 +153,15 @@ module Omnibus
|
|
152
153
|
#
|
153
154
|
def truncate_platform_version(platform_version, platform)
|
154
155
|
case platform
|
155
|
-
when 'centos', 'debian', 'el', 'fedora', 'freebsd', 'rhel', 'sles'
|
156
|
-
# Only want MAJOR (e.g. Debian 7)
|
156
|
+
when 'centos', 'debian', 'el', 'fedora', 'freebsd', 'omnios', 'pidora', 'raspbian', 'rhel', 'sles', 'suse', 'smartos'
|
157
|
+
# Only want MAJOR (e.g. Debian 7, OmniOS r151006, SmartOS 20120809T221258Z)
|
157
158
|
platform_version.split('.').first
|
158
|
-
when 'aix', '
|
159
|
+
when 'aix', 'gentoo', 'mac_os_x', 'openbsd', 'slackware', 'solaris2', 'opensuse', 'ubuntu'
|
159
160
|
# Only want MAJOR.MINOR (e.g. Mac OS X 10.9, Ubuntu 12.04)
|
160
161
|
platform_version.split('.')[0..1].join('.')
|
161
|
-
when '
|
162
|
-
#
|
163
|
-
|
162
|
+
when 'arch'
|
163
|
+
# Arch Linux does not have a platform_version ohai attribute, it is rolling release (lsb_release -r)
|
164
|
+
'rolling'
|
164
165
|
when 'windows'
|
165
166
|
# Windows has this really awesome "feature", where their version numbers
|
166
167
|
# internally do not match the "marketing" name.
|
@@ -40,6 +40,9 @@ module Omnibus
|
|
40
40
|
end
|
41
41
|
|
42
42
|
build do
|
43
|
+
# Copy scripts
|
44
|
+
write_scripts
|
45
|
+
|
43
46
|
# Render the gen template
|
44
47
|
write_gen_template
|
45
48
|
|
@@ -49,7 +52,7 @@ module Omnibus
|
|
49
52
|
|
50
53
|
# @see Base#package_name
|
51
54
|
def package_name
|
52
|
-
"#{safe_base_package_name}
|
55
|
+
"#{safe_base_package_name}-#{project.build_version}-#{project.build_iteration}.#{safe_architecture}.bff"
|
53
56
|
end
|
54
57
|
|
55
58
|
#
|
@@ -124,13 +127,12 @@ module Omnibus
|
|
124
127
|
# Unconfiguration Script: /path/script
|
125
128
|
#
|
126
129
|
def write_gen_template
|
127
|
-
# Create a map of scripts that exist
|
130
|
+
# Create a map of scripts that exist to inject into the template
|
128
131
|
scripts = SCRIPT_MAP.inject({}) do |hash, (script, installp_key)|
|
129
132
|
staging_path = File.join(scripts_staging_dir, script.to_s)
|
130
|
-
install_path = File.join(scripts_install_dir, script.to_s)
|
131
133
|
|
132
134
|
if File.file?(staging_path)
|
133
|
-
hash[installp_key] =
|
135
|
+
hash[installp_key] = staging_path
|
134
136
|
end
|
135
137
|
|
136
138
|
hash
|
@@ -163,16 +165,42 @@ module Omnibus
|
|
163
165
|
# @return [void]
|
164
166
|
#
|
165
167
|
def create_bff_file
|
168
|
+
# We are making the assumption that sudo exists.
|
169
|
+
# Unforunately, the owner of the file in the staging directory is what
|
170
|
+
# will be on the target machine, and mkinstallp can't tell you if that
|
171
|
+
# is a bad thing (it usually is).
|
172
|
+
# The match is so we only pick the lowest level of the project dir.
|
173
|
+
# This implies that if we are in /tmp/staging/project/dir/things,
|
174
|
+
# we will chown from 'project' on, rather than 'project/dir', which leaves
|
175
|
+
# project owned by the build user (which is incorrect)
|
176
|
+
shellout!("sudo chown -R 0:0 #{staging_dir}/#{project.install_dir.match(/^\/?(\w+)/)}")
|
166
177
|
log.info(log_key) { "Creating .bff file" }
|
167
178
|
|
168
|
-
|
179
|
+
# Since we want the owner to be root, we need to sudo the mkinstallp
|
180
|
+
# command, otherwise it will not have access to the previously chowned
|
181
|
+
# directory.
|
182
|
+
shellout!("sudo /usr/sbin/mkinstallp -d #{staging_dir} -T #{staging_dir}/gen.template")
|
169
183
|
|
170
184
|
# Copy the resulting package up to the package_dir
|
171
185
|
FileSyncer.glob("#{staging_dir}/tmp/*.bff").each do |bff|
|
172
|
-
copy_file(bff, Config.package_dir)
|
186
|
+
copy_file(bff, File.join(Config.package_dir, create_bff_file_name))
|
173
187
|
end
|
174
188
|
end
|
175
189
|
|
190
|
+
#
|
191
|
+
# Create bff file name
|
192
|
+
#
|
193
|
+
# +mkinstallp+ names the bff file according to the version specified in
|
194
|
+
# the template. We want to differentiate the build specific version
|
195
|
+
# correctly.
|
196
|
+
#
|
197
|
+
# @return [String]
|
198
|
+
#
|
199
|
+
def create_bff_file_name
|
200
|
+
"#{safe_base_package_name}-#{project.build_version}-#{project.build_iteration}.#{safe_architecture}.bff"
|
201
|
+
end
|
202
|
+
|
203
|
+
|
176
204
|
#
|
177
205
|
# Return the BFF-ready base package name, converting any invalid characters to
|
178
206
|
# dashes (+-+).
|
@@ -19,9 +19,7 @@ module Omnibus
|
|
19
19
|
# @return [Hash]
|
20
20
|
SCRIPT_MAP = {
|
21
21
|
# Default Omnibus naming
|
22
|
-
postinst: '
|
23
|
-
# Default Makeself naming
|
24
|
-
makeselfinst: 'makeselfinst',
|
22
|
+
postinst: 'postinst',
|
25
23
|
}.freeze
|
26
24
|
|
27
25
|
id :makeself
|
@@ -38,13 +36,16 @@ module Omnibus
|
|
38
36
|
# Write the scripts
|
39
37
|
write_scripts
|
40
38
|
|
39
|
+
# Write the makeselfinst file
|
40
|
+
write_makeselfinst
|
41
|
+
|
41
42
|
# Create the makeself archive
|
42
43
|
create_makeself_package
|
43
44
|
end
|
44
45
|
|
45
46
|
# @see Base#package_name
|
46
47
|
def package_name
|
47
|
-
"#{project.package_name}-#{project.build_version}_#{project.build_iteration}.#{safe_architecture}.
|
48
|
+
"#{project.package_name}-#{project.build_version}_#{project.build_iteration}.#{safe_architecture}.sh"
|
48
49
|
end
|
49
50
|
|
50
51
|
#
|
@@ -67,6 +68,24 @@ module Omnibus
|
|
67
68
|
resource_path('makeself-header.sh')
|
68
69
|
end
|
69
70
|
|
71
|
+
#
|
72
|
+
# Render a makeselfinst in the staging directory using the supplied ERB
|
73
|
+
# template. This file will be used to move the contents of the self-
|
74
|
+
# extracting archive into place following extraction.
|
75
|
+
#
|
76
|
+
# @return [void]
|
77
|
+
#
|
78
|
+
def write_makeselfinst
|
79
|
+
makeselfinst_staging_path = File.join(staging_dir, 'makeselfinst')
|
80
|
+
render_template(resource_path('makeselfinst.erb'),
|
81
|
+
destination: makeselfinst_staging_path,
|
82
|
+
variables: {
|
83
|
+
install_dir: project.install_dir,
|
84
|
+
}
|
85
|
+
)
|
86
|
+
FileUtils.chmod(0755, makeselfinst_staging_path)
|
87
|
+
end
|
88
|
+
|
70
89
|
#
|
71
90
|
# Copy all scripts in {Project#package_scripts_path} to the staging
|
72
91
|
# directory.
|
@@ -105,7 +124,7 @@ module Omnibus
|
|
105
124
|
EOH
|
106
125
|
end
|
107
126
|
|
108
|
-
FileSyncer.glob("#{staging_dir}/*.
|
127
|
+
FileSyncer.glob("#{staging_dir}/*.sh").each do |makeself|
|
109
128
|
copy_file(makeself, Config.package_dir)
|
110
129
|
end
|
111
130
|
end
|
@@ -449,7 +449,16 @@ module Omnibus
|
|
449
449
|
# @return [String]
|
450
450
|
#
|
451
451
|
def safe_architecture
|
452
|
-
Ohai['kernel']['machine']
|
452
|
+
case Ohai['kernel']['machine']
|
453
|
+
when 'armv6l'
|
454
|
+
if Ohai['platform'] == 'pidora'
|
455
|
+
'armv6hl'
|
456
|
+
else
|
457
|
+
'armv6l'
|
458
|
+
end
|
459
|
+
else
|
460
|
+
Ohai['kernel']['machine']
|
461
|
+
end
|
453
462
|
end
|
454
463
|
end
|
455
464
|
end
|
data/lib/omnibus/software.rb
CHANGED
@@ -431,27 +431,16 @@ module Omnibus
|
|
431
431
|
compiler_flags =
|
432
432
|
case Ohai['platform']
|
433
433
|
when "aix"
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
"LDFLAGS" => "-L#{install_dir}/embedded/lib -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib",
|
441
|
-
}
|
442
|
-
else
|
443
|
-
{
|
444
|
-
"CC" => "xlc -q64",
|
445
|
-
"CXX" => "xlC -q64",
|
446
|
-
"CFLAGS" => "-q64 -I#{install_dir}/embedded/include -O",
|
447
|
-
"LDFLAGS" => "-q64 -L#{install_dir}/embedded/lib -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib",
|
448
|
-
}
|
449
|
-
end
|
450
|
-
cc_flags.merge({
|
434
|
+
{
|
435
|
+
"CC" => "xlc_r -q64",
|
436
|
+
"CXX" => "xlC_r -q64",
|
437
|
+
"CFLAGS" => "-q64 -I#{install_dir}/embedded/include -D_LARGE_FILES -O",
|
438
|
+
"CXXFLAGS" => "-q64 -I#{install_dir}/embedded/include -D_LARGE_FILES -O",
|
439
|
+
"LDFLAGS" => "-q64 -L#{install_dir}/embedded/lib -Wl,-blibpath:#{install_dir}/embedded/lib:/usr/lib:/lib",
|
451
440
|
"LD" => "ld -b64",
|
452
441
|
"OBJECT_MODE" => "64",
|
453
442
|
"ARFLAGS" => "-X64 cru",
|
454
|
-
}
|
443
|
+
}
|
455
444
|
when "mac_os_x"
|
456
445
|
{
|
457
446
|
"LDFLAGS" => "-L#{install_dir}/embedded/lib",
|
@@ -459,14 +448,25 @@ module Omnibus
|
|
459
448
|
}
|
460
449
|
when "solaris2"
|
461
450
|
{
|
451
|
+
# this override is due to a bug in libtool documented here:
|
452
|
+
# http://lists.gnu.org/archive/html/bug-libtool/2005-10/msg00004.html
|
453
|
+
"CC" => "gcc -static-libgcc",
|
462
454
|
"LDFLAGS" => "-R#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib -static-libgcc",
|
463
455
|
"CFLAGS" => "-I#{install_dir}/embedded/include",
|
464
456
|
}
|
465
457
|
when "freebsd"
|
466
|
-
{
|
467
|
-
"LDFLAGS" => "-
|
458
|
+
freebsd_flags = {
|
459
|
+
"LDFLAGS" => "-L#{install_dir}/embedded/lib",
|
468
460
|
"CFLAGS" => "-I#{install_dir}/embedded/include",
|
469
461
|
}
|
462
|
+
# Clang became the default compiler in FreeBSD 10+
|
463
|
+
if Ohai['os_version'].to_i >= 1000024
|
464
|
+
freebsd_flags.merge!(
|
465
|
+
"CC" => "clang",
|
466
|
+
"CXX" => "clang++",
|
467
|
+
)
|
468
|
+
end
|
469
|
+
freebsd_flags
|
470
470
|
else
|
471
471
|
{
|
472
472
|
"LDFLAGS" => "-Wl,-rpath,#{install_dir}/embedded/lib -L#{install_dir}/embedded/lib",
|
@@ -496,7 +496,9 @@ module Omnibus
|
|
496
496
|
# always want to favor pkg-config from embedded location to not hose
|
497
497
|
# configure scripts which try to be too clever and ignore our explicit
|
498
498
|
# CFLAGS and LDFLAGS in favor of pkg-config info
|
499
|
-
merge({"PKG_CONFIG_PATH" => "#{install_dir}/embedded/lib/pkgconfig"})
|
499
|
+
merge({"PKG_CONFIG_PATH" => "#{install_dir}/embedded/lib/pkgconfig"}).
|
500
|
+
# Set default values for CXXFLAGS.
|
501
|
+
merge('CXXFLAGS' => compiler_flags['CFLAGS'])
|
500
502
|
end
|
501
503
|
expose :with_standard_compiler_flags
|
502
504
|
|
@@ -809,7 +811,16 @@ module Omnibus
|
|
809
811
|
# $WINDOWSRAGE, and if you don't set that your native gem compiles
|
810
812
|
# will fail because the magic fixup it does to add the mingw compiler
|
811
813
|
# stuff won't work.
|
812
|
-
|
814
|
+
#
|
815
|
+
# Turns out there is other build environments that only set ENV['PATH'] and if we
|
816
|
+
# modify ENV['Path'] then it ignores that. So, we scan ENV and returns the first
|
817
|
+
# one that we find.
|
818
|
+
#
|
819
|
+
if Ohai['platform'] == 'windows'
|
820
|
+
ENV.keys.grep(/\Apath\Z/i).first
|
821
|
+
else
|
822
|
+
'PATH'
|
823
|
+
end
|
813
824
|
end
|
814
825
|
|
815
826
|
#
|
data/lib/omnibus/util.rb
CHANGED
@@ -69,7 +69,7 @@ module Omnibus
|
|
69
69
|
unless options[:environment].empty?
|
70
70
|
log.public_send(log_level, log_key) { 'Environment:' }
|
71
71
|
options[:environment].sort.each do |key, value|
|
72
|
-
log.public_send(log_level, log_key) { " #{key
|
72
|
+
log.public_send(log_level, log_key) { " #{key}=#{value.inspect}" }
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
data/lib/omnibus/version.rb
CHANGED
@@ -0,0 +1,35 @@
|
|
1
|
+
#!/bin/sh
|
2
|
+
# WARNING: REQUIRES /bin/sh
|
3
|
+
#
|
4
|
+
# - must run on /bin/sh on solaris 9
|
5
|
+
# - must run on /bin/sh on AIX 6.x
|
6
|
+
# - if you think you are a bash wizard, you probably do not understand
|
7
|
+
# this programming language. do not touch.
|
8
|
+
# - if you are under 40, get peer review from your elders.
|
9
|
+
#
|
10
|
+
|
11
|
+
#########################################################################
|
12
|
+
# HELPERS
|
13
|
+
#########################################################################
|
14
|
+
error_exit()
|
15
|
+
{
|
16
|
+
echo "${PROGNAME}: ${1:-"Unknown Error"}" 1>&2
|
17
|
+
exit 1
|
18
|
+
}
|
19
|
+
|
20
|
+
PROGNAME=`basename $0`
|
21
|
+
EXTRACT_DIR=`dirname $0`
|
22
|
+
INSTALL_DIR=<%= install_dir %>
|
23
|
+
|
24
|
+
#########################################################################
|
25
|
+
# MOVE SELF-EXTRACTING ARCHIVE FILES INTO PLACE
|
26
|
+
#########################################################################
|
27
|
+
rm -rf $INSTALL_DIR/* || error_exit "Cannot remove contents of $INSTALL_DIR"
|
28
|
+
mkdir -p $INSTALL_DIR || error_exit "Cannot create $INSTALL_DIR"
|
29
|
+
cp -R $EXTRACT_DIR $INSTALL_DIR || error_exit "Cannot install to $INSTALL_DIR"
|
30
|
+
rm -f $INSTALL_DIR/$PROGNAME
|
31
|
+
|
32
|
+
# Execute the optional postinst script
|
33
|
+
if test -f "$INSTALL_DIR/postinst"; then
|
34
|
+
$INSTALL_DIR/postinst
|
35
|
+
fi
|
data/resources/rpm/spec.erb
CHANGED
@@ -34,7 +34,7 @@ Requires: <%= name %>
|
|
34
34
|
<% conflicts.each do |name| -%>
|
35
35
|
Conflicts: <%= name %>
|
36
36
|
<% end -%>
|
37
|
-
<%
|
37
|
+
<% replaces.each do |name| -%>
|
38
38
|
Obsoletes: <%= name %>
|
39
39
|
<%- end -%>
|
40
40
|
<% # RPM rejects descriptions with blank lines (even between content) -%>
|
@@ -266,9 +266,17 @@ module Omnibus
|
|
266
266
|
end
|
267
267
|
|
268
268
|
describe '#package_name' do
|
269
|
-
it '
|
269
|
+
it 'reflects the packager\'s unmodified package_name' do
|
270
270
|
expect(subject.package_name).to eq('project-1.2.3-2.dmg')
|
271
271
|
end
|
272
|
+
|
273
|
+
it 'reflects the packager\'s modified package_name' do
|
274
|
+
package_basename = 'projectsub-1.2.3-3'
|
275
|
+
allow(project.packager).to receive(:package_name)
|
276
|
+
.and_return("#{package_basename}.pkg")
|
277
|
+
|
278
|
+
expect(subject.package_name).to eq("#{package_basename}.dmg")
|
279
|
+
end
|
272
280
|
end
|
273
281
|
|
274
282
|
describe '#writable_dmg' do
|
data/spec/unit/metadata_spec.rb
CHANGED
@@ -36,7 +36,12 @@ module Omnibus
|
|
36
36
|
expect(described_class.platform_shortname).to eq('el')
|
37
37
|
end
|
38
38
|
|
39
|
-
it 'returns
|
39
|
+
it 'returns sles on suse' do
|
40
|
+
stub_ohai(platform: 'suse', version: '12.0')
|
41
|
+
expect(described_class.platform_shortname).to eq('sles')
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'returns .platform on all other systems' do
|
40
45
|
stub_ohai(platform: 'ubuntu', version: '12.04')
|
41
46
|
expect(described_class.platform_shortname).to eq('ubuntu')
|
42
47
|
end
|
@@ -56,26 +61,29 @@ module Omnibus
|
|
56
61
|
end
|
57
62
|
end
|
58
63
|
|
59
|
-
it_behaves_like 'a version manipulator', '
|
60
|
-
it_behaves_like 'a version manipulator', 'arch', '
|
64
|
+
it_behaves_like 'a version manipulator', 'aix', '7.1', '7.1'
|
65
|
+
it_behaves_like 'a version manipulator', 'arch', 'rolling', 'rolling'
|
66
|
+
it_behaves_like 'a version manipulator', 'centos', '5.9.6', '5'
|
61
67
|
it_behaves_like 'a version manipulator', 'debian', '7.1', '7'
|
62
68
|
it_behaves_like 'a version manipulator', 'debian', '6.9', '6'
|
63
|
-
it_behaves_like 'a version manipulator', '
|
64
|
-
it_behaves_like 'a version manipulator', 'ubuntu', '10.04.04', '10.04'
|
69
|
+
it_behaves_like 'a version manipulator', 'el', '6.5', '6'
|
65
70
|
it_behaves_like 'a version manipulator', 'fedora', '11.5', '11'
|
66
71
|
it_behaves_like 'a version manipulator', 'freebsd', '10.0', '10'
|
67
|
-
it_behaves_like 'a version manipulator', 'rhel', '6.5', '6'
|
68
|
-
it_behaves_like 'a version manipulator', 'el', '6.5', '6'
|
69
|
-
it_behaves_like 'a version manipulator', 'centos', '5.9.6', '5'
|
70
|
-
it_behaves_like 'a version manipulator', 'aix', '7.1', '7.1'
|
71
72
|
it_behaves_like 'a version manipulator', 'gentoo', '2004.3', '2004.3'
|
72
73
|
it_behaves_like 'a version manipulator', 'mac_os_x', '10.9.1', '10.9'
|
74
|
+
it_behaves_like 'a version manipulator', 'omnios', 'r151010', 'r151010'
|
73
75
|
it_behaves_like 'a version manipulator', 'openbsd', '5.4.4', '5.4'
|
76
|
+
it_behaves_like 'a version manipulator', 'opensuse', '5.9', '5.9'
|
77
|
+
it_behaves_like 'a version manipulator', 'pidora', '11.5', '11'
|
78
|
+
it_behaves_like 'a version manipulator', 'raspbian', '7.1', '7'
|
79
|
+
it_behaves_like 'a version manipulator', 'rhel', '6.5', '6'
|
74
80
|
it_behaves_like 'a version manipulator', 'slackware', '12.0.1', '12.0'
|
75
|
-
it_behaves_like 'a version manipulator', '
|
76
|
-
it_behaves_like 'a version manipulator', 'suse', '
|
77
|
-
it_behaves_like 'a version manipulator', 'omnios', 'r151010', 'r151010'
|
81
|
+
it_behaves_like 'a version manipulator', 'sles', '11.2', '11'
|
82
|
+
it_behaves_like 'a version manipulator', 'suse', '12.0', '12'
|
78
83
|
it_behaves_like 'a version manipulator', 'smartos', '20120809T221258Z', '20120809T221258Z'
|
84
|
+
it_behaves_like 'a version manipulator', 'solaris2', '5.9', '5.9'
|
85
|
+
it_behaves_like 'a version manipulator', 'ubuntu', '10.04', '10.04'
|
86
|
+
it_behaves_like 'a version manipulator', 'ubuntu', '10.04.04', '10.04'
|
79
87
|
it_behaves_like 'a version manipulator', 'windows', '5.0.2195', '2000'
|
80
88
|
it_behaves_like 'a version manipulator', 'windows', '5.1.2600', 'xp'
|
81
89
|
it_behaves_like 'a version manipulator', 'windows', '5.2.3790', '2003r2'
|
@@ -39,8 +39,8 @@ module Omnibus
|
|
39
39
|
allow(subject).to receive(:safe_architecture).and_return('x86_64')
|
40
40
|
end
|
41
41
|
|
42
|
-
it 'includes the name
|
43
|
-
expect(subject.package_name).to eq('project
|
42
|
+
it 'includes the name and version' do
|
43
|
+
expect(subject.package_name).to eq('project-1.2.3-2.x86_64.bff')
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -109,8 +109,8 @@ module Omnibus
|
|
109
109
|
expect(contents).to include(" Include license files in this package: N")
|
110
110
|
expect(contents).to include(" Requisites:")
|
111
111
|
expect(contents).to include(" ROOT Part: Y")
|
112
|
-
expect(contents).to include("
|
113
|
-
expect(contents).to include("
|
112
|
+
expect(contents).to include(" USRFiles")
|
113
|
+
expect(contents).to include(" EOUSRFiles")
|
114
114
|
expect(contents).to include("EOFileset")
|
115
115
|
end
|
116
116
|
|
@@ -145,10 +145,10 @@ module Omnibus
|
|
145
145
|
subject.write_gen_template
|
146
146
|
contents = File.read(gen_file)
|
147
147
|
|
148
|
-
expect(contents).to include(" Pre-installation Script: #{subject.
|
149
|
-
expect(contents).to include(" Post-installation Script: #{subject.
|
150
|
-
expect(contents).to include(" Pre_rm Script: #{subject.
|
151
|
-
expect(contents).to include(" Unconfiguration Script: #{subject.
|
148
|
+
expect(contents).to include(" Pre-installation Script: #{subject.scripts_staging_dir}/preinst")
|
149
|
+
expect(contents).to include(" Post-installation Script: #{subject.scripts_staging_dir}/postinst")
|
150
|
+
expect(contents).to include(" Pre_rm Script: #{subject.scripts_staging_dir}/prerm")
|
151
|
+
expect(contents).to include(" Unconfiguration Script: #{subject.scripts_staging_dir}/postrm")
|
152
152
|
end
|
153
153
|
end
|
154
154
|
end
|
@@ -192,6 +192,13 @@ module Omnibus
|
|
192
192
|
end
|
193
193
|
end
|
194
194
|
|
195
|
+
describe '#create_bff_file_name' do
|
196
|
+
it 'constructs the proper package name' do
|
197
|
+
expect(subject.create_bff_file_name).to eq('project-1.2.3-2.x86_64.bff')
|
198
|
+
end
|
199
|
+
|
200
|
+
end
|
201
|
+
|
195
202
|
describe '#bff_version' do
|
196
203
|
it 'returns the build version up with the build iteration' do
|
197
204
|
expect(subject.bff_version).to eq('1.2.3.2')
|
@@ -331,6 +331,21 @@ module Omnibus
|
|
331
331
|
expect(subject.safe_architecture).to eq('i386')
|
332
332
|
end
|
333
333
|
end
|
334
|
+
|
335
|
+
context 'on Raspbian' do
|
336
|
+
before do
|
337
|
+
# There's no Raspbian in Fauxhai :(
|
338
|
+
stub_ohai(platform: 'debian', version: '7.6') do |data|
|
339
|
+
data['platform'] = 'raspbian'
|
340
|
+
data['platform_version'] = '7.6'
|
341
|
+
data['kernel']['machine'] = 'armv6l'
|
342
|
+
end
|
343
|
+
end
|
344
|
+
|
345
|
+
it 'returns armhf' do
|
346
|
+
expect(subject.safe_architecture).to eq('armhf')
|
347
|
+
end
|
348
|
+
end
|
334
349
|
end
|
335
350
|
end
|
336
351
|
end
|
@@ -39,69 +39,42 @@ module Omnibus
|
|
39
39
|
end
|
40
40
|
|
41
41
|
it 'includes the name, version, and build iteration' do
|
42
|
-
expect(subject.package_name).to eq('project-1.2.3_2.x86_64.
|
42
|
+
expect(subject.package_name).to eq('project-1.2.3_2.x86_64.sh')
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
describe '#
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
it 'copies the scripts into the STAGING dir' do
|
52
|
-
subject.write_scripts
|
53
|
-
expect("#{staging_dir}/makeselfinst").to be_a_file
|
46
|
+
describe '#write_makeselfinst' do
|
47
|
+
it 'generates the executable file' do
|
48
|
+
subject.write_makeselfinst
|
49
|
+
expect("#{staging_dir}/makeselfinst").to be_an_executable
|
54
50
|
end
|
55
51
|
|
56
52
|
it 'has the correct content' do
|
57
|
-
subject.
|
53
|
+
subject.write_makeselfinst
|
58
54
|
contents = File.read("#{staging_dir}/makeselfinst")
|
59
55
|
|
60
|
-
expect(contents).to include('
|
56
|
+
expect(contents).to include('INSTALL_DIR=/opt/project')
|
61
57
|
end
|
62
58
|
end
|
63
59
|
|
64
60
|
describe '#write_scripts' do
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
scripts
|
69
|
-
|
70
|
-
"Contents of #{script_name}"
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
it 'writes the scripts into the staging dir' do
|
76
|
-
subject.write_scripts
|
77
|
-
|
78
|
-
scripts.each do |script_name|
|
79
|
-
script_file = "#{staging_dir}/#{script_name}"
|
80
|
-
contents = File.read(script_file)
|
81
|
-
expect(contents).to include("Contents of #{script_name}")
|
61
|
+
let(:default_scripts) { %w( postinst ) }
|
62
|
+
before do
|
63
|
+
default_scripts.each do |script_name|
|
64
|
+
create_file("#{project_root}/package-scripts/project/#{script_name}") do
|
65
|
+
"Contents of #{script_name}"
|
82
66
|
end
|
83
67
|
end
|
84
68
|
end
|
85
69
|
|
86
|
-
|
87
|
-
|
88
|
-
before do
|
89
|
-
default_scripts.each do |script_name|
|
90
|
-
create_file("#{project_root}/package-scripts/project/#{script_name}") do
|
91
|
-
"Contents of #{script_name}"
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'writes the scripts into the staging dir' do
|
97
|
-
subject.write_scripts
|
70
|
+
it 'writes the scripts into the staging dir' do
|
71
|
+
subject.write_scripts
|
98
72
|
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
end
|
73
|
+
default_scripts.each do |script_name|
|
74
|
+
mapped_name = Packager::Makeself::SCRIPT_MAP[script_name.to_sym]
|
75
|
+
script_file = "#{staging_dir}/#{mapped_name}"
|
76
|
+
contents = File.read(script_file)
|
77
|
+
expect(contents).to include("Contents of #{script_name}")
|
105
78
|
end
|
106
79
|
end
|
107
80
|
end
|
@@ -10,6 +10,7 @@ module Omnibus
|
|
10
10
|
project.build_version('1.2.3')
|
11
11
|
project.build_iteration('2')
|
12
12
|
project.maintainer('Chef Software')
|
13
|
+
project.replace('old-project')
|
13
14
|
end
|
14
15
|
end
|
15
16
|
|
@@ -150,6 +151,7 @@ module Omnibus
|
|
150
151
|
expect(contents).to include("Vendor: Omnibus <omnibus@getchef.com>")
|
151
152
|
expect(contents).to include("URL: https://example.com")
|
152
153
|
expect(contents).to include("Packager: Chef Software")
|
154
|
+
expect(contents).to include("Obsoletes: old-project")
|
153
155
|
end
|
154
156
|
|
155
157
|
context 'when scripts are given' do
|
@@ -338,6 +340,21 @@ module Omnibus
|
|
338
340
|
it 'returns the value from Ohai' do
|
339
341
|
expect(subject.safe_architecture).to eq('i386')
|
340
342
|
end
|
343
|
+
|
344
|
+
context 'on Pidora' do
|
345
|
+
before do
|
346
|
+
# There's no Pidora in Fauxhai :(
|
347
|
+
stub_ohai(platform: 'fedora', version: '20') do |data|
|
348
|
+
data['platform'] = 'pidora'
|
349
|
+
data['platform_version'] = '20'
|
350
|
+
data['kernel']['machine'] = 'armv6l'
|
351
|
+
end
|
352
|
+
end
|
353
|
+
|
354
|
+
it 'returns armv6hl' do
|
355
|
+
expect(subject.safe_architecture).to eq('armv6hl')
|
356
|
+
end
|
357
|
+
end
|
341
358
|
end
|
342
359
|
end
|
343
360
|
end
|
data/spec/unit/software_spec.rb
CHANGED
@@ -51,6 +51,7 @@ module Omnibus
|
|
51
51
|
expect(subject.with_standard_compiler_flags).to eq(
|
52
52
|
'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
|
53
53
|
'CFLAGS' => '-I/opt/project/embedded/include',
|
54
|
+
'CXXFLAGS' => '-I/opt/project/embedded/include',
|
54
55
|
'LD_RUN_PATH' => '/opt/project/embedded/lib',
|
55
56
|
'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
|
56
57
|
)
|
@@ -59,6 +60,7 @@ module Omnibus
|
|
59
60
|
expect(subject.with_standard_compiler_flags('LDFLAGS' => 'foo')).to eq(
|
60
61
|
'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
|
61
62
|
'CFLAGS' => '-I/opt/project/embedded/include',
|
63
|
+
'CXXFLAGS' => '-I/opt/project/embedded/include',
|
62
64
|
'LD_RUN_PATH' => '/opt/project/embedded/lib',
|
63
65
|
'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
|
64
66
|
)
|
@@ -67,6 +69,16 @@ module Omnibus
|
|
67
69
|
expect(subject.with_standard_compiler_flags('CFLAGS'=>'foo')).to eq(
|
68
70
|
'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
|
69
71
|
'CFLAGS' => '-I/opt/project/embedded/include',
|
72
|
+
'CXXFLAGS' => '-I/opt/project/embedded/include',
|
73
|
+
'LD_RUN_PATH' => '/opt/project/embedded/lib',
|
74
|
+
'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
|
75
|
+
)
|
76
|
+
end
|
77
|
+
it 'ovesrride CXXFLAGS' do
|
78
|
+
expect(subject.with_standard_compiler_flags('CXXFLAGS'=>'foo')).to eq(
|
79
|
+
'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
|
80
|
+
'CFLAGS' => '-I/opt/project/embedded/include',
|
81
|
+
'CXXFLAGS' => '-I/opt/project/embedded/include',
|
70
82
|
'LD_RUN_PATH' => '/opt/project/embedded/lib',
|
71
83
|
'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
|
72
84
|
)
|
@@ -76,6 +88,7 @@ module Omnibus
|
|
76
88
|
'numberwang' => 4,
|
77
89
|
'LDFLAGS' => '-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib',
|
78
90
|
'CFLAGS' => '-I/opt/project/embedded/include',
|
91
|
+
'CXXFLAGS' => '-I/opt/project/embedded/include',
|
79
92
|
'LD_RUN_PATH' => '/opt/project/embedded/lib',
|
80
93
|
'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
|
81
94
|
)
|
@@ -92,8 +105,10 @@ module Omnibus
|
|
92
105
|
|
93
106
|
it 'sets the defaults' do
|
94
107
|
expect(subject.with_standard_compiler_flags).to eq(
|
108
|
+
'CC' => 'gcc -static-libgcc',
|
95
109
|
'LDFLAGS' => '-R/opt/project/embedded/lib -L/opt/project/embedded/lib -static-libgcc',
|
96
110
|
'CFLAGS' => '-I/opt/project/embedded/include',
|
111
|
+
"CXXFLAGS" => "-I/opt/project/embedded/include",
|
97
112
|
'LD_RUN_PATH' => '/opt/project/embedded/lib',
|
98
113
|
'LD_OPTIONS' => '-R/opt/project/embedded/lib',
|
99
114
|
'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
|
@@ -108,6 +123,7 @@ module Omnibus
|
|
108
123
|
expect(subject.with_standard_compiler_flags).to eq(
|
109
124
|
'LDFLAGS' => '-L/opt/project/embedded/lib',
|
110
125
|
'CFLAGS' => '-I/opt/project/embedded/include',
|
126
|
+
"CXXFLAGS" => "-I/opt/project/embedded/include",
|
111
127
|
'LD_RUN_PATH' => '/opt/project/embedded/lib',
|
112
128
|
'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
|
113
129
|
)
|
@@ -124,9 +140,10 @@ module Omnibus
|
|
124
140
|
|
125
141
|
it 'sets the defaults' do
|
126
142
|
expect(subject.with_standard_compiler_flags).to eq(
|
127
|
-
'CC' => '
|
128
|
-
'CXX' => '
|
129
|
-
'CFLAGS' => '-q64 -I/opt/project/embedded/include -O',
|
143
|
+
'CC' => 'xlc_r -q64',
|
144
|
+
'CXX' => 'xlC_r -q64',
|
145
|
+
'CFLAGS' => '-q64 -I/opt/project/embedded/include -D_LARGE_FILES -O',
|
146
|
+
"CXXFLAGS" => "-q64 -I/opt/project/embedded/include -D_LARGE_FILES -O",
|
130
147
|
'LDFLAGS' => '-q64 -L/opt/project/embedded/lib -Wl,-blibpath:/opt/project/embedded/lib:/usr/lib:/lib',
|
131
148
|
'LD' => 'ld -b64',
|
132
149
|
'OBJECT_MODE' => '64',
|
@@ -137,62 +154,81 @@ module Omnibus
|
|
137
154
|
end
|
138
155
|
end
|
139
156
|
|
140
|
-
context 'on
|
157
|
+
context 'on freebsd' do
|
141
158
|
before do
|
142
|
-
|
143
|
-
stub_ohai(platform: 'solaris2', version: '5.11') do |data|
|
144
|
-
data['platform'] = 'aix'
|
145
|
-
end
|
159
|
+
stub_ohai(platform: 'freebsd', version: '9.2')
|
146
160
|
end
|
147
161
|
|
148
162
|
it 'sets the defaults' do
|
149
|
-
expect(subject.with_standard_compiler_flags
|
150
|
-
'
|
151
|
-
'
|
152
|
-
'
|
153
|
-
'
|
154
|
-
'
|
155
|
-
'OBJECT_MODE' => '64',
|
156
|
-
'ARFLAGS' => '-X64 cru',
|
157
|
-
'LD_RUN_PATH' => '/opt/project/embedded/lib',
|
158
|
-
'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig'
|
163
|
+
expect(subject.with_standard_compiler_flags).to eq(
|
164
|
+
'CFLAGS' => '-I/opt/project/embedded/include',
|
165
|
+
'CXXFLAGS' => '-I/opt/project/embedded/include',
|
166
|
+
'LDFLAGS' => '-L/opt/project/embedded/lib',
|
167
|
+
'LD_RUN_PATH' => '/opt/project/embedded/lib',
|
168
|
+
'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig',
|
159
169
|
)
|
160
170
|
end
|
171
|
+
|
172
|
+
context 'on freebsd' do
|
173
|
+
before do
|
174
|
+
stub_ohai(platform: 'freebsd', version: '10.0')
|
175
|
+
end
|
176
|
+
|
177
|
+
it 'Clang as the default compiler' do
|
178
|
+
expect(subject.with_standard_compiler_flags).to eq(
|
179
|
+
'CC' => 'clang',
|
180
|
+
'CXX' => 'clang++',
|
181
|
+
'CFLAGS' => '-I/opt/project/embedded/include',
|
182
|
+
'CXXFLAGS' => '-I/opt/project/embedded/include',
|
183
|
+
'LDFLAGS' => '-L/opt/project/embedded/lib',
|
184
|
+
'LD_RUN_PATH' => '/opt/project/embedded/lib',
|
185
|
+
'PKG_CONFIG_PATH' => '/opt/project/embedded/lib/pkgconfig',
|
186
|
+
)
|
187
|
+
end
|
188
|
+
end
|
161
189
|
end
|
190
|
+
|
162
191
|
end
|
163
192
|
|
164
193
|
describe 'path helpers' do
|
194
|
+
|
165
195
|
before do
|
166
196
|
stub_const('File::PATH_SEPARATOR', separator)
|
167
197
|
stub_env('PATH', path)
|
198
|
+
allow(project).to receive(:install_dir).and_return(install_dir)
|
168
199
|
end
|
169
200
|
|
170
|
-
|
201
|
+
let(:prepended_path) do
|
202
|
+
["#{install_dir}/bin", separator, "#{install_dir}/embedded/bin", separator, path].join
|
203
|
+
end
|
204
|
+
|
205
|
+
context 'on *Nix' do
|
171
206
|
let(:separator) { ':' }
|
172
207
|
let(:path) { '/usr/local/bin:/usr/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin' }
|
208
|
+
let(:install_dir) { '/opt/project' }
|
173
209
|
|
174
210
|
it 'prepends a path to PATH' do
|
175
211
|
expect(subject.prepend_path('/foo/bar')).to eq(
|
176
|
-
'/foo/bar
|
212
|
+
['/foo/bar', separator, path].join
|
177
213
|
)
|
178
214
|
end
|
179
215
|
|
180
216
|
it 'prepends the embedded bin to PATH' do
|
181
217
|
expect(subject.with_embedded_path).to eq(
|
182
|
-
'PATH' =>
|
218
|
+
'PATH' => prepended_path
|
183
219
|
)
|
184
220
|
end
|
185
221
|
|
186
222
|
it 'with_embedded_path merges with a hash argument' do
|
187
223
|
expect(subject.with_embedded_path('numberwang' => 4)).to eq(
|
188
224
|
'numberwang' => 4,
|
189
|
-
'PATH' =>
|
225
|
+
'PATH' => prepended_path
|
190
226
|
)
|
191
227
|
end
|
192
228
|
|
193
229
|
it 'prepends multiple paths to PATH' do
|
194
230
|
expect(subject.prepend_path('/foo/bar', '/foo/baz')).to eq(
|
195
|
-
'/foo/bar
|
231
|
+
['/foo/bar', separator, '/foo/baz', separator, path].join
|
196
232
|
)
|
197
233
|
end
|
198
234
|
end
|
@@ -200,37 +236,31 @@ module Omnibus
|
|
200
236
|
context 'on Windows' do
|
201
237
|
before do
|
202
238
|
stub_ohai(platform: 'windows', version: '2012')
|
203
|
-
allow(project).to receive(:install_dir).and_return('c:/opt/project')
|
204
|
-
stub_env('Path', windows_path)
|
205
239
|
end
|
206
240
|
|
207
241
|
let(:separator) { ';' }
|
208
242
|
let(:path) { 'c:/Ruby193/bin;c:/Windows/system32;c:/Windows;c:/Windows/System32/Wbem' }
|
209
|
-
let(:
|
210
|
-
|
211
|
-
it "prepends a path to PATH" do
|
212
|
-
expect(subject.prepend_path('c:/foo/bar')).to eq(
|
213
|
-
'c:/foo/bar;c:/Ruby999/bin;c:/Windows/system32;c:/Windows;c:/Windows/System32/Wbem'
|
214
|
-
)
|
215
|
-
end
|
243
|
+
let(:install_dir) { 'c:/opt/project' }
|
216
244
|
|
217
|
-
|
218
|
-
|
219
|
-
'Path'
|
220
|
-
|
221
|
-
|
245
|
+
context '`Path` exists in the environment' do
|
246
|
+
before do
|
247
|
+
stub_env('Path', path)
|
248
|
+
allow(ENV).to receive(:keys).and_return(%w( Path PATH ))
|
249
|
+
end
|
222
250
|
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
251
|
+
it 'returns a path key of `Path`' do
|
252
|
+
expect(subject.with_embedded_path).to eq(
|
253
|
+
'Path' => prepended_path
|
254
|
+
)
|
255
|
+
end
|
228
256
|
end
|
229
257
|
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
258
|
+
context '`Path` does not exist in the environment' do
|
259
|
+
it 'returns a path key of `PATH`' do
|
260
|
+
expect(subject.with_embedded_path).to eq(
|
261
|
+
'PATH' => prepended_path
|
262
|
+
)
|
263
|
+
end
|
234
264
|
end
|
235
265
|
end
|
236
266
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omnibus
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.0.0.rc.
|
4
|
+
version: 4.0.0.rc.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chef Software, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: chef-sugar
|
@@ -320,6 +320,7 @@ files:
|
|
320
320
|
- resources/dmg/icon.png
|
321
321
|
- resources/makeself/makeself-header.sh
|
322
322
|
- resources/makeself/makeself.sh
|
323
|
+
- resources/makeself/makeselfinst.erb
|
323
324
|
- resources/msi/assets/LICENSE.rtf
|
324
325
|
- resources/msi/assets/banner_background.bmp
|
325
326
|
- resources/msi/assets/dialog_background.bmp
|