omnibus 7.0.34 → 8.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -2
- data/lib/omnibus/builder.rb +57 -17
- data/lib/omnibus/compressors/dmg.rb +5 -2
- data/lib/omnibus/manifest_diff.rb +7 -13
- data/lib/omnibus/metadata.rb +7 -3
- data/lib/omnibus/packager.rb +5 -14
- data/lib/omnibus/packagers/pkg.rb +14 -4
- data/lib/omnibus/packagers/rpm.rb +23 -9
- data/lib/omnibus/software.rb +3 -14
- data/lib/omnibus/sugarable.rb +5 -14
- data/lib/omnibus/version.rb +1 -1
- data/lib/omnibus/whitelist.rb +1 -0
- data/omnibus.gemspec +6 -5
- data/resources/msi/CustomActionFastMsi.CA.dll +0 -0
- data/resources/msi/source.wxs.erb +2 -10
- data/resources/pkg/distribution.xml.erb +1 -1
- data/resources/rpm/spec.erb +2 -2
- data/spec/functional/fetchers/net_fetcher_spec.rb +2 -11
- data/spec/unit/builder_spec.rb +6 -0
- data/spec/unit/compressor_spec.rb +2 -2
- data/spec/unit/compressors/dmg_spec.rb +12 -9
- data/spec/unit/compressors/tgz_spec.rb +4 -4
- data/spec/unit/fetchers/net_fetcher_spec.rb +5 -1
- data/spec/unit/metadata_spec.rb +8 -6
- data/spec/unit/packager_spec.rb +7 -14
- data/spec/unit/packagers/pkg_spec.rb +20 -4
- data/spec/unit/packagers/rpm_spec.rb +15 -5
- data/spec/unit/project_spec.rb +6 -6
- data/spec/unit/software_spec.rb +29 -120
- metadata +39 -13
@@ -3,8 +3,8 @@ require "spec_helper"
|
|
3
3
|
module Omnibus
|
4
4
|
describe Compressor do
|
5
5
|
describe ".for_current_system" do
|
6
|
-
context "on
|
7
|
-
before { stub_ohai(platform: "mac_os_x"
|
6
|
+
context "on macOS" do
|
7
|
+
before { stub_ohai(platform: "mac_os_x") }
|
8
8
|
|
9
9
|
context "when :dmg is activated" do
|
10
10
|
it "prefers dmg" do
|
@@ -190,7 +190,7 @@ module Omnibus
|
|
190
190
|
|
191
191
|
expect(contents).to include('set found_disk to do shell script "ls /Volumes/ | grep \'Project One*\'"')
|
192
192
|
expect(contents).to include(" set the bounds of Finder window 1 to {100, 100, 750, 600}")
|
193
|
-
expect(contents).to include(' set position of item "project-1.2.3-2.pkg" of container window to {535, 50}')
|
193
|
+
expect(contents).to include(' set position of item "project-1.2.3-2.x86_64.pkg" of container window to {535, 50}')
|
194
194
|
end
|
195
195
|
|
196
196
|
it "runs the apple script" do
|
@@ -219,14 +219,17 @@ module Omnibus
|
|
219
219
|
sync
|
220
220
|
hdiutil unmount "#{device}"
|
221
221
|
# Give some time to the system so unmount dmg
|
222
|
-
|
223
|
-
hdiutil detach "
|
222
|
+
ATTEMPTS=1
|
223
|
+
until [ $ATTEMPTS -eq 6 ] || hdiutil detach "/dev/sda1"; do
|
224
|
+
sleep 10
|
225
|
+
echo Attempt number $(( ATTEMPTS++ ))
|
226
|
+
done
|
224
227
|
hdiutil convert \\
|
225
228
|
"#{staging_dir}/project-writable.dmg" \\
|
226
229
|
-format UDZO \\
|
227
230
|
-imagekey \\
|
228
231
|
zlib-level=9 \\
|
229
|
-
-o "#{package_dir}/project-1.2.3-2.dmg" \\
|
232
|
+
-o "#{package_dir}/project-1.2.3-2.x86_64.dmg" \\
|
230
233
|
-puppetstrings
|
231
234
|
EOH
|
232
235
|
|
@@ -244,7 +247,7 @@ module Omnibus
|
|
244
247
|
expect(subject).to receive(:shellout!)
|
245
248
|
.with <<-EOH.gsub(/^ {12}/, "")
|
246
249
|
hdiutil verify \\
|
247
|
-
"#{package_dir}/project-1.2.3-2.dmg" \\
|
250
|
+
"#{package_dir}/project-1.2.3-2.x86_64.dmg" \\
|
248
251
|
-puppetstrings
|
249
252
|
EOH
|
250
253
|
|
@@ -286,10 +289,10 @@ module Omnibus
|
|
286
289
|
DeRez -only icns "#{icon}" > tmp.rsrc
|
287
290
|
|
288
291
|
# Append the icon reosurce to the DMG
|
289
|
-
Rez -append tmp.rsrc -o "#{package_dir}/project-1.2.3-2.dmg"
|
292
|
+
Rez -append tmp.rsrc -o "#{package_dir}/project-1.2.3-2.x86_64.dmg"
|
290
293
|
|
291
294
|
# Source the icon
|
292
|
-
SetFile -a C "#{package_dir}/project-1.2.3-2.dmg"
|
295
|
+
SetFile -a C "#{package_dir}/project-1.2.3-2.x86_64.dmg"
|
293
296
|
EOH
|
294
297
|
|
295
298
|
subject.set_dmg_icon
|
@@ -298,11 +301,11 @@ module Omnibus
|
|
298
301
|
|
299
302
|
describe "#package_name" do
|
300
303
|
it "reflects the packager's unmodified package_name" do
|
301
|
-
expect(subject.package_name).to eq("project-1.2.3-2.dmg")
|
304
|
+
expect(subject.package_name).to eq("project-1.2.3-2.x86_64.dmg")
|
302
305
|
end
|
303
306
|
|
304
307
|
it "reflects the packager's modified package_name" do
|
305
|
-
package_basename = "projectsub-1.2.3-3"
|
308
|
+
package_basename = "projectsub-1.2.3-3.x86_64"
|
306
309
|
allow(project.packagers_for_system[0]).to receive(:package_name)
|
307
310
|
.and_return("#{package_basename}.pkg")
|
308
311
|
|
@@ -38,25 +38,25 @@ module Omnibus
|
|
38
38
|
|
39
39
|
describe "#package_name" do
|
40
40
|
it "returns the name of the packager" do
|
41
|
-
expect(subject.package_name).to eq("project-1.2.3-2.pkg.tar.gz")
|
41
|
+
expect(subject.package_name).to eq("project-1.2.3-2.x86_64.pkg.tar.gz")
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
45
45
|
describe "#write_tgz" do
|
46
46
|
before do
|
47
|
-
File.open("#{staging_dir}/project-1.2.3-2.pkg", "wb") do |f|
|
47
|
+
File.open("#{staging_dir}/project-1.2.3-2.x86_64.pkg", "wb") do |f|
|
48
48
|
f.write " " * 1_000_000
|
49
49
|
end
|
50
50
|
end
|
51
51
|
|
52
52
|
it "generates the file" do
|
53
53
|
subject.write_tgz
|
54
|
-
expect("#{staging_dir}/project-1.2.3-2.pkg.tar.gz").to be_a_file
|
54
|
+
expect("#{staging_dir}/project-1.2.3-2.x86_64.pkg.tar.gz").to be_a_file
|
55
55
|
end
|
56
56
|
|
57
57
|
it "has the correct content" do
|
58
58
|
subject.write_tgz
|
59
|
-
file = File.open("#{staging_dir}/project-1.2.3-2.pkg.tar.gz", "rb")
|
59
|
+
file = File.open("#{staging_dir}/project-1.2.3-2.x86_64.pkg.tar.gz", "rb")
|
60
60
|
contents = file.read
|
61
61
|
file.close
|
62
62
|
|
@@ -278,6 +278,10 @@ module Omnibus
|
|
278
278
|
|
279
279
|
let(:cumulative_downloaded_length) { 100 }
|
280
280
|
|
281
|
+
let(:uri_open_target) do
|
282
|
+
RUBY_VERSION.to_f < 2.7 ? subject : URI
|
283
|
+
end
|
284
|
+
|
281
285
|
def capturing_stdout
|
282
286
|
old_stdout, $stdout = $stdout, progress_bar_output
|
283
287
|
yield
|
@@ -286,7 +290,7 @@ module Omnibus
|
|
286
290
|
end
|
287
291
|
|
288
292
|
before do
|
289
|
-
expect(
|
293
|
+
expect(uri_open_target).to receive(:open).with(source[:url], expected_open_opts) do |_url, open_uri_opts|
|
290
294
|
open_uri_opts[:content_length_proc].call(reported_content_length)
|
291
295
|
open_uri_opts[:progress_proc].call(cumulative_downloaded_length)
|
292
296
|
|
data/spec/unit/metadata_spec.rb
CHANGED
@@ -177,17 +177,17 @@ module Omnibus
|
|
177
177
|
|
178
178
|
describe ".platform_shortname" do
|
179
179
|
it "returns el on rhel" do
|
180
|
-
stub_ohai(platform: "redhat", version: "6
|
180
|
+
stub_ohai(platform: "redhat", version: "6")
|
181
181
|
expect(described_class.platform_shortname).to eq("el")
|
182
182
|
end
|
183
183
|
|
184
184
|
it "returns sles on suse" do
|
185
|
-
stub_ohai(platform: "suse", version: "12
|
185
|
+
stub_ohai(platform: "suse", version: "12")
|
186
186
|
expect(described_class.platform_shortname).to eq("sles")
|
187
187
|
end
|
188
188
|
|
189
189
|
it "returns .platform on all other systems" do
|
190
|
-
stub_ohai(platform: "ubuntu", version: "
|
190
|
+
stub_ohai(platform: "ubuntu", version: "20.04")
|
191
191
|
expect(described_class.platform_shortname).to eq("ubuntu")
|
192
192
|
end
|
193
193
|
end
|
@@ -196,7 +196,7 @@ module Omnibus
|
|
196
196
|
shared_examples "a version manipulator" do |platform_shortname, version, expected|
|
197
197
|
context "on #{platform_shortname}-#{version}" do
|
198
198
|
it "returns the correct value" do
|
199
|
-
stub_ohai(platform: "ubuntu", version: "
|
199
|
+
stub_ohai(platform: "ubuntu", version: "20.04") do |data|
|
200
200
|
data["platform"] = platform_shortname
|
201
201
|
data["platform_version"] = version
|
202
202
|
end
|
@@ -218,6 +218,8 @@ module Omnibus
|
|
218
218
|
it_behaves_like "a version manipulator", "gentoo", "4.9.95-gentoo", "rolling"
|
219
219
|
it_behaves_like "a version manipulator", "kali", "rolling", "rolling"
|
220
220
|
it_behaves_like "a version manipulator", "mac_os_x", "10.9.1", "10.9"
|
221
|
+
it_behaves_like "a version manipulator", "mac_os_x", "10.15.7", "10.15"
|
222
|
+
it_behaves_like "a version manipulator", "mac_os_x", "11.2.1", "11"
|
221
223
|
it_behaves_like "a version manipulator", "omnios", "r151010", "r151010"
|
222
224
|
it_behaves_like "a version manipulator", "openbsd", "5.4.4", "5.4"
|
223
225
|
it_behaves_like "a version manipulator", "opensuseleap", "42.3", "42.3"
|
@@ -245,7 +247,7 @@ module Omnibus
|
|
245
247
|
|
246
248
|
context "given an unknown platform" do
|
247
249
|
before do
|
248
|
-
stub_ohai(platform: "ubuntu", version: "
|
250
|
+
stub_ohai(platform: "ubuntu", version: "20.04") do |data|
|
249
251
|
data["platform"] = "bacon"
|
250
252
|
data["platform_version"] = "1.crispy"
|
251
253
|
end
|
@@ -259,7 +261,7 @@ module Omnibus
|
|
259
261
|
|
260
262
|
context "given an unknown windows platform version" do
|
261
263
|
before do
|
262
|
-
stub_ohai(platform: "ubuntu", version: "
|
264
|
+
stub_ohai(platform: "ubuntu", version: "20.04") do |data|
|
263
265
|
data["platform"] = "windows"
|
264
266
|
data["platform_version"] = "1.2.3"
|
265
267
|
end
|
data/spec/unit/packager_spec.rb
CHANGED
@@ -3,27 +3,20 @@ require "spec_helper"
|
|
3
3
|
module Omnibus
|
4
4
|
describe Packager do
|
5
5
|
describe ".for_current_system" do
|
6
|
-
context "on
|
7
|
-
before { stub_ohai(platform: "mac_os_x"
|
6
|
+
context "on macOS" do
|
7
|
+
before { stub_ohai(platform: "mac_os_x") }
|
8
8
|
it "prefers PKG" do
|
9
9
|
expect(described_class.for_current_system).to eq([Packager::PKG])
|
10
10
|
end
|
11
11
|
end
|
12
12
|
|
13
|
-
context "on Windows
|
13
|
+
context "on Windows" do
|
14
14
|
before { stub_ohai(platform: "windows", version: "2012R2") }
|
15
15
|
it "prefers MSI and APPX" do
|
16
16
|
expect(described_class.for_current_system).to eq([Packager::MSI, Packager::APPX])
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
context "on Windows 2008 R2" do
|
21
|
-
before { stub_ohai(platform: "windows", version: "2008R2") }
|
22
|
-
it "prefers MSI only" do
|
23
|
-
expect(described_class.for_current_system).to eq([Packager::MSI])
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
20
|
context "on Solaris 11" do
|
28
21
|
before { stub_ohai(platform: "solaris2", version: "5.11") }
|
29
22
|
it "prefers IPS" do
|
@@ -32,14 +25,14 @@ module Omnibus
|
|
32
25
|
end
|
33
26
|
|
34
27
|
context "on AIX" do
|
35
|
-
before { stub_ohai(platform: "aix", version: "7
|
28
|
+
before { stub_ohai(platform: "aix", version: "7") }
|
36
29
|
it "prefers BFF" do
|
37
30
|
expect(described_class.for_current_system).to eq([Packager::BFF])
|
38
31
|
end
|
39
32
|
end
|
40
33
|
|
41
34
|
context "on Fedora" do
|
42
|
-
before { stub_ohai(platform: "fedora", version: "
|
35
|
+
before { stub_ohai(platform: "fedora", version: "31") }
|
43
36
|
it "prefers RPM" do
|
44
37
|
expect(described_class.for_current_system).to eq([Packager::RPM])
|
45
38
|
end
|
@@ -53,14 +46,14 @@ module Omnibus
|
|
53
46
|
end
|
54
47
|
|
55
48
|
context "on Debian" do
|
56
|
-
before { stub_ohai(platform: "debian", version: "
|
49
|
+
before { stub_ohai(platform: "debian", version: "10") }
|
57
50
|
it "prefers RPM" do
|
58
51
|
expect(described_class.for_current_system).to eq([Packager::DEB])
|
59
52
|
end
|
60
53
|
end
|
61
54
|
|
62
55
|
context "on SLES" do
|
63
|
-
before { stub_ohai(platform: "suse", version: "
|
56
|
+
before { stub_ohai(platform: "suse", version: "15") }
|
64
57
|
it "prefers RPM" do
|
65
58
|
expect(described_class.for_current_system).to eq([Packager::RPM])
|
66
59
|
end
|
@@ -47,8 +47,8 @@ module Omnibus
|
|
47
47
|
end
|
48
48
|
|
49
49
|
describe "#package_name" do
|
50
|
-
it "includes the name, version,
|
51
|
-
expect(subject.package_name).to eq("project-full-name-1.2.3-2.pkg")
|
50
|
+
it "includes the name, version, build iteration, and architecture" do
|
51
|
+
expect(subject.package_name).to eq("project-full-name-1.2.3-2.x86_64.pkg")
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -290,8 +290,24 @@ module Omnibus
|
|
290
290
|
|
291
291
|
expect(contents).to include('<pkg-ref id="com.getchef.project-full-name"/>')
|
292
292
|
expect(contents).to include('<line choice="com.getchef.project-full-name"/>')
|
293
|
+
expect(contents).to include('hostArchitectures="x86_64"')
|
293
294
|
expect(contents).to include("project-full-name-core.pkg")
|
294
295
|
end
|
296
|
+
|
297
|
+
context "for arm64 builds" do
|
298
|
+
before do
|
299
|
+
stub_ohai(platform: "mac_os_x", version: "11.0") do |data|
|
300
|
+
data["kernel"]["machine"] = "arm64"
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
it "sets the hostArchitectures to include arm64" do
|
305
|
+
subject.write_distribution_file
|
306
|
+
contents = File.read("#{staging_dir}/Distribution")
|
307
|
+
|
308
|
+
expect(contents).to include('hostArchitectures="arm64"')
|
309
|
+
end
|
310
|
+
end
|
295
311
|
end
|
296
312
|
|
297
313
|
describe "#build_product_pkg" do
|
@@ -301,7 +317,7 @@ module Omnibus
|
|
301
317
|
productbuild \\
|
302
318
|
--distribution "#{staging_dir}/Distribution" \\
|
303
319
|
--resources "#{staging_dir}/Resources" \\
|
304
|
-
"#{package_dir}/project-full-name-1.2.3-2.pkg"
|
320
|
+
"#{package_dir}/project-full-name-1.2.3-2.x86_64.pkg"
|
305
321
|
EOH
|
306
322
|
|
307
323
|
subject.build_product_pkg
|
@@ -319,7 +335,7 @@ module Omnibus
|
|
319
335
|
--distribution "#{staging_dir}/Distribution" \\
|
320
336
|
--resources "#{staging_dir}/Resources" \\
|
321
337
|
--sign "My Special Identity" \\
|
322
|
-
"#{package_dir}/project-full-name-1.2.3-2.pkg"
|
338
|
+
"#{package_dir}/project-full-name-1.2.3-2.x86_64.pkg"
|
323
339
|
EOH
|
324
340
|
subject.build_product_pkg
|
325
341
|
end
|
@@ -35,7 +35,7 @@ module Omnibus
|
|
35
35
|
create_directory("#{staging_dir}/SOURCES")
|
36
36
|
create_directory("#{staging_dir}/SPECS")
|
37
37
|
|
38
|
-
stub_ohai(platform: "redhat", version: "6
|
38
|
+
stub_ohai(platform: "redhat", version: "6") do |data|
|
39
39
|
data["kernel"]["machine"] = architecture
|
40
40
|
end
|
41
41
|
end
|
@@ -404,6 +404,16 @@ module Omnibus
|
|
404
404
|
end
|
405
405
|
end
|
406
406
|
|
407
|
+
describe "#rpm_file" do
|
408
|
+
before do
|
409
|
+
allow(subject).to receive(:package_name).and_return("package_name.rpm")
|
410
|
+
end
|
411
|
+
|
412
|
+
it "includes the package_name rpm" do
|
413
|
+
expect(subject.rpm_file).to eq("#{staging_dir}/RPMS/#{architecture}/package_name.rpm")
|
414
|
+
end
|
415
|
+
end
|
416
|
+
|
407
417
|
describe "#rpm_safe" do
|
408
418
|
it "adds quotes when required" do
|
409
419
|
expect(subject.rpm_safe("file path")).to eq('"file path"')
|
@@ -488,7 +498,7 @@ module Omnibus
|
|
488
498
|
|
489
499
|
describe "#safe_architecture" do
|
490
500
|
before do
|
491
|
-
stub_ohai(platform: "redhat", version: "6
|
501
|
+
stub_ohai(platform: "redhat", version: "6") do |data|
|
492
502
|
data["kernel"]["machine"] = "i386"
|
493
503
|
end
|
494
504
|
end
|
@@ -499,7 +509,7 @@ module Omnibus
|
|
499
509
|
|
500
510
|
context "when i686" do
|
501
511
|
before do
|
502
|
-
stub_ohai(platform: "redhat", version: "6
|
512
|
+
stub_ohai(platform: "redhat", version: "6") do |data|
|
503
513
|
data["kernel"]["machine"] = "i686"
|
504
514
|
end
|
505
515
|
end
|
@@ -512,9 +522,9 @@ module Omnibus
|
|
512
522
|
context "on Pidora" do
|
513
523
|
before do
|
514
524
|
# There's no Pidora in Fauxhai :(
|
515
|
-
stub_ohai(platform: "fedora", version: "
|
525
|
+
stub_ohai(platform: "fedora", version: "32") do |data|
|
516
526
|
data["platform"] = "pidora"
|
517
|
-
data["platform_version"] = "
|
527
|
+
data["platform_version"] = "32"
|
518
528
|
data["kernel"]["machine"] = "armv6l"
|
519
529
|
end
|
520
530
|
end
|
data/spec/unit/project_spec.rb
CHANGED
@@ -207,36 +207,36 @@ module Omnibus
|
|
207
207
|
before { stub_ohai(fauxhai_options) }
|
208
208
|
|
209
209
|
context "when on RHEL" do
|
210
|
-
let(:fauxhai_options) { { platform: "redhat", version: "
|
210
|
+
let(:fauxhai_options) { { platform: "redhat", version: "8" } }
|
211
211
|
it "returns a RHEL iteration" do
|
212
212
|
expect(subject.build_iteration).to eq(1)
|
213
213
|
end
|
214
214
|
end
|
215
215
|
|
216
216
|
context "when on Debian" do
|
217
|
-
let(:fauxhai_options) { { platform: "debian", version: "
|
217
|
+
let(:fauxhai_options) { { platform: "debian", version: "10" } }
|
218
218
|
it "returns a Debian iteration" do
|
219
219
|
expect(subject.build_iteration).to eq(1)
|
220
220
|
end
|
221
221
|
end
|
222
222
|
|
223
223
|
context "when on FreeBSD" do
|
224
|
-
let(:fauxhai_options) { { platform: "freebsd", version: "
|
224
|
+
let(:fauxhai_options) { { platform: "freebsd", version: "12" } }
|
225
225
|
it "returns a FreeBSD iteration" do
|
226
226
|
expect(subject.build_iteration).to eq(1)
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
230
230
|
context "when on Windows" do
|
231
|
-
before { stub_ohai(platform: "windows", version: "
|
231
|
+
before { stub_ohai(platform: "windows", version: "2019") }
|
232
232
|
before { stub_const("File::ALT_SEPARATOR", '\\') }
|
233
233
|
it "returns a Windows iteration" do
|
234
234
|
expect(subject.build_iteration).to eq(1)
|
235
235
|
end
|
236
236
|
end
|
237
237
|
|
238
|
-
context "when on
|
239
|
-
let(:fauxhai_options) { { platform: "mac_os_x"
|
238
|
+
context "when on macOS" do
|
239
|
+
let(:fauxhai_options) { { platform: "mac_os_x" } }
|
240
240
|
it "returns a generic iteration" do
|
241
241
|
expect(subject.build_iteration).to eq(1)
|
242
242
|
end
|
data/spec/unit/software_spec.rb
CHANGED
@@ -73,9 +73,9 @@ module Omnibus
|
|
73
73
|
it "sets the defaults" do
|
74
74
|
expect(subject.with_standard_compiler_flags).to eq(
|
75
75
|
"LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
|
76
|
-
"CFLAGS" => "-I/opt/project/embedded/include -
|
77
|
-
"CXXFLAGS" => "-I/opt/project/embedded/include -
|
78
|
-
"CPPFLAGS" => "-I/opt/project/embedded/include -
|
76
|
+
"CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
77
|
+
"CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
78
|
+
"CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
79
79
|
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
80
80
|
"PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
|
81
81
|
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
@@ -84,9 +84,9 @@ module Omnibus
|
|
84
84
|
it "overrides LDFLAGS" do
|
85
85
|
expect(subject.with_standard_compiler_flags("LDFLAGS" => "foo")).to eq(
|
86
86
|
"LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
|
87
|
-
"CFLAGS" => "-I/opt/project/embedded/include -
|
88
|
-
"CXXFLAGS" => "-I/opt/project/embedded/include -
|
89
|
-
"CPPFLAGS" => "-I/opt/project/embedded/include -
|
87
|
+
"CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
88
|
+
"CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
89
|
+
"CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
90
90
|
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
91
91
|
"PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
|
92
92
|
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
@@ -95,9 +95,9 @@ module Omnibus
|
|
95
95
|
it "overrides CFLAGS" do
|
96
96
|
expect(subject.with_standard_compiler_flags("CFLAGS" => "foo")).to eq(
|
97
97
|
"LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
|
98
|
-
"CFLAGS" => "-I/opt/project/embedded/include -
|
99
|
-
"CXXFLAGS" => "-I/opt/project/embedded/include -
|
100
|
-
"CPPFLAGS" => "-I/opt/project/embedded/include -
|
98
|
+
"CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
99
|
+
"CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
100
|
+
"CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
101
101
|
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
102
102
|
"PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
|
103
103
|
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
@@ -106,9 +106,9 @@ module Omnibus
|
|
106
106
|
it "overrides CXXFLAGS" do
|
107
107
|
expect(subject.with_standard_compiler_flags("CXXFLAGS" => "foo")).to eq(
|
108
108
|
"LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
|
109
|
-
"CFLAGS" => "-I/opt/project/embedded/include -
|
110
|
-
"CXXFLAGS" => "-I/opt/project/embedded/include -
|
111
|
-
"CPPFLAGS" => "-I/opt/project/embedded/include -
|
109
|
+
"CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
110
|
+
"CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
111
|
+
"CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
112
112
|
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
113
113
|
"PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
|
114
114
|
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
@@ -117,9 +117,9 @@ module Omnibus
|
|
117
117
|
it "overrides CPPFLAGS" do
|
118
118
|
expect(subject.with_standard_compiler_flags("CPPFLAGS" => "foo")).to eq(
|
119
119
|
"LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
|
120
|
-
"CFLAGS" => "-I/opt/project/embedded/include -
|
121
|
-
"CXXFLAGS" => "-I/opt/project/embedded/include -
|
122
|
-
"CPPFLAGS" => "-I/opt/project/embedded/include -
|
120
|
+
"CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
121
|
+
"CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
122
|
+
"CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
123
123
|
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
124
124
|
"PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
|
125
125
|
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
@@ -129,9 +129,9 @@ module Omnibus
|
|
129
129
|
expect(subject.with_standard_compiler_flags("numberwang" => 4)).to eq(
|
130
130
|
"numberwang" => 4,
|
131
131
|
"LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
|
132
|
-
"CFLAGS" => "-I/opt/project/embedded/include -
|
133
|
-
"CXXFLAGS" => "-I/opt/project/embedded/include -
|
134
|
-
"CPPFLAGS" => "-I/opt/project/embedded/include -
|
132
|
+
"CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
133
|
+
"CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
134
|
+
"CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
135
135
|
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
136
136
|
"PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
|
137
137
|
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
@@ -191,14 +191,14 @@ module Omnibus
|
|
191
191
|
end
|
192
192
|
|
193
193
|
context "on mac_os_x" do
|
194
|
-
before { stub_ohai(platform: "mac_os_x", version: "10.
|
194
|
+
before { stub_ohai(platform: "mac_os_x", version: "10.15") }
|
195
195
|
|
196
196
|
it "sets the defaults" do
|
197
197
|
expect(subject.with_standard_compiler_flags).to eq(
|
198
198
|
"LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
|
199
|
-
"CFLAGS" => "-I/opt/project/embedded/include -
|
200
|
-
"CXXFLAGS" => "-I/opt/project/embedded/include -
|
201
|
-
"CPPFLAGS" => "-I/opt/project/embedded/include -
|
199
|
+
"CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
200
|
+
"CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
201
|
+
"CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
202
202
|
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
203
203
|
"PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
|
204
204
|
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
@@ -207,12 +207,7 @@ module Omnibus
|
|
207
207
|
end
|
208
208
|
|
209
209
|
context "on aix" do
|
210
|
-
before
|
211
|
-
# There's no AIX in Fauxhai :(
|
212
|
-
stub_ohai(platform: "solaris2", version: "5.11") do |data|
|
213
|
-
data["platform"] = "aix"
|
214
|
-
end
|
215
|
-
end
|
210
|
+
before { stub_ohai(platform: "aix") }
|
216
211
|
|
217
212
|
it "sets the defaults" do
|
218
213
|
expect(subject.with_standard_compiler_flags).to eq(
|
@@ -232,17 +227,17 @@ module Omnibus
|
|
232
227
|
end
|
233
228
|
end
|
234
229
|
|
235
|
-
context "on freebsd
|
230
|
+
context "on freebsd" do
|
236
231
|
before do
|
237
|
-
stub_ohai(platform: "freebsd", version: "
|
232
|
+
stub_ohai(platform: "freebsd", version: "12.1")
|
238
233
|
end
|
239
234
|
|
240
235
|
it "sets the defaults" do
|
241
236
|
expect(subject.with_standard_compiler_flags).to eq(
|
242
237
|
"CC" => "clang",
|
243
|
-
"CFLAGS" => "-I/opt/project/embedded/include -
|
244
|
-
"CXXFLAGS" => "-I/opt/project/embedded/include -
|
245
|
-
"CPPFLAGS" => "-I/opt/project/embedded/include -
|
238
|
+
"CFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
239
|
+
"CXXFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
240
|
+
"CPPFLAGS" => "-I/opt/project/embedded/include -O3 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
246
241
|
"CXX" => "clang++",
|
247
242
|
"LDFLAGS" => "-L/opt/project/embedded/lib",
|
248
243
|
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
@@ -250,95 +245,9 @@ module Omnibus
|
|
250
245
|
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
251
246
|
)
|
252
247
|
end
|
253
|
-
|
254
|
-
context "with gcc 4.9 installed" do
|
255
|
-
before do
|
256
|
-
allow(subject).to receive(:which).and_return("/usr/local/bin/gcc49")
|
257
|
-
end
|
258
|
-
end
|
259
248
|
end
|
260
249
|
|
261
|
-
context "on
|
262
|
-
before do
|
263
|
-
stub_ohai(platform: "freebsd", version: "10.4")
|
264
|
-
end
|
265
|
-
|
266
|
-
it "Clang as the default compiler" do
|
267
|
-
expect(subject.with_standard_compiler_flags).to eq(
|
268
|
-
"CC" => "clang",
|
269
|
-
"CXX" => "clang++",
|
270
|
-
"CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
271
|
-
"CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
272
|
-
"CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
273
|
-
"LDFLAGS" => "-L/opt/project/embedded/lib",
|
274
|
-
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
275
|
-
"PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
|
276
|
-
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
277
|
-
)
|
278
|
-
end
|
279
|
-
end
|
280
|
-
|
281
|
-
context "on sles 11" do
|
282
|
-
before do
|
283
|
-
# sles identifies as suse
|
284
|
-
stub_ohai(platform: "suse", version: "11.4")
|
285
|
-
allow(subject).to receive(:which).with("gcc-4.8").and_return(false)
|
286
|
-
end
|
287
|
-
it "sets the defaults" do
|
288
|
-
expect(subject.with_standard_compiler_flags).to eq(
|
289
|
-
"LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
|
290
|
-
"CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
291
|
-
"CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
292
|
-
"CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
293
|
-
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
294
|
-
"PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
|
295
|
-
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
296
|
-
)
|
297
|
-
end
|
298
|
-
|
299
|
-
context "with gcc 4.8 installed" do
|
300
|
-
|
301
|
-
before do
|
302
|
-
allow(subject).to receive(:which).and_return("/usr/bin/gcc-4.8")
|
303
|
-
end
|
304
|
-
|
305
|
-
it "sets the compiler args" do
|
306
|
-
expect(subject.with_standard_compiler_flags).to eq(
|
307
|
-
"CC" => "gcc-4.8",
|
308
|
-
"CXX" => "g++-4.8",
|
309
|
-
"LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
|
310
|
-
"CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
311
|
-
"CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
312
|
-
"CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
313
|
-
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
314
|
-
"PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
|
315
|
-
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
316
|
-
)
|
317
|
-
end
|
318
|
-
end
|
319
|
-
end
|
320
|
-
|
321
|
-
context "on sles 12" do
|
322
|
-
before do
|
323
|
-
# sles identifies as suse
|
324
|
-
stub_ohai(platform: "suse", version: "12.2")
|
325
|
-
allow(subject).to receive(:which).with("gcc-4.8").and_return(true)
|
326
|
-
end
|
327
|
-
|
328
|
-
it "sets the defaults" do
|
329
|
-
expect(subject.with_standard_compiler_flags).to eq(
|
330
|
-
"LDFLAGS" => "-Wl,-rpath,/opt/project/embedded/lib -L/opt/project/embedded/lib",
|
331
|
-
"CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
332
|
-
"CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
333
|
-
"CPPFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
|
334
|
-
"LD_RUN_PATH" => "/opt/project/embedded/lib",
|
335
|
-
"PKG_CONFIG_PATH" => "/opt/project/embedded/lib/pkgconfig",
|
336
|
-
"OMNIBUS_INSTALL_DIR" => "/opt/project"
|
337
|
-
)
|
338
|
-
end
|
339
|
-
end
|
340
|
-
|
341
|
-
context "on Windows" do
|
250
|
+
context "on windows" do
|
342
251
|
let(:win_arch_i386) { true }
|
343
252
|
|
344
253
|
before do
|