omnibus 6.1.7 → 8.0.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (104) hide show
  1. checksums.yaml +4 -4
  2. data/Gemfile +0 -4
  3. data/README.md +54 -12
  4. data/Rakefile +1 -1
  5. data/bin/omnibus +1 -1
  6. data/lib/omnibus.rb +2 -2
  7. data/lib/omnibus/build_version.rb +1 -1
  8. data/lib/omnibus/build_version_dsl.rb +6 -7
  9. data/lib/omnibus/builder.rb +10 -9
  10. data/lib/omnibus/changelog_printer.rb +7 -4
  11. data/lib/omnibus/cleaner.rb +4 -1
  12. data/lib/omnibus/cli.rb +2 -2
  13. data/lib/omnibus/cli/changelog.rb +25 -25
  14. data/lib/omnibus/compressor.rb +2 -2
  15. data/lib/omnibus/compressors/base.rb +2 -2
  16. data/lib/omnibus/compressors/dmg.rb +8 -6
  17. data/lib/omnibus/compressors/tgz.rb +2 -2
  18. data/lib/omnibus/config.rb +13 -3
  19. data/lib/omnibus/core_extensions/open_uri.rb +1 -1
  20. data/lib/omnibus/digestable.rb +2 -2
  21. data/lib/omnibus/download_helpers.rb +6 -2
  22. data/lib/omnibus/fetchers/file_fetcher.rb +1 -1
  23. data/lib/omnibus/fetchers/git_fetcher.rb +1 -0
  24. data/lib/omnibus/fetchers/net_fetcher.rb +3 -4
  25. data/lib/omnibus/fetchers/path_fetcher.rb +1 -1
  26. data/lib/omnibus/file_syncer.rb +1 -1
  27. data/lib/omnibus/generator.rb +2 -2
  28. data/lib/omnibus/generator_files/README.md.erb +20 -16
  29. data/lib/omnibus/generator_files/config/software/preparation.rb.erb +1 -1
  30. data/lib/omnibus/generator_files/omnibus.rb.erb +5 -4
  31. data/lib/omnibus/git_cache.rb +2 -2
  32. data/lib/omnibus/health_check.rb +3 -1
  33. data/lib/omnibus/licensing.rb +5 -6
  34. data/lib/omnibus/logger.rb +3 -2
  35. data/lib/omnibus/manifest.rb +2 -2
  36. data/lib/omnibus/metadata.rb +2 -2
  37. data/lib/omnibus/ohai.rb +1 -1
  38. data/lib/omnibus/package.rb +1 -1
  39. data/lib/omnibus/packager.rb +6 -14
  40. data/lib/omnibus/packagers/appx.rb +1 -2
  41. data/lib/omnibus/packagers/base.rb +2 -1
  42. data/lib/omnibus/packagers/bff.rb +6 -8
  43. data/lib/omnibus/packagers/deb.rb +7 -10
  44. data/lib/omnibus/packagers/ips.rb +3 -6
  45. data/lib/omnibus/packagers/makeself.rb +1 -2
  46. data/lib/omnibus/packagers/msi.rb +13 -12
  47. data/lib/omnibus/packagers/pkg.rb +125 -9
  48. data/lib/omnibus/packagers/rpm.rb +11 -12
  49. data/lib/omnibus/packagers/solaris.rb +5 -5
  50. data/lib/omnibus/packagers/windows_base.rb +7 -6
  51. data/lib/omnibus/project.rb +3 -2
  52. data/lib/omnibus/publisher.rb +2 -2
  53. data/lib/omnibus/publishers/artifactory_publisher.rb +2 -2
  54. data/lib/omnibus/publishers/s3_publisher.rb +6 -4
  55. data/lib/omnibus/s3_cache.rb +4 -2
  56. data/lib/omnibus/s3_helpers.rb +7 -7
  57. data/lib/omnibus/software.rb +68 -43
  58. data/lib/omnibus/sugarable.rb +5 -14
  59. data/lib/omnibus/templating.rb +2 -2
  60. data/lib/omnibus/thread_pool.rb +0 -2
  61. data/lib/omnibus/util.rb +4 -3
  62. data/lib/omnibus/version.rb +1 -1
  63. data/lib/omnibus/whitelist.rb +24 -1
  64. data/omnibus.gemspec +8 -9
  65. data/resources/ips/doc-transform.erb +1 -0
  66. data/resources/msi/CustomActionFastMsi.CA.dll +0 -0
  67. data/resources/msi/source.wxs.erb +2 -10
  68. data/resources/rpm/signing.erb +7 -10
  69. data/spec/functional/builder_spec.rb +2 -1
  70. data/spec/functional/fetchers/file_fetcher_spec.rb +4 -4
  71. data/spec/functional/fetchers/git_fetcher_spec.rb +4 -4
  72. data/spec/functional/fetchers/net_fetcher_spec.rb +5 -6
  73. data/spec/functional/fetchers/path_fetcher_spec.rb +4 -4
  74. data/spec/functional/licensing_spec.rb +5 -5
  75. data/spec/support/examples.rb +3 -4
  76. data/spec/support/path_helpers.rb +2 -2
  77. data/spec/unit/builder_spec.rb +9 -9
  78. data/spec/unit/changelogprinter_spec.rb +8 -6
  79. data/spec/unit/compressor_spec.rb +4 -4
  80. data/spec/unit/compressors/dmg_spec.rb +5 -2
  81. data/spec/unit/fetchers/net_fetcher_spec.rb +16 -17
  82. data/spec/unit/health_check_spec.rb +2 -6
  83. data/spec/unit/library_spec.rb +2 -1
  84. data/spec/unit/manifest_diff_spec.rb +2 -2
  85. data/spec/unit/manifest_spec.rb +1 -1
  86. data/spec/unit/metadata_spec.rb +14 -17
  87. data/spec/unit/omnibus_spec.rb +1 -1
  88. data/spec/unit/packager_spec.rb +6 -13
  89. data/spec/unit/packagers/bff_spec.rb +2 -2
  90. data/spec/unit/packagers/ips_spec.rb +1 -0
  91. data/spec/unit/packagers/msi_spec.rb +2 -2
  92. data/spec/unit/packagers/pkg_spec.rb +354 -0
  93. data/spec/unit/packagers/pkgsrc_spec.rb +1 -1
  94. data/spec/unit/packagers/rpm_spec.rb +5 -5
  95. data/spec/unit/packagers/solaris_spec.rb +7 -7
  96. data/spec/unit/project_spec.rb +7 -7
  97. data/spec/unit/publisher_spec.rb +1 -2
  98. data/spec/unit/publishers/artifactory_publisher_spec.rb +2 -4
  99. data/spec/unit/publishers/s3_publisher_spec.rb +2 -4
  100. data/spec/unit/s3_cacher_spec.rb +19 -6
  101. data/spec/unit/s3_helpers_spec.rb +22 -3
  102. data/spec/unit/software_spec.rb +59 -120
  103. data/spec/unit/util_spec.rb +1 -2
  104. metadata +21 -21
