vanagon 0.14.3 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/bin/build +1 -1
  3. data/bin/build_host_info +1 -1
  4. data/bin/inspect +1 -1
  5. data/bin/render +1 -1
  6. data/bin/ship +1 -1
  7. data/lib/vanagon/component/dsl.rb +4 -4
  8. data/lib/vanagon/component/source/git.rb +7 -7
  9. data/lib/vanagon/component/source/http.rb +2 -2
  10. data/lib/vanagon/component/source/local.rb +4 -4
  11. data/lib/vanagon/component.rb +10 -10
  12. data/lib/vanagon/driver.rb +8 -8
  13. data/lib/vanagon/engine/base.rb +1 -1
  14. data/lib/vanagon/engine/docker.rb +1 -1
  15. data/lib/vanagon/engine/ec2.rb +5 -5
  16. data/lib/vanagon/engine/hardware.rb +3 -3
  17. data/lib/vanagon/engine/pooler.rb +3 -3
  18. data/lib/vanagon/environment.rb +4 -4
  19. data/lib/vanagon/platform/deb.rb +10 -1
  20. data/lib/vanagon/platform/dsl.rb +14 -0
  21. data/lib/vanagon/platform/osx.rb +1 -0
  22. data/lib/vanagon/platform/rpm/aix.rb +1 -0
  23. data/lib/vanagon/platform/rpm/wrl.rb +1 -1
  24. data/lib/vanagon/platform/rpm.rb +0 -3
  25. data/lib/vanagon/platform/solaris_10.rb +3 -2
  26. data/lib/vanagon/platform.rb +54 -10
  27. data/lib/vanagon/project/dsl.rb +1 -1
  28. data/lib/vanagon/project.rb +25 -7
  29. data/lib/vanagon/utilities.rb +4 -4
  30. data/lib/vanagon.rb +2 -2
  31. data/resources/Makefile.erb +2 -2
  32. data/resources/deb/control.erb +3 -3
  33. data/resources/rpm/project.spec.erb +18 -8
  34. data/spec/lib/vanagon/component/dsl_spec.rb +10 -0
  35. data/spec/lib/vanagon/platform/osx_spec.rb +21 -0
  36. data/spec/lib/vanagon/platform/rpm/aix_spec.rb +1 -1
  37. data/spec/lib/vanagon/platform/solaris_10_spec.rb +29 -0
  38. data/spec/lib/vanagon/project/dsl_spec.rb +164 -16
  39. metadata +6 -2
@@ -215,6 +215,15 @@ end" }
215
215
  end
216
216
 
217
217
  describe "#provides" do
218
+ before do
219
+ allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
220
+ allow(Vanagon::Driver).to receive(:configdir).and_return(configdir)
221
+ @el_plat = Vanagon::Platform::DSL.new('el-5-x86_64')
222
+ @el_plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
223
+ @deb_plat = Vanagon::Platform::DSL.new('ubuntu-16.04-amd64')
224
+ @deb_plat.instance_eval("platform 'ubuntu-16.04-amd64' do |plat| end")
225
+ end
226
+
218
227
  it 'adds the package provide to the list of provides' do
219
228
  proj = Vanagon::Project::DSL.new('test-fixture', {})
220
229
  proj.instance_eval(project_block)
@@ -225,27 +234,79 @@ end" }
225
234
  expect(proj._project.get_provides.last.provide).to eq('thing2')
226
235
  end
227
236
 
