vanagon 0.11.3 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -0
- data/bin/build +1 -1
- data/bin/build_host_info +2 -2
- data/bin/devkit +1 -1
- data/bin/inspect +2 -2
- data/bin/render +1 -1
- data/lib/vanagon/component.rb +69 -10
- data/lib/vanagon/component/dsl.rb +13 -4
- data/lib/vanagon/component/source.rb +5 -64
- data/lib/vanagon/component/source/git.rb +6 -6
- data/lib/vanagon/component/source/http.rb +2 -2
- data/lib/vanagon/component/source/local.rb +1 -2
- data/lib/vanagon/component/source/rewrite.rb +85 -0
- data/lib/vanagon/driver.rb +9 -9
- data/lib/vanagon/engine/ec2.rb +4 -4
- data/lib/vanagon/engine/hardware.rb +3 -3
- data/lib/vanagon/engine/pooler.rb +3 -3
- data/lib/vanagon/optparse.rb +1 -1
- data/lib/vanagon/platform.rb +18 -5
- data/lib/vanagon/platform/deb.rb +6 -1
- data/lib/vanagon/platform/dsl.rb +4 -0
- data/lib/vanagon/platform/rpm.rb +19 -3
- data/lib/vanagon/project.rb +8 -5
- data/lib/vanagon/project/dsl.rb +11 -2
- data/lib/vanagon/utilities.rb +3 -3
- data/spec/lib/vanagon/component/source/rewrite_spec.rb +55 -0
- data/spec/lib/vanagon/component/source_spec.rb +0 -72
- data/spec/lib/vanagon/component_spec.rb +53 -3
- data/spec/lib/vanagon/platform/rpm_spec.rb +6 -0
- data/spec/lib/vanagon/platform_spec.rb +62 -25
- data/spec/lib/vanagon/project/dsl_spec.rb +22 -0
- metadata +6 -3
@@ -44,6 +44,55 @@ describe "Vanagon::Component" do
|
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
|
+
describe "#get_source" do
|
48
|
+
before :each do
|
49
|
+
@workdir = Dir.mktmpdir
|
50
|
+
@fake_tar = "file://spec/fixtures/files/fake_file.txt.tar.gz"
|
51
|
+
end
|
52
|
+
|
53
|
+
subject do
|
54
|
+
# Initialize a new instance of Vanagon::Component and define a
|
55
|
+
# new secondary source that's *uncompressed*. We can now reason about
|
56
|
+
# this instance and test behavior for retrieving secondary sources.
|
57
|
+
Vanagon::Component.new('build-dir-test', {}, {}).tap do |comp|
|
58
|
+
comp.url = @fake_tar
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
before do
|
63
|
+
allow(subject)
|
64
|
+
.to receive(:source)
|
65
|
+
.and_return(OpenStruct.new(verify: true))
|
66
|
+
end
|
67
|
+
|
68
|
+
it "attempts to retrieve from a mirror before a canonical URI" do
|
69
|
+
allow(subject)
|
70
|
+
.to receive(:fetch_url)
|
71
|
+
.and_return(false)
|
72
|
+
|
73
|
+
allow(subject)
|
74
|
+
.to receive(:fetch_mirrors)
|
75
|
+
.and_return(true)
|
76
|
+
|
77
|
+
expect(subject).to receive(:fetch_mirrors)
|
78
|
+
expect(subject).not_to receive(:fetch_url)
|
79
|
+
|
80
|
+
subject.get_source(@workdir)
|
81
|
+
end
|
82
|
+
|
83
|
+
it "retrieves from a canonical URI if mirrors are unavailable" do
|
84
|
+
allow(subject)
|
85
|
+
.to receive(:fetch_url)
|
86
|
+
.and_return(true)
|
87
|
+
|
88
|
+
# We expect #get_source to attempt to use a mirror...
|
89
|
+
expect(subject).to receive(:fetch_mirrors).and_return(false)
|
90
|
+
# But we also expect it to fail when it tries #mirrors.
|
91
|
+
expect(subject).to receive(:fetch_url)
|
92
|
+
subject.get_source(@workdir)
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
47
96
|
describe "#get_sources" do
|
48
97
|
before :each do
|
49
98
|
@workdir = Dir.mktmpdir
|
@@ -55,17 +104,18 @@ describe "Vanagon::Component" do
|
|
55
104
|
|
56
105
|
subject do
|
57
106
|
# Initialize a new instance of Vanagon::Component and define a
|
58
|
-
# new secondary source that's *uncompressed*. We can now reason about
|
107
|
+
# new secondary source that's *uncompressed*. We can now reason about
|
59
108
|
# this instance and test behavior for retrieving secondary sources.
|
60
109
|
Vanagon::Component.new('build-dir-test', {}, {}).tap do |comp|
|
61
110
|
comp.sources << OpenStruct.new(url: @fake_file)
|
111
|
+
comp.mirrors << @fake_tar
|
62
112
|
end
|
63
|
-
end
|
113
|
+
end
|
64
114
|
|
65
115
|
it "copies uncompressed secondary sources into the workdir" do
|
66
116
|
subject.get_sources(@workdir)
|
67
117
|
expect(File.exist?(File.join(@workdir, @file_name))).to be true
|
68
|
-
end
|
118
|
+
end
|
69
119
|
|
70
120
|
subject do
|
71
121
|
# Initialize a new instance of Vanagon::Component and define a
|
@@ -26,6 +26,12 @@ describe 'Vanagon::Platform::RPM' do
|
|
26
26
|
end
|
27
27
|
end
|
28
28
|
|
29
|
+
describe '#source_output_dir' do
|
30
|
+
it "includes 'SRPMS'" do
|
31
|
+
expect(subject.source_output_dir).to include('SRPMS')
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
29
35
|
describe "#dist" do
|
30
36
|
it "uses explicit values when available" do
|
31
37
|
expect(subject.dist).to eq(derived_dist) unless platform[:dist]
|
@@ -4,41 +4,51 @@ describe "Vanagon::Platform" do
|
|
4
4
|
let(:platforms) do
|
5
5
|
[
|
6
6
|
{
|
7
|
-
:name
|
8
|
-
:os_name
|
9
|
-
:os_version
|
10
|
-
:architecture
|
11
|
-
:output_dir
|
12
|
-
:output_dir_with_target
|
13
|
-
:output_dir_empty_string
|
14
|
-
:
|
7
|
+
:name => "debian-6-i386",
|
8
|
+
:os_name => "debian",
|
9
|
+
:os_version => "6",
|
10
|
+
:architecture => "i386",
|
11
|
+
:output_dir => "deb/lucid/",
|
12
|
+
:output_dir_with_target => "deb/lucid/thing",
|
13
|
+
:output_dir_empty_string => "deb/lucid/",
|
14
|
+
:source_output_dir => "deb/lucid/",
|
15
|
+
:source_output_dir_with_target => "deb/lucid/thing",
|
16
|
+
:source_output_dir_empty_string => "deb/lucid/",
|
17
|
+
:block => %Q[
|
15
18
|
platform "debian-6-i386" do |plat|
|
16
19
|
plat.codename "lucid"
|
17
20
|
end ],
|
18
21
|
},
|
19
22
|
{
|
20
|
-
:name
|
21
|
-
:os_name
|
22
|
-
:os_version
|
23
|
-
:architecture
|
24
|
-
:output_dir
|
25
|
-
:output_dir_with_target
|
26
|
-
:output_dir_empty_string
|
27
|
-
:
|
23
|
+
:name => "el-5-i386",
|
24
|
+
:os_name => "el",
|
25
|
+
:os_version => "5",
|
26
|
+
:architecture => "i386",
|
27
|
+
:output_dir => "el/5/products/i386",
|
28
|
+
:output_dir_with_target => "el/5/thing/i386",
|
29
|
+
:output_dir_empty_string => "el/5/i386",
|
30
|
+
:source_output_dir => "el/5/products/SRPMS",
|
31
|
+
:source_output_dir_with_target => "el/5/thing/SRPMS",
|
32
|
+
:source_output_dir_empty_string => "el/5/SRPMS",
|
33
|
+
:block => %Q[ platform "el-5-i386" do |plat| end ],
|
28
34
|
},
|
29
35
|
{
|
30
|
-
:name
|
31
|
-
:os_name
|
32
|
-
:os_version
|
33
|
-
:codename
|
34
|
-
:architecture
|
35
|
-
:output_dir
|
36
|
-
:output_dir_with_target
|
37
|
-
:output_dir_empty_string
|
38
|
-
:
|
36
|
+
:name => "debian-6-i386",
|
37
|
+
:os_name => "debian",
|
38
|
+
:os_version => "6",
|
39
|
+
:codename => "lucid",
|
40
|
+
:architecture => "i386",
|
41
|
+
:output_dir => "updated/output",
|
42
|
+
:output_dir_with_target => "updated/output",
|
43
|
+
:output_dir_empty_string => "updated/output",
|
44
|
+
:source_output_dir => "updated/sources",
|
45
|
+
:source_output_dir_with_target => "updated/sources",
|
46
|
+
:source_output_dir_empty_string => "updated/sources",
|
47
|
+
:block => %Q[
|
39
48
|
platform "debian-6-i386" do |plat|
|
40
49
|
plat.codename "lucid"
|
41
50
|
plat.output_dir "updated/output"
|
51
|
+
plat.source_output_dir "updated/sources"
|
42
52
|
end ],
|
43
53
|
},
|
44
54
|
]
|
@@ -88,6 +98,33 @@ describe "Vanagon::Platform" do
|
|
88
98
|
end
|
89
99
|
end
|
90
100
|
|
101
|
+
describe "#source_output_dir" do
|
102
|
+
it "returns correct source dir" do
|
103
|
+
platforms.each do |plat|
|
104
|
+
cur_plat = Vanagon::Platform::DSL.new(plat[:name])
|
105
|
+
cur_plat.instance_eval(plat[:block])
|
106
|
+
expect(cur_plat._platform.source_output_dir).to eq(plat[:source_output_dir])
|
107
|
+
end
|
108
|
+
end
|
109
|
+
|
110
|
+
it "adds the target repo in the right way" do
|
111
|
+
platforms.each do |plat|
|
112
|
+
cur_plat = Vanagon::Platform::DSL.new(plat[:name])
|
113
|
+
cur_plat.instance_eval(plat[:block])
|
114
|
+
expect(cur_plat._platform.source_output_dir('thing')).to eq(plat[:source_output_dir_with_target])
|
115
|
+
end
|
116
|
+
end
|
117
|
+
|
118
|
+
it "does the right thing with empty strings" do
|
119
|
+
platforms.each do |plat|
|
120
|
+
cur_plat = Vanagon::Platform::DSL.new(plat[:name])
|
121
|
+
cur_plat.instance_eval(plat[:block])
|
122
|
+
expect(cur_plat._platform.source_output_dir('')).to eq(plat[:source_output_dir_empty_string])
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
|
91
128
|
describe "#architecture" do
|
92
129
|
it "returns the architecture for the platform" do
|
93
130
|
platforms.each do |plat|
|
@@ -142,6 +142,28 @@ end" }
|
|
142
142
|
end
|
143
143
|
end
|
144
144
|
|
145
|
+
describe '#generate_source_artifacts' do
|
146
|
+
it 'defaults to false' do
|
147
|
+
proj = Vanagon::Project::DSL.new('test-fixture', {})
|
148
|
+
proj.instance_eval(project_block)
|
149
|
+
expect(proj._project.source_artifacts).to eq(false)
|
150
|
+
end
|
151
|
+
|
152
|
+
it 'sets source_artifacts to true' do
|
153
|
+
proj = Vanagon::Project::DSL.new('test-fixture', {})
|
154
|
+
proj.instance_eval(project_block)
|
155
|
+
proj.generate_source_artifacts true
|
156
|
+
expect(proj._project.source_artifacts).to eq(true)
|
157
|
+
end
|
158
|
+
|
159
|
+
it 'sets source_artifacts to false' do
|
160
|
+
proj = Vanagon::Project::DSL.new('test-fixture', {})
|
161
|
+
proj.instance_eval(project_block)
|
162
|
+
proj.generate_source_artifacts false
|
163
|
+
expect(proj._project.source_artifacts).to eq(false)
|
164
|
+
end
|
165
|
+
end
|
166
|
+
|
145
167
|
describe '#identifier' do
|
146
168
|
it 'sets the identifier for the project' do
|
147
169
|
proj = Vanagon::Project::DSL.new('test-fixture', {})
|
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.12.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-
|
11
|
+
date: 2017-05-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -88,6 +88,7 @@ files:
|
|
88
88
|
- lib/vanagon/component/source/git.rb
|
89
89
|
- lib/vanagon/component/source/http.rb
|
90
90
|
- lib/vanagon/component/source/local.rb
|
91
|
+
- lib/vanagon/component/source/rewrite.rb
|
91
92
|
- lib/vanagon/driver.rb
|
92
93
|
- lib/vanagon/engine/always_be_scheduling.rb
|
93
94
|
- lib/vanagon/engine/base.rb
|
@@ -190,6 +191,7 @@ files:
|
|
190
191
|
- spec/lib/vanagon/component/source/git_spec.rb
|
191
192
|
- spec/lib/vanagon/component/source/http_spec.rb
|
192
193
|
- spec/lib/vanagon/component/source/local_spec.rb
|
194
|
+
- spec/lib/vanagon/component/source/rewrite_spec.rb
|
193
195
|
- spec/lib/vanagon/component/source_spec.rb
|
194
196
|
- spec/lib/vanagon/component_spec.rb
|
195
197
|
- spec/lib/vanagon/driver_spec.rb
|
@@ -237,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
237
239
|
version: '0'
|
238
240
|
requirements: []
|
239
241
|
rubyforge_project:
|
240
|
-
rubygems_version: 2.5
|
242
|
+
rubygems_version: 2.2.5
|
241
243
|
signing_key:
|
242
244
|
specification_version: 3
|
243
245
|
summary: All of your packages will fit into this van with this one simple trick.
|
@@ -250,6 +252,7 @@ test_files:
|
|
250
252
|
- spec/lib/vanagon/component/source/git_spec.rb
|
251
253
|
- spec/lib/vanagon/component/source/http_spec.rb
|
252
254
|
- spec/lib/vanagon/component/source/local_spec.rb
|
255
|
+
- spec/lib/vanagon/component/source/rewrite_spec.rb
|
253
256
|
- spec/lib/vanagon/component/source_spec.rb
|
254
257
|
- spec/lib/vanagon/component_spec.rb
|
255
258
|
- spec/lib/vanagon/driver_spec.rb
|