@@ -70,7 +70,7 @@ module Omnibus
70
70
  expect(subject).to receive(:shellout!)
71
71
  .with "cd #{project.install_dir} && find . -type l -or -type f | sort >> #{staging_dir}/packlist"
72
72
  subject.write_packlist
73
- expect(File.read("#{staging_dir}/packlist")).to match(/@pkgdir \/opt\/project/)
73
+ expect(File.read("#{staging_dir}/packlist")).to match(%r{@pkgdir /opt/project})
74
74
  end
75
75
  end
76
76
  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.9") do |data|
38
+ stub_ohai(platform: "redhat", version: "6") do |data|
39
39
  data["kernel"]["machine"] = architecture
40
40
  end
41
41
  end
@@ -488,7 +488,7 @@ module Omnibus
488
488
 
489
489
  describe "#safe_architecture" do
490
490
  before do
491
- stub_ohai(platform: "redhat", version: "6.9") do |data|
491
+ stub_ohai(platform: "redhat", version: "6") do |data|
492
492
  data["kernel"]["machine"] = "i386"
493
493
  end
494
494
  end
@@ -499,7 +499,7 @@ module Omnibus
499
499
 
500
500
  context "when i686" do
501
501
  before do
502
- stub_ohai(platform: "redhat", version: "6.9") do |data|
502
+ stub_ohai(platform: "redhat", version: "6") do |data|
503
503
  data["kernel"]["machine"] = "i686"
