omnibus 5.0.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.rspec +2 -0
- data/.travis.yml +1 -0
- data/CHANGELOG.md +26 -0
- data/Gemfile +3 -0
- data/MAINTAINERS.md +1 -0
- data/appveyor.yml +1 -1
- data/bin/omnibus +5 -0
- data/lib/omnibus/builder.rb +165 -26
- data/lib/omnibus/digestable.rb +4 -2
- data/lib/omnibus/fetcher.rb +18 -5
- data/lib/omnibus/fetchers/git_fetcher.rb +38 -22
- data/lib/omnibus/fetchers/net_fetcher.rb +106 -37
- data/lib/omnibus/fetchers/path_fetcher.rb +13 -12
- data/lib/omnibus/file_syncer.rb +33 -14
- data/lib/omnibus/generator_files/README.md.erb +1 -1
- data/lib/omnibus/generator_files/package_scripts/postinst.erb +3 -3
- data/lib/omnibus/generator_files/package_scripts/postrm.erb +1 -1
- data/lib/omnibus/generator_files/package_scripts/preinst.erb +1 -1
- data/lib/omnibus/generator_files/package_scripts/prerm.erb +3 -3
- data/lib/omnibus/git_cache.rb +20 -7
- data/lib/omnibus/health_check.rb +144 -12
- data/lib/omnibus/packagers/bff.rb +57 -5
- data/lib/omnibus/packagers/deb.rb +2 -2
- data/lib/omnibus/packagers/pkg.rb +2 -2
- data/lib/omnibus/packagers/solaris.rb +18 -6
- data/lib/omnibus/project.rb +1 -1
- data/lib/omnibus/s3_cache.rb +8 -2
- data/lib/omnibus/software.rb +152 -18
- data/lib/omnibus/sugarable.rb +1 -5
- data/lib/omnibus/util.rb +1 -1
- data/lib/omnibus/version.rb +1 -1
- data/omnibus.gemspec +4 -1
- data/resources/bff/config.erb +7 -0
- data/resources/deb/md5sums.erb +1 -1
- data/spec/functional/builder_spec.rb +89 -2
- data/spec/functional/fetchers/git_fetcher_spec.rb +44 -37
- data/spec/functional/fetchers/net_fetcher_spec.rb +36 -5
- data/spec/functional/fetchers/path_fetcher_spec.rb +28 -28
- data/spec/unit/builder_spec.rb +143 -11
- data/spec/unit/fetchers/git_fetcher_spec.rb +23 -59
- data/spec/unit/fetchers/net_fetcher_spec.rb +151 -63
- data/spec/unit/fetchers/path_fetcher_spec.rb +4 -35
- data/spec/unit/git_cache_spec.rb +13 -14
- data/spec/unit/health_check_spec.rb +90 -0
- data/spec/unit/library_spec.rb +1 -1
- data/spec/unit/packagers/bff_spec.rb +126 -3
- data/spec/unit/packagers/deb_spec.rb +8 -3
- data/spec/unit/packagers/pkg_spec.rb +19 -19
- data/spec/unit/packagers/solaris_spec.rb +13 -1
- data/spec/unit/software_spec.rb +242 -38
- metadata +7 -6
- data/lib/omnibus/generator_files/package_scripts/makeselfinst.erb +0 -0
data/spec/unit/git_cache_spec.rb
CHANGED
@@ -83,7 +83,7 @@ module Omnibus
|
|
83
83
|
expect(FileUtils).to receive(:mkdir_p)
|
84
84
|
.with(File.dirname(ipc.cache_path))
|
85
85
|
expect(ipc).to receive(:shellout!)
|
86
|
-
.with("git --git-dir=#{cache_path} init -q")
|
86
|
+
.with("git -c core.autocrlf=false --git-dir=#{cache_path} --work-tree=#{install_dir} init -q")
|
87
87
|
ipc.create_cache_path
|
88
88
|
end
|
89
89
|
|
@@ -95,7 +95,6 @@ module Omnibus
|
|
95
95
|
.with(File.dirname(ipc.cache_path))
|
96
96
|
.and_return(true)
|
97
97
|
expect(ipc).to_not receive(:shellout!)
|
98
|
-
.with("git --git-dir=#{cache_path} init -q")
|
99
98
|
ipc.create_cache_path
|
100
99
|
end
|
101
100
|
end
|
@@ -114,19 +113,19 @@ module Omnibus
|
|
114
113
|
it 'adds all the changes to git removing git directories' do
|
115
114
|
expect(ipc).to receive(:remove_git_dirs)
|
116
115
|
expect(ipc).to receive(:shellout!)
|
117
|
-
.with("git --git-dir=#{cache_path} --work-tree=#{install_dir} add -A -f")
|
116
|
+
.with("git -c core.autocrlf=false --git-dir=#{cache_path} --work-tree=#{install_dir} add -A -f")
|
118
117
|
ipc.incremental
|
119
118
|
end
|
120
119
|
|
121
120
|
it 'commits the backup for the software' do
|
122
121
|
expect(ipc).to receive(:shellout!)
|
123
|
-
.with(%Q(git --git-dir=#{cache_path} --work-tree=#{install_dir} commit -q -m "Backup of #{ipc.tag}"))
|
122
|
+
.with(%Q(git -c core.autocrlf=false --git-dir=#{cache_path} --work-tree=#{install_dir} commit -q -m "Backup of #{ipc.tag}"))
|
124
123
|
ipc.incremental
|
125
124
|
end
|
126
125
|
|
127
126
|
it 'tags the software backup' do
|
128
127
|
expect(ipc).to receive(:shellout!)
|
129
|
-
.with(%Q(git --git-dir=#{cache_path} --work-tree=#{install_dir} tag -f "#{ipc.tag}"))
|
128
|
+
.with(%Q(git -c core.autocrlf=false --git-dir=#{cache_path} --work-tree=#{install_dir} tag -f "#{ipc.tag}"))
|
130
129
|
ipc.incremental
|
131
130
|
end
|
132
131
|
end
|
@@ -165,11 +164,11 @@ module Omnibus
|
|
165
164
|
end
|
166
165
|
|
167
166
|
before(:each) do
|
168
|
-
allow(ipc).to receive(:shellout)
|
169
|
-
.with(%Q(git --git-dir=#{cache_path} --work-tree=#{install_dir} tag -l "#{ipc.tag}"))
|
167
|
+
allow(ipc).to receive(:shellout!)
|
168
|
+
.with(%Q(git -c core.autocrlf=false --git-dir=#{cache_path} --work-tree=#{install_dir} tag -l "#{ipc.tag}"))
|
170
169
|
.and_return(tag_cmd)
|
171
170
|
allow(ipc).to receive(:shellout!)
|
172
|
-
.with(%Q(git --git-dir=#{cache_path} --work-tree=#{install_dir} checkout -f "#{ipc.tag}"))
|
171
|
+
.with(%Q(git -c core.autocrlf=false --git-dir=#{cache_path} --work-tree=#{install_dir} checkout -f "#{ipc.tag}"))
|
173
172
|
allow(ipc).to receive(:create_cache_path)
|
174
173
|
end
|
175
174
|
|
@@ -179,11 +178,11 @@ module Omnibus
|
|
179
178
|
end
|
180
179
|
|
181
180
|
it 'checks for a tag with the software and version, and if it finds it, checks it out' do
|
182
|
-
expect(ipc).to receive(:shellout)
|
183
|
-
.with(%Q(git --git-dir=#{cache_path} --work-tree=#{install_dir} tag -l "#{ipc.tag}"))
|
181
|
+
expect(ipc).to receive(:shellout!)
|
182
|
+
.with(%Q(git -c core.autocrlf=false --git-dir=#{cache_path} --work-tree=#{install_dir} tag -l "#{ipc.tag}"))
|
184
183
|
.and_return(tag_cmd)
|
185
184
|
expect(ipc).to receive(:shellout!)
|
186
|
-
.with(%Q(git --git-dir=#{cache_path} --work-tree=#{install_dir} checkout -f "#{ipc.tag}"))
|
185
|
+
.with(%Q(git -c core.autocrlf=false --git-dir=#{cache_path} --work-tree=#{install_dir} checkout -f "#{ipc.tag}"))
|
187
186
|
ipc.restore
|
188
187
|
end
|
189
188
|
|
@@ -191,11 +190,11 @@ module Omnibus
|
|
191
190
|
let(:git_tag_output) { "\n" }
|
192
191
|
|
193
192
|
it 'does nothing' do
|
194
|
-
expect(ipc).to receive(:shellout)
|
195
|
-
.with(%Q(git --git-dir=#{cache_path} --work-tree=#{install_dir} tag -l "#{ipc.tag}"))
|
193
|
+
expect(ipc).to receive(:shellout!)
|
194
|
+
.with(%Q(git -c core.autocrlf=false --git-dir=#{cache_path} --work-tree=#{install_dir} tag -l "#{ipc.tag}"))
|
196
195
|
.and_return(tag_cmd)
|
197
196
|
expect(ipc).to_not receive(:shellout!)
|
198
|
-
.with(%Q(git --git-dir=#{cache_path} --work-tree=#{install_dir} checkout -f "#{ipc.tag}"))
|
197
|
+
.with(%Q(git -c core.autocrlf=false --git-dir=#{cache_path} --work-tree=#{install_dir} checkout -f "#{ipc.tag}"))
|
199
198
|
ipc.restore
|
200
199
|
end
|
201
200
|
end
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'spec_helper'
|
2
|
+
require 'pedump'
|
2
3
|
|
3
4
|
module Omnibus
|
4
5
|
describe HealthCheck do
|
@@ -12,8 +13,93 @@ module Omnibus
|
|
12
13
|
)
|
13
14
|
end
|
14
15
|
|
16
|
+
def mkdump(base, size, x64 = false)
|
17
|
+
dump = double(PEdump)
|
18
|
+
pe = double(PEdump::PE,
|
19
|
+
x64?: x64,
|
20
|
+
ioh: double(x64 ? PEdump::IMAGE_OPTIONAL_HEADER64 : PEdump::IMAGE_OPTIONAL_HEADER32,
|
21
|
+
ImageBase: base,
|
22
|
+
SizeOfImage: size,
|
23
|
+
),
|
24
|
+
)
|
25
|
+
expect(dump).to receive(:pe).and_return(pe)
|
26
|
+
dump
|
27
|
+
end
|
28
|
+
|
15
29
|
subject { described_class.new(project) }
|
16
30
|
|
31
|
+
context 'on windows' do
|
32
|
+
before do
|
33
|
+
stub_ohai(platform: 'windows', version: '2012')
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'will perform dll base relocation checks' do
|
37
|
+
stub_ohai(platform: 'windows', version: '2012')
|
38
|
+
expect(subject.relocation_checkable?).to be true
|
39
|
+
end
|
40
|
+
|
41
|
+
context 'when performing dll base relocation checks' do
|
42
|
+
let(:pmdumps) do
|
43
|
+
{
|
44
|
+
'a' => mkdump(0x10000000, 0x00001000),
|
45
|
+
'b/b' => mkdump(0x20000000, 0x00002000),
|
46
|
+
'c/c/c' => mkdump(0x30000000, 0x00004000),
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
let(:search_dir) { "#{project.install_dir}/embedded/bin" }
|
51
|
+
|
52
|
+
before do
|
53
|
+
r = allow(Dir).to receive(:glob).with("#{search_dir}/*.dll")
|
54
|
+
pmdumps.each do |file, dump|
|
55
|
+
path = File.join(search_dir, file)
|
56
|
+
r.and_yield(path)
|
57
|
+
expect(File).to receive(:open).with(path, 'rb').and_yield(double(File))
|
58
|
+
expect(PEdump).to receive(:new).with(path).and_return(dump)
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'when given non-overlapping dlls' do
|
63
|
+
it 'should always return true' do
|
64
|
+
expect(subject.run!).to eq(true)
|
65
|
+
end
|
66
|
+
|
67
|
+
it 'should not identify conflicts' do
|
68
|
+
expect(subject.relocation_check).to eq({})
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
context 'when presented with overlapping dlls' do
|
73
|
+
let(:pmdumps) do
|
74
|
+
{
|
75
|
+
'a' => mkdump(0x10000000, 0x00001000),
|
76
|
+
'b/b' => mkdump(0x10000500, 0x00002000),
|
77
|
+
'c/c/c' => mkdump(0x30000000, 0x00004000),
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
it 'should always return true' do
|
82
|
+
expect(subject.run!).to eq(true)
|
83
|
+
end
|
84
|
+
|
85
|
+
it 'should identify two conflicts' do
|
86
|
+
expect(subject.relocation_check).to eq({
|
87
|
+
'a' => {
|
88
|
+
base: 0x10000000,
|
89
|
+
size: 0x00001000,
|
90
|
+
conflicts: [ 'b' ],
|
91
|
+
},
|
92
|
+
'b' => {
|
93
|
+
base: 0x10000500,
|
94
|
+
size: 0x00002000,
|
95
|
+
conflicts: [ 'a' ],
|
96
|
+
},
|
97
|
+
})
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
|
17
103
|
context 'on linux' do
|
18
104
|
before { stub_ohai(platform: 'ubuntu', version: '12.04') }
|
19
105
|
|
@@ -68,6 +154,10 @@ module Omnibus
|
|
68
154
|
|
69
155
|
expect { subject.run! }.to_not raise_error
|
70
156
|
end
|
157
|
+
|
158
|
+
it 'will not perform dll base relocation checks' do
|
159
|
+
expect(subject.relocation_checkable?).to be false
|
160
|
+
end
|
71
161
|
end
|
72
162
|
end
|
73
163
|
end
|
data/spec/unit/library_spec.rb
CHANGED
@@ -8,7 +8,7 @@ module Omnibus
|
|
8
8
|
def generate_software(name, version, dependencies = [])
|
9
9
|
software = Software.new(project, "#{name}.rb")
|
10
10
|
software.name(name)
|
11
|
-
software.
|
11
|
+
software.default_version(version)
|
12
12
|
|
13
13
|
dependencies.each do |dependency|
|
14
14
|
software.dependency(dependency)
|
@@ -137,12 +137,67 @@ module Omnibus
|
|
137
137
|
end
|
138
138
|
end
|
139
139
|
|
140
|
+
context 'when paths with colons/commas are present', if: !windows? do
|
141
|
+
let(:contents) do
|
142
|
+
subject.write_gen_template
|
143
|
+
File.read(gen_file)
|
144
|
+
end
|
145
|
+
|
146
|
+
before do
|
147
|
+
create_file("#{staging_dir}/man3/App::Cpan.3")
|
148
|
+
create_file("#{staging_dir}/comma,file")
|
149
|
+
create_directory("#{staging_dir}/colon::dir/file")
|
150
|
+
create_directory("#{staging_dir}/comma,dir/file")
|
151
|
+
end
|
152
|
+
|
153
|
+
it 'renames colon filenames in the template' do
|
154
|
+
expect(contents).to include("/man3/App____Cpan.3")
|
155
|
+
end
|
156
|
+
|
157
|
+
it 'renames colon directory names in the template' do
|
158
|
+
expect(contents).to include("/colon____dir/file")
|
159
|
+
end
|
160
|
+
|
161
|
+
it 'renames comma filenames in the template' do
|
162
|
+
expect(contents).to include("/comma__file")
|
163
|
+
end
|
164
|
+
|
165
|
+
it 'renames comma directory names in the template' do
|
166
|
+
expect(contents).to include("/comma__dir/file")
|
167
|
+
end
|
168
|
+
|
169
|
+
context 'creates a config script' do
|
170
|
+
it 'when there wasn\'t one provided' do
|
171
|
+
FileUtils.rm_f("#{subject.scripts_staging_dir}/config")
|
172
|
+
subject.write_gen_template
|
173
|
+
expect(File).to exist("#{subject.scripts_staging_dir}/config")
|
174
|
+
end
|
175
|
+
|
176
|
+
it 'when one is provided in the project\'s def' do
|
177
|
+
create_file("#{project_root}/package-scripts/project/config")
|
178
|
+
subject.write_gen_template
|
179
|
+
contents = File.read("#{subject.scripts_staging_dir}/config")
|
180
|
+
expect(contents).to include("mv '/man3/App____Cpan.3' '/man3/App::Cpan.3'")
|
181
|
+
end
|
182
|
+
|
183
|
+
it 'with mv commands for all the renamed files' do
|
184
|
+
subject.write_gen_template
|
185
|
+
contents = File.read("#{subject.scripts_staging_dir}/config")
|
186
|
+
expect(contents).to include("mv '/man3/App____Cpan.3' '/man3/App::Cpan.3'")
|
187
|
+
expect(contents).to include("mv '/comma__file' '/comma,file'")
|
188
|
+
expect(contents).to include("mv '/colon____dir/file' '/colon::dir/file'")
|
189
|
+
expect(contents).to include("mv '/comma__dir/file' '/comma,dir/file'")
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
140
194
|
context 'when script files are present' do
|
141
195
|
before do
|
142
196
|
create_file("#{subject.scripts_staging_dir}/preinst")
|
143
197
|
create_file("#{subject.scripts_staging_dir}/postinst")
|
144
198
|
create_file("#{subject.scripts_staging_dir}/prerm")
|
145
199
|
create_file("#{subject.scripts_staging_dir}/postrm")
|
200
|
+
create_file("#{subject.scripts_staging_dir}/config")
|
146
201
|
end
|
147
202
|
|
148
203
|
it 'writes them into the template' do
|
@@ -151,27 +206,75 @@ module Omnibus
|
|
151
206
|
|
152
207
|
expect(contents).to include(" Pre-installation Script: #{subject.scripts_staging_dir}/preinst")
|
153
208
|
expect(contents).to include(" Post-installation Script: #{subject.scripts_staging_dir}/postinst")
|
209
|
+
expect(contents).to include(" Configuration Script: #{subject.scripts_staging_dir}/config")
|
154
210
|
expect(contents).to include(" Pre_rm Script: #{subject.scripts_staging_dir}/prerm")
|
155
211
|
expect(contents).to include(" Unconfiguration Script: #{subject.scripts_staging_dir}/postrm")
|
156
212
|
end
|
157
213
|
end
|
214
|
+
|
215
|
+
context 'when the log_level is :debug, it' do
|
216
|
+
before do
|
217
|
+
Omnibus.logger.level = :debug
|
218
|
+
end
|
219
|
+
|
220
|
+
it 'prints the rendered template' do
|
221
|
+
output = capture_logging { subject.write_gen_template }
|
222
|
+
expect(output).to include("Package Name: project")
|
223
|
+
end
|
224
|
+
end
|
158
225
|
end
|
159
226
|
|
160
227
|
describe '#create_bff_file' do
|
228
|
+
# Need to mock out the id calls
|
229
|
+
let(:id_shellout) {
|
230
|
+
shellout_mock = double("shellout_mock")
|
231
|
+
allow(shellout_mock).to receive(:stdout).and_return("300")
|
232
|
+
shellout_mock
|
233
|
+
}
|
234
|
+
|
161
235
|
before do
|
162
236
|
allow(subject).to receive(:shellout!)
|
163
237
|
allow(Dir).to receive(:chdir) { |_, &b| b.call }
|
238
|
+
allow(subject).to receive(:shellout!)
|
239
|
+
.with("id -u").and_return(id_shellout)
|
240
|
+
allow(subject).to receive(:shellout!)
|
241
|
+
.with("id -g").and_return(id_shellout)
|
242
|
+
|
243
|
+
create_file(File.join(staging_dir, '.info', "#{project.name}.inventory")) {
|
244
|
+
<<-INVENTORY.gsub(/^\s{12}/, '')
|
245
|
+
/opt/project/version-manifest.txt:
|
246
|
+
owner = root
|
247
|
+
group = system
|
248
|
+
mode = 644
|
249
|
+
type = FILE
|
250
|
+
class = apply,inventory,angry-omnibus-toolchain
|
251
|
+
size = 1906
|
252
|
+
checksum = "02776 2 "
|
253
|
+
INVENTORY
|
254
|
+
}
|
255
|
+
create_file("#{staging_dir}/file") { "http://goo.gl/TbkO01" }
|
256
|
+
end
|
257
|
+
|
258
|
+
it 'gets the build uid' do
|
259
|
+
expect(subject).to receive(:shellout!)
|
260
|
+
.with("id -u")
|
261
|
+
subject.create_bff_file
|
262
|
+
end
|
263
|
+
|
264
|
+
it 'gets the build gid' do
|
265
|
+
expect(subject).to receive(:shellout!)
|
266
|
+
.with("id -g")
|
267
|
+
subject.create_bff_file
|
164
268
|
end
|
165
269
|
|
166
|
-
it 'chowns the directory' do
|
270
|
+
it 'chowns the directory to root' do
|
167
271
|
# A note - the /opt/ here is essentially project.install_dir one level up.
|
168
272
|
# There is nothing magical about 'opt' as a directory.
|
169
273
|
expect(subject).to receive(:shellout!)
|
170
|
-
.with(/chown -
|
274
|
+
.with(/chown -Rh 0:0 #{staging_dir}\/opt$/)
|
171
275
|
subject.create_bff_file
|
172
276
|
end
|
173
277
|
|
174
|
-
|
175
278
|
it 'logs a message' do
|
176
279
|
output = capture_logging { subject.create_bff_file }
|
177
280
|
expect(output).to include('Creating .bff file')
|
@@ -182,6 +285,26 @@ module Omnibus
|
|
182
285
|
.with(/\/usr\/sbin\/mkinstallp -d/)
|
183
286
|
subject.create_bff_file
|
184
287
|
end
|
288
|
+
|
289
|
+
it 'chowns the directory back to the build user' do
|
290
|
+
# A note - the /opt/ here is essentially project.install_dir one level up.
|
291
|
+
# There is nothing magical about 'opt' as a directory.
|
292
|
+
# 300 is just what we set the mock for the build uid/gid to return.
|
293
|
+
expect(subject).to receive(:shellout!)
|
294
|
+
.with(/chown -Rh 300:300 #{staging_dir}/)
|
295
|
+
subject.create_bff_file
|
296
|
+
end
|
297
|
+
|
298
|
+
context 'when the log_level is :debug, it' do
|
299
|
+
before do
|
300
|
+
Omnibus.logger.level = :debug
|
301
|
+
end
|
302
|
+
|
303
|
+
it 'prints the inventory file' do
|
304
|
+
output = capture_logging { subject.create_bff_file }
|
305
|
+
expect(output).to match(%r{^/opt/project})
|
306
|
+
end
|
307
|
+
end
|
185
308
|
end
|
186
309
|
|
187
310
|
describe '#safe_base_package_name' do
|
@@ -198,6 +198,8 @@ module Omnibus
|
|
198
198
|
create_file("#{staging_dir}/.filea") { ".filea" }
|
199
199
|
create_file("#{staging_dir}/file1") { "file1" }
|
200
200
|
create_file("#{staging_dir}/file2") { "file2" }
|
201
|
+
create_file("#{staging_dir}/DEBIAN/preinst") { "preinst" }
|
202
|
+
create_file("#{staging_dir}/DEBIAN/postrm") { "postrm" }
|
201
203
|
end
|
202
204
|
|
203
205
|
it 'generates the file' do
|
@@ -209,9 +211,12 @@ module Omnibus
|
|
209
211
|
subject.write_md5_sums
|
210
212
|
contents = File.read("#{staging_dir}/DEBIAN/md5sums")
|
211
213
|
|
212
|
-
expect(contents).to include("9334770d184092f998009806af702c8c
|
213
|
-
expect(contents).to include("826e8142e6baabe8af779f5f490cf5f5
|
214
|
-
expect(contents).to include("1c1c96fd2cf8330db0bfa936ce82f3b9
|
214
|
+
expect(contents).to include("9334770d184092f998009806af702c8c .filea")
|
215
|
+
expect(contents).to include("826e8142e6baabe8af779f5f490cf5f5 file1")
|
216
|
+
expect(contents).to include("1c1c96fd2cf8330db0bfa936ce82f3b9 file2")
|
217
|
+
expect(contents).to_not include("1c1c96fd2cf8330db0bfa936ce82f3b9 file2")
|
218
|
+
expect(contents).to_not include("DEBIAN/preinst")
|
219
|
+
expect(contents).to_not include("DEBIAN/postrm")
|
215
220
|
end
|
216
221
|
end
|
217
222
|
|
@@ -4,9 +4,9 @@ module Omnibus
|
|
4
4
|
describe Packager::PKG do
|
5
5
|
let(:project) do
|
6
6
|
Project.new.tap do |project|
|
7
|
-
project.name('project')
|
7
|
+
project.name('project-full-name')
|
8
8
|
project.homepage('https://example.com')
|
9
|
-
project.install_dir('/opt/project')
|
9
|
+
project.install_dir('/opt/project-full-name')
|
10
10
|
project.build_version('1.2.3')
|
11
11
|
project.build_iteration('2')
|
12
12
|
project.maintainer('Chef Software')
|
@@ -15,12 +15,12 @@ module Omnibus
|
|
15
15
|
|
16
16
|
subject { described_class.new(project) }
|
17
17
|
|
18
|
-
let(:project_root) { File.join(tmp_path, 'project/root') }
|
18
|
+
let(:project_root) { File.join(tmp_path, 'project-full-name/root') }
|
19
19
|
let(:package_dir) { File.join(tmp_path, 'package/dir') }
|
20
20
|
let(:staging_dir) { File.join(tmp_path, 'staging/dir') }
|
21
21
|
|
22
22
|
before do
|
23
|
-
subject.identifier('com.getchef.project')
|
23
|
+
subject.identifier('com.getchef.project-full-name')
|
24
24
|
|
25
25
|
Config.project_root(project_root)
|
26
26
|
Config.package_dir(package_dir)
|
@@ -48,7 +48,7 @@ module Omnibus
|
|
48
48
|
|
49
49
|
describe '#package_name' do
|
50
50
|
it 'includes the name, version, and build iteration' do
|
51
|
-
expect(subject.package_name).to eq('project-1.2.3-2.pkg')
|
51
|
+
expect(subject.package_name).to eq('project-full-name-1.2.3-2.pkg')
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -69,7 +69,7 @@ module Omnibus
|
|
69
69
|
let(:scripts) { %w( preinstall postinstall ) }
|
70
70
|
before do
|
71
71
|
scripts.each do |script_name|
|
72
|
-
create_file("#{project_root}/package-scripts/project/#{script_name}") do
|
72
|
+
create_file("#{project_root}/package-scripts/project-full-name/#{script_name}") do
|
73
73
|
"Contents of #{script_name}"
|
74
74
|
end
|
75
75
|
end
|
@@ -90,7 +90,7 @@ module Omnibus
|
|
90
90
|
let(:default_scripts) { %w( preinst postinst ) }
|
91
91
|
before do
|
92
92
|
default_scripts.each do |script_name|
|
93
|
-
create_file("#{project_root}/package-scripts/project/#{script_name}") do
|
93
|
+
create_file("#{project_root}/package-scripts/project-full-name/#{script_name}") do
|
94
94
|
"Contents of #{script_name}"
|
95
95
|
end
|
96
96
|
end
|
@@ -114,12 +114,12 @@ module Omnibus
|
|
114
114
|
it 'executes the pkgbuild command' do
|
115
115
|
expect(subject).to receive(:shellout!).with <<-EOH.gsub(/^ {10}/, '')
|
116
116
|
pkgbuild \\
|
117
|
-
--identifier "com.getchef.project" \\
|
117
|
+
--identifier "com.getchef.project-full-name" \\
|
118
118
|
--version "1.2.3" \\
|
119
119
|
--scripts "#{staging_dir}/Scripts" \\
|
120
|
-
--root "/opt/project" \\
|
121
|
-
--install-location "/opt/project" \\
|
122
|
-
"project-core.pkg"
|
120
|
+
--root "/opt/project-full-name" \\
|
121
|
+
--install-location "/opt/project-full-name" \\
|
122
|
+
"project-full-name-core.pkg"
|
123
123
|
EOH
|
124
124
|
|
125
125
|
subject.build_component_pkg
|
@@ -136,9 +136,9 @@ module Omnibus
|
|
136
136
|
subject.write_distribution_file
|
137
137
|
contents = File.read("#{staging_dir}/Distribution")
|
138
138
|
|
139
|
-
expect(contents).to include('<pkg-ref id="com.getchef.project"/>')
|
140
|
-
expect(contents).to include('<line choice="com.getchef.project"/>')
|
141
|
-
expect(contents).to include('project-core.pkg')
|
139
|
+
expect(contents).to include('<pkg-ref id="com.getchef.project-full-name"/>')
|
140
|
+
expect(contents).to include('<line choice="com.getchef.project-full-name"/>')
|
141
|
+
expect(contents).to include('project-full-name-core.pkg')
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
@@ -149,7 +149,7 @@ module Omnibus
|
|
149
149
|
productbuild \\
|
150
150
|
--distribution "#{staging_dir}/Distribution" \\
|
151
151
|
--resources "#{staging_dir}/Resources" \\
|
152
|
-
"#{package_dir}/project-1.2.3-2.pkg"
|
152
|
+
"#{package_dir}/project-full-name-1.2.3-2.pkg"
|
153
153
|
EOH
|
154
154
|
|
155
155
|
subject.build_product_pkg
|
@@ -167,7 +167,7 @@ module Omnibus
|
|
167
167
|
--distribution "#{staging_dir}/Distribution" \\
|
168
168
|
--resources "#{staging_dir}/Resources" \\
|
169
169
|
--sign "My Special Identity" \\
|
170
|
-
"#{package_dir}/project-1.2.3-2.pkg"
|
170
|
+
"#{package_dir}/project-full-name-1.2.3-2.pkg"
|
171
171
|
EOH
|
172
172
|
subject.build_product_pkg
|
173
173
|
end
|
@@ -187,14 +187,14 @@ module Omnibus
|
|
187
187
|
|
188
188
|
describe '#component_pkg' do
|
189
189
|
it 'returns the project name with -core.pkg' do
|
190
|
-
expect(subject.component_pkg).to eq('project-core.pkg')
|
190
|
+
expect(subject.component_pkg).to eq('project-full-name-core.pkg')
|
191
191
|
end
|
192
192
|
end
|
193
193
|
|
194
194
|
describe '#safe_base_package_name' do
|
195
195
|
context 'when the project name is "safe"' do
|
196
196
|
it 'returns the value without logging a message' do
|
197
|
-
expect(subject.safe_base_package_name).to eq('project')
|
197
|
+
expect(subject.safe_base_package_name).to eq('project-full-name')
|
198
198
|
expect(subject).to_not receive(:log)
|
199
199
|
end
|
200
200
|
end
|
@@ -225,7 +225,7 @@ module Omnibus
|
|
225
225
|
before { subject.identifier(nil) }
|
226
226
|
|
227
227
|
it 'is interpreted' do
|
228
|
-
expect(subject.safe_identifier).to eq('test.chefsoftware.pkg.project')
|
228
|
+
expect(subject.safe_identifier).to eq('test.chefsoftware.pkg.project-full-name')
|
229
229
|
end
|
230
230
|
end
|
231
231
|
|