vanagon 0.15.19 → 0.15.20
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 +5 -5
- data/lib/vanagon/component.rb +19 -0
- data/lib/vanagon/component/dsl.rb +10 -0
- data/lib/vanagon/driver.rb +1 -1
- data/lib/vanagon/project.rb +22 -4
- data/resources/rpm/project.spec.erb +3 -0
- data/spec/lib/vanagon/component/dsl_spec.rb +10 -0
- data/spec/lib/vanagon/component_spec.rb +23 -0
- data/spec/lib/vanagon/project_spec.rb +60 -0
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA1:
|
|
3
|
+
metadata.gz: 468fb182c6b20bdf8a1257d1f90a89c5f3c501e7
|
|
4
|
+
data.tar.gz: 4b9937671809e342dece2d5f296ee4b1b8d7dc12
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: cdf0afd337b97afbd7f265319a0f238f946871b57be2e10d43462c77fd10635ca75cfb4c0bc5cc67705e305722fc2abbd31c1f90c442cc473f567c07713c5779
|
|
7
|
+
data.tar.gz: f1ddb2ea14f6167c36b32a8a454bdcbc208e31a3fc5acd99834b7723080efe92cf28bc96bc78858ba72ca4bbfa6529ecffa784f21424509d115bb719fb9a6242
|
data/lib/vanagon/component.rb
CHANGED
|
@@ -163,6 +163,7 @@ class Vanagon
|
|
|
163
163
|
@check = []
|
|
164
164
|
@patches = []
|
|
165
165
|
@files = Set.new
|
|
166
|
+
@ghost_files = Set.new
|
|
166
167
|
@directories = []
|
|
167
168
|
@replaces = []
|
|
168
169
|
@provides = []
|
|
@@ -188,6 +189,16 @@ class Vanagon
|
|
|
188
189
|
@files.add file
|
|
189
190
|
end
|
|
190
191
|
|
|
192
|
+
# Adds the given file to the list of %ghost files to be added to an
|
|
193
|
+
# rpm spec's %files.
|
|
194
|
+
#
|
|
195
|
+
# @param file [Vanagon::Common::Pathname] file to add to the ghost file set.
|
|
196
|
+
# @return [Set, nil] Returns @ghost_files if the file is successfully added
|
|
197
|
+
# to @ghost_files or nil if the file already exists.
|
|
198
|
+
def add_rpm_ghost_file(file)
|
|
199
|
+
@ghost_files.add file
|
|
200
|
+
end
|
|
201
|
+
|
|
191
202
|
# Deletes the given file from the list of files and returns @files.
|
|
192
203
|
#
|
|
193
204
|
# @param file [String] path of file to delete from a component's list of files
|
|
@@ -213,6 +224,14 @@ class Vanagon
|
|
|
213
224
|
@files.select(&:configfile?)
|
|
214
225
|
end
|
|
215
226
|
|
|
227
|
+
# Retrieve all the files intended as %ghost entries for an rpm spec
|
|
228
|
+
# %files section.
|
|
229
|
+
#
|
|
230
|
+
# @return [Array] of all the rpm %ghost files.
|
|
231
|
+
def rpm_ghost_files
|
|
232
|
+
@ghost_files.to_a
|
|
233
|
+
end
|
|
234
|
+
|
|
216
235
|
# @return [Set] a list of unique mirror URIs that should be used to
|
|
217
236
|
# retrieve the upstream source before attempting to retrieve from
|
|
218
237
|
# whatever URI was defined for #uri. If no mirrors are set and the
|
|
@@ -281,6 +281,16 @@ class Vanagon
|
|
|
281
281
|
@component.add_file Vanagon::Common::Pathname.file(target)
|
|
282
282
|
end
|
|
283
283
|
|
|
284
|
+
# Add a %ghost entry to the rpm %files section.
|
|
285
|
+
# This indicates a file that is tracked in the rpm database (the package
|
|
286
|
+
# manages it), but not installed. Used, for example, when setting up
|
|
287
|
+
# alternative packages for use with update-alternatives.
|
|
288
|
+
#
|
|
289
|
+
# @param path [String] installed path of the file.
|
|
290
|
+
def add_rpm_ghost_file(path)
|
|
291
|
+
@component.add_rpm_ghost_file(Vanagon::Common::Pathname.file(path))
|
|
292
|
+
end
|
|
293
|
+
|
|
284
294
|
# Sets the version for the component
|
|
285
295
|
#
|
|
286
296
|
# @param ver [String] version of the component
|
data/lib/vanagon/driver.rb
CHANGED
|
@@ -140,7 +140,7 @@ class Vanagon
|
|
|
140
140
|
@project.make_bill_of_materials(workdir)
|
|
141
141
|
# Don't generate packaging artifacts if no_packaging is set
|
|
142
142
|
@project.generate_packaging_artifacts(workdir) unless @project.no_packaging
|
|
143
|
-
@project.save_manifest_json
|
|
143
|
+
@project.save_manifest_json(@platform)
|
|
144
144
|
@engine.ship_workdir(workdir)
|
|
145
145
|
@engine.dispatch("(cd #{@engine.remote_workdir}; #{@platform.make} #{make_target})")
|
|
146
146
|
@engine.retrieve_built_artifact(@project.artifacts_to_fetch, @project.no_packaging)
|
data/lib/vanagon/project.rb
CHANGED
|
@@ -236,6 +236,16 @@ class Vanagon
|
|
|
236
236
|
files.flatten.uniq
|
|
237
237
|
end
|
|
238
238
|
|
|
239
|
+
# Collects any rpm %ghost files supplied by components
|
|
240
|
+
#
|
|
241
|
+
# @return [Array] array of all files to be specified as %ghost entries
|
|
242
|
+
# in an rpm %files section.
|
|
243
|
+
def get_rpm_ghost_files
|
|
244
|
+
files = []
|
|
245
|
+
files.push components.flat_map(&:rpm_ghost_files)
|
|
246
|
+
files.flatten.uniq
|
|
247
|
+
end
|
|
248
|
+
|
|
239
249
|
# Returns a filtered out set of components only including those
|
|
240
250
|
# components necessary to build a specific component. This is a
|
|
241
251
|
# recursive function that will call itself until it gets to a
|
|
@@ -683,14 +693,22 @@ class Vanagon
|
|
|
683
693
|
end
|
|
684
694
|
end
|
|
685
695
|
|
|
686
|
-
# Writes a json file at `ext/build_metadata
|
|
696
|
+
# Writes a json file at `ext/build_metadata.<project>.<platform>.json` containing information
|
|
687
697
|
# about what went into a built artifact
|
|
688
698
|
#
|
|
689
699
|
# @return [Hash] of build information
|
|
690
|
-
def save_manifest_json
|
|
700
|
+
def save_manifest_json(platform)
|
|
691
701
|
manifest = build_manifest_json(true)
|
|
692
|
-
|
|
693
|
-
|
|
702
|
+
ext_directory = 'ext'
|
|
703
|
+
FileUtils.mkdir_p ext_directory
|
|
704
|
+
|
|
705
|
+
metadata_file_name = "build_metadata.#{name}.#{platform.name}.json"
|
|
706
|
+
File.open(File.join(ext_directory, metadata_file_name), 'w') do |f|
|
|
707
|
+
f.write(manifest)
|
|
708
|
+
end
|
|
709
|
+
|
|
710
|
+
## VANAGON-132 Backwards compatibility: make a 'build_metadata.json' file
|
|
711
|
+
File.open(File.join(ext_directory, 'build_metadata.json'), 'w') do |f|
|
|
694
712
|
f.write(manifest)
|
|
695
713
|
end
|
|
696
714
|
end
|
|
@@ -366,6 +366,9 @@ fi
|
|
|
366
366
|
<%- get_files.each do |file| -%>
|
|
367
367
|
%attr(<%= file.mode || "-" %>, <%= file.owner || "-" %>, <%= file.group || "-" %>) <%= file.path %>
|
|
368
368
|
<%- end -%>
|
|
369
|
+
<%- get_rpm_ghost_files.each do |file| -%>
|
|
370
|
+
%ghost <%= file.path %>
|
|
371
|
+
<%- end -%>
|
|
369
372
|
|
|
370
373
|
%changelog
|
|
371
374
|
* <%= Time.now.strftime("%a %b %d %Y") %> <%= @vendor %> - <%= @version %>-<%= @release %>
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'vanagon/component/dsl'
|
|
2
2
|
require 'vanagon/common'
|
|
3
|
+
require 'vanagon/platform'
|
|
3
4
|
require 'json'
|
|
4
5
|
|
|
5
6
|
describe 'Vanagon::Component::DSL' do
|
|
@@ -859,4 +860,13 @@ end" }
|
|
|
859
860
|
expect(comp._component.directories.first).to eq(Vanagon::Common::Pathname.new('/a/b/c', mode: '0400', owner: 'olivia', group: 'release-engineering'))
|
|
860
861
|
end
|
|
861
862
|
end
|
|
863
|
+
|
|
864
|
+
describe '#add_rpm_ghost_file' do
|
|
865
|
+
let(:comp) { Vanagon::Component::DSL.new('ghost-test', {}, platform) }
|
|
866
|
+
|
|
867
|
+
it 'adds a ghost file as a Pathname object' do
|
|
868
|
+
comp.add_rpm_ghost_file('ghost')
|
|
869
|
+
expect(comp._component.rpm_ghost_files).to eq([Vanagon::Common::Pathname.file('ghost')])
|
|
870
|
+
end
|
|
871
|
+
end
|
|
862
872
|
end
|
|
@@ -241,4 +241,27 @@ describe "Vanagon::Component" do
|
|
|
241
241
|
end
|
|
242
242
|
end
|
|
243
243
|
end
|
|
244
|
+
|
|
245
|
+
describe 'rpm ghost files' do
|
|
246
|
+
let(:component) { Vanagon::Component.new('ghost-test', {}, {}) }
|
|
247
|
+
|
|
248
|
+
it 'initializes an empty set' do
|
|
249
|
+
expect(component.rpm_ghost_files).to eq([])
|
|
250
|
+
end
|
|
251
|
+
|
|
252
|
+
it 'adds a ghost file' do
|
|
253
|
+
expect(component.add_rpm_ghost_file('ghost')).to eq(Set.new(['ghost']))
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
it 'returns an array of ghost files' do
|
|
257
|
+
component.add_rpm_ghost_file('ghost')
|
|
258
|
+
expect(component.rpm_ghost_files).to eq(['ghost'])
|
|
259
|
+
end
|
|
260
|
+
|
|
261
|
+
it 'ignores duplicates' do
|
|
262
|
+
component.add_rpm_ghost_file('ghost')
|
|
263
|
+
component.add_rpm_ghost_file('ghost')
|
|
264
|
+
expect(component.rpm_ghost_files).to eq(['ghost'])
|
|
265
|
+
end
|
|
266
|
+
end
|
|
244
267
|
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
require 'vanagon/project'
|
|
2
2
|
require 'vanagon/driver'
|
|
3
3
|
require 'vanagon/errors'
|
|
4
|
+
require 'fakefs/spec_helpers'
|
|
4
5
|
|
|
5
6
|
describe 'Vanagon::Project' do
|
|
6
7
|
let(:component) { double(Vanagon::Component) }
|
|
@@ -413,6 +414,50 @@ describe 'Vanagon::Project' do
|
|
|
413
414
|
end
|
|
414
415
|
end
|
|
415
416
|
|
|
417
|
+
describe '#save_manifest_json' do
|
|
418
|
+
include FakeFS::SpecHelpers
|
|
419
|
+
let(:platform_name) { 'el-7-x86_64' }
|
|
420
|
+
let(:platform) { Vanagon::Platform.new(platform_name) }
|
|
421
|
+
before(:each) do
|
|
422
|
+
class Vanagon
|
|
423
|
+
class Project
|
|
424
|
+
BUILD_TIME = '2018-07-10T13:34:25-07:00'
|
|
425
|
+
VANAGON_VERSION = '0.0.0-rspec'
|
|
426
|
+
end
|
|
427
|
+
end
|
|
428
|
+
|
|
429
|
+
@proj = Vanagon::Project.new('test-project', platform)
|
|
430
|
+
end
|
|
431
|
+
|
|
432
|
+
it 'should generate a file with the expected build metadata' do
|
|
433
|
+
correct_sample_metadata = {
|
|
434
|
+
'packaging_type' => { 'vanagon' => '0.0.0-rspec' },
|
|
435
|
+
'version' => '123abcde',
|
|
436
|
+
'components' => { 'test-component-10' => { 'version' => '1.2.3' } },
|
|
437
|
+
'build_time' => '2018-07-10T13:34:25-07:00',
|
|
438
|
+
}
|
|
439
|
+
bad_sample_metadata = {
|
|
440
|
+
'BAD KEY' => 'BAD VALUE'
|
|
441
|
+
}
|
|
442
|
+
comp1 = Vanagon::Component.new('test-component-10', {}, {})
|
|
443
|
+
comp1.version = '1.2.3'
|
|
444
|
+
@proj.components << comp1
|
|
445
|
+
@proj.version = '123abcde'
|
|
446
|
+
FakeFS do
|
|
447
|
+
@proj.save_manifest_json(platform)
|
|
448
|
+
|
|
449
|
+
old_style_metadata = JSON.parse(File.read('ext/build_metadata.json'))
|
|
450
|
+
expect(old_style_metadata).to eq(correct_sample_metadata)
|
|
451
|
+
|
|
452
|
+
metadata_with_project_and_platform = JSON.parse(
|
|
453
|
+
File.read("ext/build_metadata.test-project.#{platform_name}.json"))
|
|
454
|
+
expect(metadata_with_project_and_platform).to eq(correct_sample_metadata)
|
|
455
|
+
expect(metadata_with_project_and_platform).not_to eq(bad_sample_metadata)
|
|
456
|
+
end
|
|
457
|
+
end
|
|
458
|
+
end
|
|
459
|
+
|
|
460
|
+
|
|
416
461
|
describe '#publish_yaml_settings' do
|
|
417
462
|
let(:platform_name) { 'aix-7.2-ppc' }
|
|
418
463
|
let(:platform) { Vanagon::Platform.new(platform_name) }
|
|
@@ -498,4 +543,19 @@ describe 'Vanagon::Project' do
|
|
|
498
543
|
expect(proj._project.generate_package).to eq([])
|
|
499
544
|
end
|
|
500
545
|
end
|
|
546
|
+
|
|
547
|
+
describe '#get_rpm_ghost_files' do
|
|
548
|
+
it 'returns an empty array when there are no ghost files' do
|
|
549
|
+
proj = Vanagon::Project.new('test-ghost', {})
|
|
550
|
+
expect(proj.get_rpm_ghost_files).to eq([])
|
|
551
|
+
end
|
|
552
|
+
|
|
553
|
+
it 'returns ghost files when some are set' do
|
|
554
|
+
proj = Vanagon::Project.new('test-ghosts', {})
|
|
555
|
+
comp = Vanagon::Component.new('ghosts', {}, {})
|
|
556
|
+
comp.add_rpm_ghost_file('ghost')
|
|
557
|
+
proj.components << comp
|
|
558
|
+
expect(proj.get_rpm_ghost_files).to eq(['ghost'])
|
|
559
|
+
end
|
|
560
|
+
end
|
|
501
561
|
end
|
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.15.
|
|
4
|
+
version: 0.15.20
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Puppet Labs
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-02-12 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: git
|
|
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
261
261
|
version: '0'
|
|
262
262
|
requirements: []
|
|
263
263
|
rubyforge_project:
|
|
264
|
-
rubygems_version: 2.
|
|
264
|
+
rubygems_version: 2.6.9
|
|
265
265
|
signing_key:
|
|
266
266
|
specification_version: 3
|
|
267
267
|
summary: All of your packages will fit into this van with this one simple trick.
|