504
504
  end
505
505
  end
@@ -512,9 +512,9 @@ module Omnibus
512
512
  context "on Pidora" do
513
513
  before do
514
514
  # There's no Pidora in Fauxhai :(
515
- stub_ohai(platform: "fedora", version: "27") do |data|
515
+ stub_ohai(platform: "fedora", version: "32") do |data|
516
516
  data["platform"] = "pidora"
517
- data["platform_version"] = "27"
517
+ data["platform_version"] = "32"
518
518
  data["kernel"]["machine"] = "armv6l"
519
519
  end
520
520
  end
@@ -139,11 +139,11 @@ module Omnibus
139
139
 
140
140
  it "uses the correct commands" do
141
141
  expect(subject).to receive(:shellout!)
142
- .with("cd /opt && find project -print > #{File.join(staging_dir, 'files')}")
142
+ .with("cd /opt && find project -print > #{File.join(staging_dir, "files")}")
143
143
  expect(subject).to receive(:shellout!)
144
- .with("cd /opt && pkgproto < #{File.join(staging_dir, 'files.clean')} > #{File.join(staging_dir, 'Prototype.files')}")
144
+ .with("cd /opt && pkgproto < #{File.join(staging_dir, "files.clean")} > #{File.join(staging_dir, "Prototype.files")}")
145
145
  expect(subject).to receive(:shellout!)
146
- .with("awk '{ $5 = \"root\"; $6 = \"root\"; print }' < #{File.join(staging_dir, 'Prototype.files')} >> #{File.join(staging_dir, 'Prototype')}")
146
+ .with("awk '{ $5 = \"root\"; $6 = \"root\"; print }' < #{File.join(staging_dir, "Prototype.files")} >> #{File.join(staging_dir, "Prototype")}")
147
147
  subject.write_prototype_file
148
148
  end
149
149
 
@@ -158,11 +158,11 @@ module Omnibus
158
158
  describe "#create_solaris_file" do
159
159
  it "uses the correct commands" do
160
160
  expect(subject).to receive(:shellout!)
161
- .with("pkgmk -o -r /opt -d #{staging_dir} -f #{File.join(staging_dir, 'Prototype')}")
161
+ .with("pkgmk -o -r /opt -d #{staging_dir} -f #{File.join(staging_dir, "Prototype")}")
162
162
  expect(subject).to receive(:shellout!)
163
163
  .with("pkgchk -vd #{staging_dir} project")
164
164
  expect(subject).to receive(:shellout!)
165
- .with("pkgtrans #{staging_dir} #{File.join(package_dir, 'project-1.2.3-1.i386.solaris')} project")
165
+ .with("pkgtrans #{staging_dir} #{File.join(package_dir, "project-1.2.3-1.i386.solaris")} project")
166
166
 
167
167
  subject.create_solaris_file
168
168
  end
@@ -207,11 +207,11 @@ module Omnibus
207
207
 
208
208
  it "uses the correct commands" do
209
209
  expect(subject).to receive(:shellout!)
210
- .with("pkgmk -o -r /opt -d #{staging_dir} -f #{File.join(staging_dir, 'Prototype')}")
210
+ .with("pkgmk -o -r /opt -d #{staging_dir} -f #{File.join(staging_dir, "Prototype")}")
211
211
  expect(subject).to receive(:shellout!)