237
+ # we don't actually use deb versions for provides at this point, but
238
+ # testing it works nonetheless
239
+ it 'supports deb versioned provides' do
240
+ proj = Vanagon::Project::DSL.new('test-fixture', @deb_plat._platform, [])
241
+ proj.instance_eval(project_block)
242
+ proj.provides('thing1', '1.2.3')
243
+ expect(proj._project.get_provides.count).to eq(1)
244
+ expect(proj._project.get_provides.first.provide).to eq('thing1')
245
+ expect(proj._project.get_provides.first.version).to eq('>= 1.2.3')
246
+ end
247
+
248
+ # we don't actually use deb versions for provides at this point, but
249
+ # testing it works nonetheless
250
+ it 'munges deb* versions' do
251
+ operators = {
252
+ '<' => '<<',
253
+ '>' => '>>',
254
+ '<=' => '<=',
255
+ '>=' => '>=',
256
+ '=' => '='
257
+ }
258
+ operators.each do |initial, munged|
259
+ proj = Vanagon::Project::DSL.new('test-fixture', @deb_plat._platform, [])
260
+ proj.instance_eval(project_block)
261
+ proj.provides('thing1', "#{initial}1.2.3")
262
+ expect(proj._project.get_provides.count).to eq(1)
263
+ expect(proj._project.get_provides.first.provide).to eq('thing1')
264
+ expect(proj._project.get_provides.first.version).to eq("#{munged} 1.2.3")
265
+ end
266
+ end
267
+
268
+ it 'adds whitespace for rpm versions' do
269
+ operators=['<','>','<=','>=','=']
270
+ operators.each do |operator|
271
+ proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
272
+ proj.instance_eval(project_block)
273
+ proj.provides('thing1', "#{operator}1.2.3")
274
+ expect(proj._project.get_provides.count).to eq(1)
275
+ expect(proj._project.get_provides.first.provide).to eq('thing1')
276
+ expect(proj._project.get_provides.first.version).to eq("#{operator} 1.2.3")
277
+ end
278
+ end
279
+
228
280
  it 'supports versioned provides' do
229
- proj = Vanagon::Project::DSL.new('test-fixture', {})
281
+ proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
230
282
  proj.instance_eval(project_block)
231
283
  proj.provides('thing1', '1.2.3')
232
284
  expect(proj._project.get_provides.count).to eq(1)
233
285
  expect(proj._project.get_provides.first.provide).to eq('thing1')
234
- expect(proj._project.get_provides.first.version).to eq('1.2.3')
286
+ expect(proj._project.get_provides.first.version).to eq('>= 1.2.3')
235
287
  end
236
288
 
237
289
  it 'gets rid of duplicates' do
238
- proj = Vanagon::Project::DSL.new('test-fixture', {})
290
+ proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
239
291
  proj.instance_eval(project_block)
240
292
  proj.provides('thing1', '1.2.3')
241
- proj.provides('thing1', '1.2.3')
293
+ proj.provides('thing1', '>=1.2.3')
242
294
  expect(proj._project.get_provides.count).to eq(1)
243
295
  expect(proj._project.get_provides.first.provide).to eq('thing1')
244
- expect(proj._project.get_provides.first.version).to eq('1.2.3')
296
+ expect(proj._project.get_provides.first.version).to eq('>= 1.2.3')
245
297
  end
246
298
  end
247
299
 
248
300
  describe "#replaces" do
301
+ before do
302
+ allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
303
+ allow(Vanagon::Driver).to receive(:configdir).and_return(configdir)
304
+ @el_plat = Vanagon::Platform::DSL.new('el-5-x86_64')
305
+ @el_plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
306
+ @deb_plat = Vanagon::Platform::DSL.new('ubuntu-16.04-amd64')
307
+ @deb_plat.instance_eval("platform 'ubuntu-16.04-amd64' do |plat| end")
308
+ end
309
+
249
310
  it 'adds the package replacement to the list of replacements' do
250
311
  proj = Vanagon::Project::DSL.new('test-fixture', {})
251
312
  proj.instance_eval(project_block)
@@ -257,26 +318,74 @@ end" }
257
318
  end
258
319
 
259
320
  it 'supports versioned replaces' do
260
- proj = Vanagon::Project::DSL.new('test-fixture', {})
321
+ proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
261
322
  proj.instance_eval(project_block)
262
323
  proj.replaces('thing1', '1.2.3')
263
324
  expect(proj._project.get_replaces.count).to eq(1)
264
325
  expect(proj._project.get_replaces.first.replacement).to eq('thing1')
265
- expect(proj._project.get_replaces.first.version).to eq('1.2.3')
266
- end
326
+ expect(proj._project.get_replaces.first.version).to eq('< 1.2.3')
327
+ end
267
328
 
