vanagon 0.45.0 → 0.46.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23fd297abecc66f734ce6a27b091b6a43ff8f21b0ba85912cdff37c732d64838
|
4
|
+
data.tar.gz: f810f07586f3bcdd6a4fc5ca3d12b6df2f0889a22c4c93112be6e804075642df
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd73cfd81cc332a1e4047199ff1efad2ce28ca49bbfef51b2684bf992ba2ca168ae5edc09e342a1a862f0f542ef05d8b2df5d5cdca140bb3d1dabec5d4a11465
|
7
|
+
data.tar.gz: 38542b260a3919118dbb395817b19b882078b7dc1fabf755a02db936aa99a411f2c578d654a9a0cbd139122039eeeff79ce991d8615715b8778ba43b3fcc5582
|
@@ -4,7 +4,7 @@ require 'vanagon/logger'
|
|
4
4
|
# This stupid library requires a capital 'E' in its name
|
5
5
|
# but it provides a wealth of useful constants
|
6
6
|
require 'English'
|
7
|
-
require '
|
7
|
+
require 'build/uri'
|
8
8
|
require 'git/basic_submodules'
|
9
9
|
require 'logger'
|
10
10
|
require 'timeout'
|
@@ -98,7 +98,7 @@ class Vanagon
|
|
98
98
|
opts = default_options.merge(options.reject { |k, v| v.nil? })
|
99
99
|
|
100
100
|
# Ensure that #url returns a URI object
|
101
|
-
@url = URI.parse(url.to_s)
|
101
|
+
@url = Build::URI.parse(url.to_s)
|
102
102
|
@log_url = @url.host + @url.path unless @url.host.nil? || @url.path.nil?
|
103
103
|
@ref = opts[:ref]
|
104
104
|
@dirname = opts[:dirname]
|
@@ -78,11 +78,12 @@ class Vanagon
|
|
78
78
|
return uri if rewrite_rules.empty?
|
79
79
|
if !!uri.match(/^git:http/)
|
80
80
|
VanagonLogger.info <<-HERE.undent
|
81
|
-
`
|
81
|
+
`build-uri` parsing doesn't get along with how we specify the source
|
82
82
|
type by prefixing `git`. As `rewrite_rules` are deprecated, we'll
|
83
83
|
replace `git:http` with `http` in your uri. At some point this will
|
84
84
|
break.
|
85
85
|
HERE
|
86
|
+
# build-uri does not support git:http://host/path
|
86
87
|
uri.sub!(/^git:http/, 'http')
|
87
88
|
end
|
88
89
|
url = URI.parse(uri)
|
@@ -13,55 +13,57 @@ describe 'Vanagon::Project' do
|
|
13
13
|
OpenStruct.new(:settings => {})
|
14
14
|
end
|
15
15
|
|
16
|
-
let(:project_block)
|
16
|
+
let(:project_block) do
|
17
17
|
"project 'test-fixture' do |proj|
|
18
18
|
proj.component 'some-component'
|
19
19
|
end"
|
20
|
-
|
20
|
+
end
|
21
21
|
|
22
|
-
let(:upstream_project_block)
|
22
|
+
let(:upstream_project_block) do
|
23
23
|
"project 'upstream-test' do |proj|
|
24
24
|
proj.setting(:test, 'upstream-test')
|
25
25
|
end"
|
26
|
-
|
26
|
+
end
|
27
27
|
|
28
|
-
let(:inheriting_project_block)
|
28
|
+
let(:inheriting_project_block) do
|
29
29
|
"project 'inheritance-test' do |proj|
|
30
30
|
proj.inherit_settings 'upstream-test', 'git://some.url', 'master'
|
31
31
|
end"
|
32
|
-
|
32
|
+
end
|
33
33
|
|
34
|
-
let(:inheriting_project_block_with_settings)
|
34
|
+
let(:inheriting_project_block_with_settings) do
|
35
35
|
"project 'inheritance-test' do |proj|
|
36
36
|
proj.setting(:merged, 'yup')
|
37
37
|
proj.inherit_settings 'upstream-test', 'git://some.url', 'master'
|
38
38
|
end"
|
39
|
-
|
39
|
+
end
|
40
40
|
|
41
|
-
let(:preset_inheriting_project_block)
|
41
|
+
let(:preset_inheriting_project_block) do
|
42
42
|
"project 'inheritance-test' do |proj|
|
43
43
|
proj.setting(:test, 'inheritance-test')
|
44
44
|
proj.inherit_settings 'upstream-test', 'git://some.url', 'master'
|
45
45
|
end"
|
46
|
-
|
46
|
+
end
|
47
47
|
|
48
|
-
let(:postset_inheriting_project_block)
|
48
|
+
let(:postset_inheriting_project_block) do
|
49
49
|
"project 'inheritance-test' do |proj|
|
50
50
|
proj.inherit_settings 'upstream-test', 'git://some.url', 'master'
|
51
51
|
proj.setting(:test, 'inheritance-test')
|
52
52
|
end"
|
53
|
-
|
53
|
+
end
|
54
54
|
|
55
|
-
let (:dummy_platform_settings)
|
55
|
+
let (:dummy_platform_settings) do
|
56
56
|
plat = Vanagon::Platform::DSL.new('debian-6-i386')
|
57
|
-
plat.instance_eval
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
57
|
+
plat.instance_eval <<-END_EVAL, __FILE__, __LINE__ + 1
|
58
|
+
platform 'debian-6-i386' do |plat|
|
59
|
+
plat.servicetype 'sysv'
|
60
|
+
plat.servicedir '/etc/init.d'
|
61
|
+
plat.defaultdir '/etc/default'
|
62
|
+
settings[:platform_test] = 'debian'
|
63
|
+
end
|
64
|
+
END_EVAL
|
63
65
|
plat._platform
|
64
|
-
|
66
|
+
end
|
65
67
|
|
66
68
|
|
67
69
|
describe '#vendor=' do
|
@@ -71,7 +73,8 @@ describe 'Vanagon::Project' do
|
|
71
73
|
|
72
74
|
it 'fails if vendor field does not include email address' do
|
73
75
|
project = Vanagon::Project.new('vendor-test', dummy_platform)
|
74
|
-
expect { project.vendor = bad_vendor }
|
76
|
+
expect { project.vendor = bad_vendor }
|
77
|
+
.to raise_error(Vanagon::Error, /Project vendor field must include email address/)
|
75
78
|
end
|
76
79
|
|
77
80
|
it 'sets project vendor to the supplied value' do
|
@@ -98,7 +101,6 @@ describe 'Vanagon::Project' do
|
|
98
101
|
end
|
99
102
|
|
100
103
|
describe '#get_root_directories' do
|
101
|
-
|
102
104
|
before do
|
103
105
|
allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
|
104
106
|
allow(Vanagon::Driver).to receive(:configdir).and_return(configdir)
|
@@ -108,22 +110,25 @@ describe 'Vanagon::Project' do
|
|
108
110
|
let(:test_sets) do
|
109
111
|
[
|
110
112
|
{
|
111
|
-
:directories => ["/opt/puppetlabs/bin", "/etc/puppetlabs", "/var/log/puppetlabs",
|
113
|
+
:directories => ["/opt/puppetlabs/bin", "/etc/puppetlabs", "/var/log/puppetlabs",
|
114
|
+
"/etc/puppetlabs/puppet", "/opt/puppetlabs"],
|
112
115
|
:results => ["/opt/puppetlabs", "/etc/puppetlabs", "/var/log/puppetlabs"],
|
113
116
|
},
|
114
117
|
{
|
115
|
-
:directories => ["/opt/puppetlabs/bin", "/etc/puppetlabs", "/var/log/puppetlabs",
|
116
|
-
|
118
|
+
:directories => ["/opt/puppetlabs/bin", "/etc/puppetlabs", "/var/log/puppetlabs",
|
119
|
+
"/etc/puppetlabs/puppet", "/opt/puppetlabs/lib"],
|
120
|
+
:results => ["/opt/puppetlabs/bin", "/etc/puppetlabs", "/var/log/puppetlabs",
|
121
|
+
"/opt/puppetlabs/lib"],
|
117
122
|
},
|
118
123
|
]
|
119
124
|
end
|
120
125
|
|
121
126
|
it 'returns only the highest level directories' do
|
122
127
|
test_sets.each do |set|
|
123
|
-
|
128
|
+
allow(component).to receive(:directories).and_return([])
|
124
129
|
proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform, [])
|
125
130
|
proj.instance_eval(project_block)
|
126
|
-
set[:directories].each {|dir| proj.directory dir }
|
131
|
+
set[:directories].each { |dir| proj.directory dir }
|
127
132
|
expect(proj._project.get_root_directories.sort).to eq(set[:results].sort)
|
128
133
|
end
|
129
134
|
end
|
@@ -132,16 +137,19 @@ describe 'Vanagon::Project' do
|
|
132
137
|
describe "#load_upstream_settings" do
|
133
138
|
before(:each) do
|
134
139
|
# stub out all of the git methods so we don't actually clone
|
135
|
-
allow(Vanagon::Component::Source::Git)
|
140
|
+
allow(Vanagon::Component::Source::Git)
|
141
|
+
.to receive(:valid_remote?)
|
142
|
+
.with(Build::URI.parse('git://some.url'))
|
143
|
+
.and_return(true)
|
136
144
|
git_source = Vanagon::Component::Source::Git.new('git://some.url', workdir: Dir.getwd)
|
137
145
|
allow(Vanagon::Component::Source::Git).to receive(:new).and_return(git_source)
|
138
|
-
|
146
|
+
allow(git_source).to receive(:fetch).and_return(true)
|
139
147
|
|
140
148
|
# stubs for the upstream project
|
141
149
|
upstream_proj = Vanagon::Project::DSL.new('upstream-test', configdir, upstream_platform, [])
|
142
150
|
upstream_proj.instance_eval(upstream_project_block)
|
143
|
-
|
144
|
-
|
151
|
+
allow(Vanagon::Project).to receive(:load_project).and_return(upstream_proj._project)
|
152
|
+
allow(Vanagon::Platform).to receive(:load_platform).and_return(upstream_platform)
|
145
153
|
|
146
154
|
class Vanagon
|
147
155
|
class Project
|
@@ -182,8 +190,8 @@ describe 'Vanagon::Project' do
|
|
182
190
|
before do
|
183
191
|
allow(Vanagon::Component)
|
184
192
|
.to receive(:load_component)
|
185
|
-
|
186
|
-
|
193
|
+
.with('some-component', any_args)
|
194
|
+
.and_return(component)
|
187
195
|
end
|
188
196
|
|
189
197
|
it 'loads settings set in platforms' do
|
@@ -232,8 +240,8 @@ describe 'Vanagon::Project' do
|
|
232
240
|
it "fails if downloading over HTTP without a valid sha1sum URI" do
|
233
241
|
allow(Vanagon::Component::Source::Http)
|
234
242
|
.to receive(:valid_url?)
|
235
|
-
|
236
|
-
|
243
|
+
.with(http_yaml_uri)
|
244
|
+
.and_return(true)
|
237
245
|
http_source = instance_double(Vanagon::Component::Source::Http)
|
238
246
|
allow(Vanagon::Component::Source).to receive(:source).and_return(http_source)
|
239
247
|
allow(http_source).to receive(:verify).and_return(true)
|
@@ -241,7 +249,7 @@ describe 'Vanagon::Project' do
|
|
241
249
|
expect { project.load_yaml_settings(http_yaml_uri) }.to raise_error(Vanagon::Error)
|
242
250
|
end
|
243
251
|
|
244
|
-
context "
|
252
|
+
context "with a valid source" do
|
245
253
|
before(:each) do
|
246
254
|
local_source = instance_double(Vanagon::Component::Source::Local)
|
247
255
|
allow(local_source).to receive(:fetch)
|
@@ -425,7 +433,7 @@ describe 'Vanagon::Project' do
|
|
425
433
|
@proj = Vanagon::Project.new('test-project', platform)
|
426
434
|
end
|
427
435
|
|
428
|
-
it '
|
436
|
+
it 'generates a hash with the expected build metadata' do
|
429
437
|
comp1 = Vanagon::Component.new('test-component1', {}, {})
|
430
438
|
comp1.version = '1.0.0'
|
431
439
|
@proj.components << comp1
|
@@ -439,7 +447,7 @@ describe 'Vanagon::Project' do
|
|
439
447
|
})
|
440
448
|
end
|
441
449
|
|
442
|
-
it '
|
450
|
+
it 'calls pretty-print when we want pretty json' do
|
443
451
|
comp1 = Vanagon::Component.new('test-component1', {}, {})
|
444
452
|
comp1.version = '1.0.0'
|
445
453
|
@proj.components << comp1
|
@@ -454,6 +462,7 @@ describe 'Vanagon::Project' do
|
|
454
462
|
include FakeFS::SpecHelpers
|
455
463
|
let(:platform_name) { 'el-7-x86_64' }
|
456
464
|
let(:platform) { Vanagon::Platform.new(platform_name) }
|
465
|
+
|
457
466
|
before(:each) do
|
458
467
|
class Vanagon
|
459
468
|
class Project
|
@@ -465,7 +474,7 @@ describe 'Vanagon::Project' do
|
|
465
474
|
@proj = Vanagon::Project.new('test-project', platform)
|
466
475
|
end
|
467
476
|
|
468
|
-
it '
|
477
|
+
it 'generates a file with the expected build metadata' do
|
469
478
|
correct_sample_metadata = {
|
470
479
|
'packaging_type' => { 'vanagon' => '0.0.0-rspec' },
|
471
480
|
'version' => '123abcde',
|
@@ -495,9 +504,6 @@ describe 'Vanagon::Project' do
|
|
495
504
|
|
496
505
|
|
497
506
|
describe '#publish_yaml_settings' do
|
498
|
-
let(:platform_name) { 'aix-7.2-ppc' }
|
499
|
-
let(:platform) { Vanagon::Platform.new(platform_name) }
|
500
|
-
|
501
507
|
subject(:project) do
|
502
508
|
project = Vanagon::Project.new('test-project', platform)
|
503
509
|
project.settings = { key: 'value' }
|
@@ -506,8 +512,16 @@ describe 'Vanagon::Project' do
|
|
506
512
|
project
|
507
513
|
end
|
508
514
|
|
509
|
-
let(:
|
510
|
-
let(:
|
515
|
+
let(:platform_name) { 'aix-7.2-ppc' }
|
516
|
+
let(:platform) { Vanagon::Platform.new(platform_name) }
|
517
|
+
|
518
|
+
|
519
|
+
let(:yaml_output_path) do
|
520
|
+
File.expand_path("test-project-version.#{platform_name}.settings.yaml", "output")
|
521
|
+
end
|
522
|
+
let(:sha1_output_path) do
|
523
|
+
File.expand_path("test-project-version.#{platform_name}.settings.yaml.sha1", "output")
|
524
|
+
end
|
511
525
|
|
512
526
|
let(:yaml_file) { double('yaml_file') }
|
513
527
|
let(:sha1_file) { double('sha1_file') }
|
@@ -516,10 +530,10 @@ describe 'Vanagon::Project' do
|
|
516
530
|
let(:sha1_object) { instance_double(Digest::SHA1, hexdigest: sha1_content) }
|
517
531
|
|
518
532
|
it 'writes project settings as yaml and a sha1sum for the settings to the output directory' do
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
expect(yaml_file).to receive(:write).with({key: 'value'}.to_yaml)
|
533
|
+
allow(File).to receive(:open).with(yaml_output_path, "w").and_yield(yaml_file)
|
534
|
+
allow(Digest::SHA1).to receive(:file).with(yaml_output_path).and_return(sha1_object)
|
535
|
+
allow(File).to receive(:open).with(sha1_output_path, "w").and_yield(sha1_file)
|
536
|
+
expect(yaml_file).to receive(:write).with({ key: 'value' }.to_yaml)
|
523
537
|
expect(sha1_file).to receive(:puts).with(sha1_content)
|
524
538
|
expect { project.publish_yaml_settings(platform) }.not_to raise_error
|
525
539
|
end
|
@@ -545,35 +559,39 @@ describe 'Vanagon::Project' do
|
|
545
559
|
describe '#generate_package' do
|
546
560
|
it "builds packages by default" do
|
547
561
|
platform = Vanagon::Platform::DSL.new('el-7-x86_64')
|
548
|
-
platform.instance_eval("platform 'el-7-x86_6' do |plat| end")
|
562
|
+
platform.instance_eval("platform 'el-7-x86_6' do |plat| end", __FILE__, __LINE__)
|
549
563
|
proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform._platform, [])
|
550
|
-
|
564
|
+
allow(platform._platform).to receive(:generate_package).and_return(["# making a package"])
|
551
565
|
expect(proj._project.generate_package).to eq(["# making a package"])
|
552
566
|
end
|
553
567
|
|
554
568
|
it "builds packages and archives if configured for both" do
|
555
569
|
platform = Vanagon::Platform::DSL.new('el-7-x86_64')
|
556
|
-
platform.instance_eval("platform 'el-7-x86_6' do |plat| end")
|
570
|
+
platform.instance_eval("platform 'el-7-x86_6' do |plat| end", __FILE__, __LINE__)
|
557
571
|
proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform._platform, [])
|
558
572
|
proj.generate_archives(true)
|
559
|
-
|
560
|
-
|
573
|
+
allow(platform._platform).to receive(:generate_package).and_return(["# making a package"])
|
574
|
+
allow(platform._platform)
|
575
|
+
.to receive(:generate_compiled_archive)
|
576
|
+
.and_return(["# making an archive"])
|
561
577
|
expect(proj._project.generate_package).to eq(["# making a package", "# making an archive"])
|
562
578
|
end
|
563
579
|
|
564
580
|
it "can build only archives" do
|
565
581
|
platform = Vanagon::Platform::DSL.new('el-7-x86_64')
|
566
|
-
platform.instance_eval("platform 'el-7-x86_6' do |plat| end")
|
582
|
+
platform.instance_eval("platform 'el-7-x86_6' do |plat| end", __FILE__, __LINE__)
|
567
583
|
proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform._platform, [])
|
568
584
|
proj.generate_archives(true)
|
569
585
|
proj.generate_packages(false)
|
570
|
-
|
586
|
+
allow(platform._platform)
|
587
|
+
.to receive(:generate_compiled_archive)
|
588
|
+
.and_return(["# making an archive"])
|
571
589
|
expect(proj._project.generate_package).to eq(["# making an archive"])
|
572
590
|
end
|
573
591
|
|
574
592
|
it "builds nothing if that's what you really want" do
|
575
593
|
platform = Vanagon::Platform::DSL.new('el-7-x86_64')
|
576
|
-
platform.instance_eval("platform 'el-7-x86_6' do |plat| end")
|
594
|
+
platform.instance_eval("platform 'el-7-x86_6' do |plat| end", __FILE__, __LINE__)
|
577
595
|
proj = Vanagon::Project::DSL.new('test-fixture', configdir, platform._platform, [])
|
578
596
|
proj.generate_packages(false)
|
579
597
|
expect(proj._project.generate_package).to eq([])
|
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.
|
4
|
+
version: 0.46.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet By Perforce
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -39,19 +39,19 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 1.13.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: build-uri
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '1.0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '1.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: lock_manager
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|