212
212
  .with("pkgchk -vd #{staging_dir} project")
213
213
  expect(subject).to receive(:shellout!)
214
- .with("pkgtrans #{staging_dir} #{File.join(package_dir, 'project-1.2.3-1.i386.solaris')} project")
214
+ .with("pkgtrans #{staging_dir} #{File.join(package_dir, "project-1.2.3-1.i386.solaris")} project")
215
215
 
216
216
  subject.create_solaris_file
217
217
  end
@@ -202,33 +202,33 @@ module Omnibus
202
202
  end
203
203
 
204
204
  describe "#build_iteration" do
205
- let(:fauxhai_options) { Hash.new }
205
+ let(:fauxhai_options) { {} }
206
206
 
207
207
  before { stub_ohai(fauxhai_options) }
208
208
 
209
209
  context "when on RHEL" do
210
- let(:fauxhai_options) { { platform: "redhat", version: "6.9" } }
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: "8.11" } }
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: "10.4" } }
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: "2008R2") }
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)
@@ -236,7 +236,7 @@ module Omnibus
236
236
  end
237
237
 
238
238
  context "when on OS X" do
239
- let(:fauxhai_options) { { platform: "mac_os_x", version: "10.13" } }
239
+ let(:fauxhai_options) { { platform: "mac_os_x", version: "10.15" } }
240
240
  it "returns a generic iteration" do
241
241
  expect(subject.build_iteration).to eq(1)
242
242
  end
@@ -340,7 +340,7 @@ module Omnibus
340
340
  subject.compress(:tgz)
341
341
 
342
342
  expect(Compressor).to receive(:for_current_system)
343
- .with([:dmg, :tgz])
343
+ .with(%i{dmg tgz})
344
344
  .and_call_original
345
345
 
346
346
  subject.compressor
@@ -133,8 +133,7 @@ module Omnibus
133
133
  license: "Apache-2.0",
134
134
  },
135
135
  },
136
- }
137
- )
136
+ })
138
137
  end
139
138
 
140
139
  before do
@@ -10,8 +10,7 @@ module Omnibus
10
10
  path: "/path/to/files/chef.deb",
11
11
  name: "chef.deb",
12
12
  content: "BINARY",
13
- validate!: true
14
- )
13
+ validate!: true)
15
14
  end
16
15
 
17
16
  let(:metadata) do
@@ -90,8 +89,7 @@ module Omnibus
90
89
  license: "Apache-2.0",
91
90
  },
92
91
  },
93
- }
94
- )
92
+ })
95
93
  end
96
94
 
97
95
  let(:packages) { [package] }
@@ -9,8 +9,7 @@ module Omnibus
9
9
  path: "/path/to/files/chef.deb",
10
10
  name: "chef.deb",
11
11
  content: "BINARY",
12
- validate!: true
13
- )
12
+ validate!: true)
14
13
  end
15
14
 
16
15
  let(:metadata) do
@@ -24,8 +23,7 @@ module Omnibus
24
23
  platform_version: "14.04",
25
24
  arch: "x86_64",
26
25
  sha1: "SHA1",
27
- md5: "ABCDEF123456"
28
- )
26
+ md5: "ABCDEF123456")
29
27
  end
30
28
 
31
29
  let(:packages) { [package] }
@@ -7,9 +7,7 @@ module Omnibus
7
7
  name: "ruby",
8
8
  version: "1.9.3",
9
9
  fetcher: double(Fetcher,
10
- checksum: "abcd1234"
11
- )
12
- )
10
+ checksum: "abcd1234"))
13
11
  end
14
12
 
15
13
  let(:python_27) do
@@ -17,9 +15,7 @@ module Omnibus
17
15
  name: "python",
18
16
  version: "2.7",
19
17
  fetcher: double(Fetcher,
20
- checksum: "defg5678"
21
- )
22
- )
18
+ checksum: "defg5678"))
23
19
  end
24
20
 