268
- it 'gets rid of duplicates' do
269
- proj = Vanagon::Project::DSL.new('test-fixture', {})
329
+ it 'supports deb versioned replaces' do
330
+ proj = Vanagon::Project::DSL.new('test-fixture', @deb_plat._platform, [])
270
331
  proj.instance_eval(project_block)
271
332
  proj.replaces('thing1', '1.2.3')
333
+ expect(proj._project.get_replaces.count).to eq(1)
334
+ expect(proj._project.get_replaces.first.replacement).to eq('thing1')
335
+ expect(proj._project.get_replaces.first.version).to eq('<< 1.2.3')
336
+ end
337
+
338
+ it 'munges deb* versions' do
339
+ operators = {
340
+ '<' => '<<',
341
+ '>' => '>>',
342
+ '<=' => '<=',
343
+ '>=' => '>=',
344
+ '=' => '='
345
+ }
346
+ operators.each do |initial, munged|
347
+ proj = Vanagon::Project::DSL.new('test-fixture', @deb_plat._platform, [])
348
+ proj.instance_eval(project_block)
349
+ proj.replaces('thing1', "#{initial}1.2.3")
350
+ expect(proj._project.get_replaces.count).to eq(1)
351
+ expect(proj._project.get_replaces.first.replacement).to eq('thing1')
352
+ expect(proj._project.get_replaces.first.version).to eq("#{munged} 1.2.3")
353
+ end
354
+ end
355
+
356
+ it 'adds whitespace for rpm versions' do
357
+ operators=['<','>','<=','>=','=']
358
+ operators.each do |operator|
359
+ proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
360
+ proj.instance_eval(project_block)
361
+ proj.replaces('thing1', "#{operator}1.2.3")
362
+ expect(proj._project.get_replaces.count).to eq(1)
363
+ expect(proj._project.get_replaces.first.replacement).to eq('thing1')
364
+ expect(proj._project.get_replaces.first.version).to eq("#{operator} 1.2.3")
365
+ end
366
+ end
367
+
368
+ it 'gets rid of duplicates' do
369
+ proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
370
+ proj.instance_eval(project_block)
272
371
  proj.replaces('thing1', '1.2.3')
372
+ proj.replaces('thing1', '<1.2.3')
273
373
  expect(proj._project.get_replaces.count).to eq(1)
274
374
  expect(proj._project.get_replaces.first.replacement).to eq('thing1')
275
- expect(proj._project.get_replaces.first.version).to eq('1.2.3')
375
+ expect(proj._project.get_replaces.first.version).to eq('< 1.2.3')
276
376
  end
277
377
  end
278
378
 
279
379
  describe "#conflicts" do
380
+ before do
381
+ allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
382
+ allow(Vanagon::Driver).to receive(:configdir).and_return(configdir)
383
+ @el_plat = Vanagon::Platform::DSL.new('el-5-x86_64')
384
+ @el_plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
385
+ @deb_plat = Vanagon::Platform::DSL.new('ubuntu-16.04-amd64')
386
+ @deb_plat.instance_eval("platform 'ubuntu-16.04-amd64' do |plat| end")
387
+ end
388
+
280
389
  it 'adds the package conflict to the list of conflicts' do
281
390
  proj = Vanagon::Project::DSL.new('test-fixture', {})
282
391
  proj.instance_eval(project_block)
@@ -288,22 +397,61 @@ end" }
288
397
  end
289
398
 
290
399
  it 'supports versioned conflicts' do
291
- proj = Vanagon::Project::DSL.new('test-fixture', {})
400
+ proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
292
401
  proj.instance_eval(project_block)
293
402
  proj.conflicts('thing1', '1.2.3')
294
403
  expect(proj._project.get_conflicts.count).to eq(1)
295
404
  expect(proj._project.get_conflicts.first.pkgname).to eq('thing1')
296
- expect(proj._project.get_conflicts.first.version).to eq('1.2.3')
405
+ expect(proj._project.get_conflicts.first.version).to eq('< 1.2.3')
297
406
  end
298
407
 
299
- it 'gets rid of duplicates' do
300
- proj = Vanagon::Project::DSL.new('test-fixture', {})
408
+ it 'supports deb versioned conflicts' do
409
+ proj = Vanagon::Project::DSL.new('test-fixture', @deb_plat._platform, [])
301
410
  proj.instance_eval(project_block)
302
411
  proj.conflicts('thing1', '1.2.3')
412
+ expect(proj._project.get_conflicts.count).to eq(1)
413
+ expect(proj._project.get_conflicts.first.pkgname).to eq('thing1')
414
+ expect(proj._project.get_conflicts.first.version).to eq('<< 1.2.3')
415
+ end
416
+
417
+ it 'munges deb* versions' do
418
+ operators = {
419
+ '<' => '<<',
420
+ '>' => '>>',
421
+ '<=' => '<=',
422
+ '>=' => '>=',
423
+ '=' => '='
424
+ }
425
+ operators.each do |initial, munged|
426
+ proj = Vanagon::Project::DSL.new('test-fixture', @deb_plat._platform, [])
427
+ proj.instance_eval(project_block)
428
+ proj.conflicts('thing1', "#{initial}1.2.3")
429
+ expect(proj._project.get_conflicts.count).to eq(1)
430
+ expect(proj._project.get_conflicts.first.pkgname).to eq('thing1')
431
+ expect(proj._project.get_conflicts.first.version).to eq("#{munged} 1.2.3")
432
+ end
433
+ end
434
+
435
+ it 'adds whitespace for rpm versions' do
436
+ operators=['<','>','<=','>=','=']
437
+ operators.each do |operator|
438
+ proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
439
+ proj.instance_eval(project_block)
440
+ proj.conflicts('thing1', "#{operator}1.2.3")
441
+ expect(proj._project.get_conflicts.count).to eq(1)
442
+ expect(proj._project.get_conflicts.first.pkgname).to eq('thing1')
443
+ expect(proj._project.get_conflicts.first.version).to eq("#{operator} 1.2.3")
444
+ end
445
+ end
446
+
447
+ it 'gets rid of duplicates' do
448
+ proj = Vanagon::Project::DSL.new('test-fixture', @el_plat._platform, [])
449
+ proj.instance_eval(project_block)
303
450
  proj.conflicts('thing1', '1.2.3')
451
+ proj.conflicts('thing1', '<1.2.3')
304
452
  expect(proj._project.get_conflicts.count).to eq(1)
305
453
  expect(proj._project.get_conflicts.first.pkgname).to eq('thing1')
306
- expect(proj._project.get_conflicts.first.version).to eq('1.2.3')
454
+ expect(proj._project.get_conflicts.first.version).to eq('< 1.2.3')
307
455
  end
308
456
  end
309
457
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.3
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-12 00:00:00.000000000 Z
11
+ date: 2018-01-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: git
@@ -208,8 +208,10 @@ files:
208
208
  - spec/lib/vanagon/optparse_spec.rb
209
209
  - spec/lib/vanagon/platform/deb_spec.rb
210
210
  - spec/lib/vanagon/platform/dsl_spec.rb
211
+ - spec/lib/vanagon/platform/osx_spec.rb
211
212
  - spec/lib/vanagon/platform/rpm/aix_spec.rb
212
213
  - spec/lib/vanagon/platform/rpm_spec.rb
214
+ - spec/lib/vanagon/platform/solaris_10_spec.rb
213
215
  - spec/lib/vanagon/platform/solaris_11_spec.rb
214
216
  - spec/lib/vanagon/platform/windows_spec.rb
215
217
  - spec/lib/vanagon/platform_spec.rb
@@ -269,8 +271,10 @@ test_files:
269
271
  - spec/lib/vanagon/optparse_spec.rb
270
272
  - spec/lib/vanagon/platform/deb_spec.rb
271
273
  - spec/lib/vanagon/platform/dsl_spec.rb
274
+ - spec/lib/vanagon/platform/osx_spec.rb
272
275
  - spec/lib/vanagon/platform/rpm/aix_spec.rb
273
276
  - spec/lib/vanagon/platform/rpm_spec.rb
277
+ - spec/lib/vanagon/platform/solaris_10_spec.rb
274
278
  - spec/lib/vanagon/platform/solaris_11_spec.rb
275
279
  - spec/lib/vanagon/platform/windows_spec.rb
276
280
  - spec/lib/vanagon/platform_spec.rb