25
21
  describe ".list" do
@@ -113,10 +109,12 @@ module Omnibus
113
109
  let (:s3_access_key) { nil }
114
110
  let (:s3_secret_key) { nil }
115
111
  let (:s3_profile) { nil }
112
+ let (:s3_iam_role_arn) { nil }
116
113
 
117
114
  before do
118
115
  Config.s3_bucket s3_bucket
119
116
  Config.s3_region s3_region
117
+ Config.s3_iam_role_arn s3_iam_role_arn
120
118
  Config.s3_profile s3_profile
121
119
  Config.s3_access_key s3_access_key
122
120
  Config.s3_secret_key s3_secret_key
@@ -152,6 +150,21 @@ module Omnibus
152
150
  expect(config[:secret_access_key]).to eq(nil)
153
151
  end
154
152
  end
153
+
154
+ context "s3_iam_role_arn is configured" do
155
+ let(:s3_iam_role_arn) { "S3_IAM_ROLE_ARN" }
156
+ let(:s3_profile) { "SHAREDPROFILE" }
157
+ let(:s3_access_key) { "ACCESS_KEY_ID" }
158
+ let(:s3_secret_key) { "SECRET_ACCESS_KEY" }
159
+
160
+ it "sets s3_iam_role_arn only" do
161
+ config = S3Cache.send(:s3_configuration)
162
+ expect(config[:iam_role_arn]).to eq(s3_iam_role_arn)
163
+ expect(config[:profile]).to eq(nil)
164
+ expect(config[:access_key_id]).to eq(nil)
165
+ expect(config[:secret_access_key]).to eq(nil)
166
+ end
167
+ end
155
168
  end
156
169
  end
157
170
  end
@@ -9,12 +9,12 @@ module Omnibus
9
9
  describe "#client" do
10
10
  it "raises an error if it is not overridden" do
11
11
  expect { s3_configuration }.to raise_error(RuntimeError,
12
- "You must override s3_configuration")
12
+ "You must override s3_configuration")
13
13
  end
14
14
 
15
15
  it "raises an error stating that s3_configuration must be overriden" do
16
16
  expect { client }.to raise_error(RuntimeError,
17
- "You must override s3_configuration")
17
+ "You must override s3_configuration")
18
18
  end
19
19
  end
20
20
  end
@@ -40,6 +40,8 @@ module Omnibus
40
40
  let(:instance) { klass.new }
41
41
  let(:key_pair) { { access_key_id: "key_id", secret_access_key: "access_key" } }
42
42
  let(:profile) { "my-profile" }
43
+ let(:iam_role_arn) { "my-iam-role-arn" }
44
+ let(:role_session_name) { "omnibus-assume-role-s3-access" }
43
45
  let(:config) { { bucket_name: "foo", region: "us-east-1" } }
44
46
 
45
47
  it "uses configured key pairs" do
@@ -52,19 +54,36 @@ module Omnibus
52
54
  instance.send(:get_credentials)
53
55
  end
54
56
 
55
- it "preferrs shared credentials profiles over key pairs" do
57
+ it "prefers shared credentials profiles over key pairs" do
56
58
  allow_any_instance_of(klass).to receive(:s3_configuration).and_return(
57
59
  {
58
60
  **config,
59
61
  **key_pair,
62
+ iam_role_arn: nil,
60
63
  profile: profile,
61
64
  }
62
65
  )
63
66
  expect(Aws::Credentials).to_not receive(:new)
67
+ expect(Aws::AssumeRoleCredentials).to_not receive(:new)
64
68
  allow(Aws::SharedCredentials).to receive(:new).with(profile_name: profile)
65
69
  instance.send(:get_credentials)
66
70
  end
67
71
 
72
+ it "prefers AWS IAM role arn over profiles and key pairs" do
73
+ allow_any_instance_of(klass).to receive(:s3_configuration).and_return(
74
+ {
75
+ **config,
76
+ **key_pair,
77
+ profile: profile,
78
+ iam_role_arn: iam_role_arn,
79
+ }
80
+ )
81
+ expect(Aws::Credentials).to_not receive(:new)
82
+ expect(Aws::SharedCredentials).to_not receive(:new)
83
+ allow(Aws::AssumeRoleCredentials).to receive(:new).with(role_arn: iam_role_arn, role_session_name: role_session_name)
84
+ instance.send(:get_credentials)
85
+ end
86
+
68
87
  end
69
88
  end
70
89
  end
@@ -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 -O2",
77
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
78
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
76
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
77
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
78
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -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 -O2",
88
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
89
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
87
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
88
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
89
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -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 -O2",
99
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
100
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
98
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
99
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
100
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -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 -O2",
110
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
111
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
109
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
110
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
111
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -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 -O2",
121
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
122
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
120
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
121
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
122
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -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 -O2",
133
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
134
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
132
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
133
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
134
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -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"
@@ -196,9 +196,9 @@ module Omnibus
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 -O2",
200
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
201
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
199
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
200
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
201
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -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 do
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 10" do
230
+ context "on freebsd" do
236
231
  before do
237
- stub_ohai(platform: "freebsd", version: "10.4")
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 -O2",
244
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
245
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
238
+ "CFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
239
+ "CXXFLAGS" => "-I/opt/project/embedded/include -O2 -D_FORTIFY_SOURCE=2 -fstack-protector",
240
+ "CPPFLAGS" => "-I/opt/project/embedded/include -O2 -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
- end
260
-
261
- context "on freebsd 10" do
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",
271
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
272
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
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",
291
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
292
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
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",
311
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
312
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
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",
332
- "CXXFLAGS" => "-I/opt/project/embedded/include -O2",
333
- "CPPFLAGS" => "-I/opt/project/embedded/include -O2",
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
248
  end
340
249
 
341
- context "on Windows" do
250
+ context "on windows" do
342
251
  let(:win_arch_i386) { true }
343
252
 
344
253
  before do
@@ -547,7 +456,7 @@ module Omnibus
547
456
  describe "#whitelist_file" do
548
457
  it "appends to the whitelist_files array" do
549
458
  expect(subject.whitelist_files.size).to eq(0)
550
- subject.whitelist_file(/foo\/bar/)
459
+ subject.whitelist_file(%r{foo/bar})
551
460
  expect(subject.whitelist_files.size).to eq(1)
552
461
  end
553
462
 
@@ -558,6 +467,36 @@ module Omnibus
558
467
  end
559
468
  end
560
469
 
470
+ describe "#bin_dirs" do
471
+ it "sets bin_dirs" do
472
+ subject.bin_dirs ["my_bin_dir"]
473
+ expect(subject.bin_dirs).to eq(["my_bin_dir"])
474
+ expect(subject.bin_dirs).to be_kind_of(Array)
475
+ end
476
+
477
+ context "bin_dirs is not set" do
478
+ it "returns default values" do
479
+ expect(subject.bin_dirs).to eq(["/opt/project/bin", "/opt/project/embedded/bin"])
480
+ expect(subject.bin_dirs).to be_kind_of(Array)
481
+ end
482
+ end
483
+ end
484
+
485
+ describe "#lib_dirs" do
486
+ it "sets lib_dirs" do
487
+ subject.lib_dirs ["my_lib_dir"]
488
+ expect(subject.lib_dirs).to eq(["my_lib_dir"])
489
+ expect(subject.lib_dirs).to be_kind_of(Array)
490
+ end
491
+
492
+ context "lib_dirs is not set" do
493
+ it "returns default values" do
494
+ expect(subject.lib_dirs).to eq(["/opt/project/embedded/lib"])
495
+ expect(subject.lib_dirs).to be_kind_of(Array)
496
+ end
497
+ end
498
+ end
499
+
561
500
  context "testing repo-level version overrides" do
562
501
  context "without overrides" do
563
502
  it "returns the original values" do