vanagon 0.15.6 → 0.15.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/build +1 -1
- data/bin/sign +15 -0
- data/lib/vanagon/component.rb +6 -1
- data/lib/vanagon/component/source/git.rb +1 -1
- data/lib/vanagon/optparse.rb +0 -6
- data/lib/vanagon/platform.rb +17 -3
- data/lib/vanagon/platform/dsl.rb +1 -1
- data/lib/vanagon/project.rb +7 -1
- data/spec/lib/vanagon/component_spec.rb +31 -0
- data/spec/lib/vanagon/optparse_spec.rb +2 -2
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4336ec3a1ac6ab79828d52af974690dbeedcfe99
|
4
|
+
data.tar.gz: 73c7603edc4fd846c4342bf663d8bf72d5325c72
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4822d6e213a8b76ebf7ff5815b9dfa9c2d3ad33f67da339709a9dd2b1e81926c847c915980f319c20640fc71aeeba9b43605618f8b62b77f98851f464e739f07
|
7
|
+
data.tar.gz: ae5344f15540d70bda07160ab8988c37f7fd27525bfea99b9c8a8ca14a4c6e72ed6a86ed7f94156883780a6b4113d227b59c40df9b79047f28e6621c5a622d02
|
data/bin/build
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
load File.expand_path(File.join(File.dirname(__FILE__), "..", "lib", "vanagon.rb"))
|
3
3
|
|
4
|
-
optparse = Vanagon::OptParse.new("#{File.basename(__FILE__)} <project-name> <platform-name> [<target
|
4
|
+
optparse = Vanagon::OptParse.new("#{File.basename(__FILE__)} <project-name> <platform-name>[,<platform-name>...] [<target>,<target>...] [options]",
|
5
5
|
%i[workdir configdir engine preserve verbose skipcheck only_build remote-workdir])
|
6
6
|
options = optparse.parse! ARGV
|
7
7
|
|
data/bin/sign
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
ENV["PROJECT_ROOT"] = Dir.pwd
|
4
|
+
|
5
|
+
# Begin warning: This sign script is an internal tool.
|
6
|
+
# This is not intended to function outside of Puppet Labs' infrastructure.
|
7
|
+
# End of warning.
|
8
|
+
|
9
|
+
if Dir["output/**/*"].select { |entry| File.file?(entry) }.empty?
|
10
|
+
fail "No packages to sign in the output directory. Maybe you want to build some first?"
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'packaging'
|
14
|
+
Pkg::Util::RakeUtils.load_packaging_tasks
|
15
|
+
Pkg::Util::RakeUtils.invoke_task('pl:jenkins:sign_all', 'output')
|
data/lib/vanagon/component.rb
CHANGED
@@ -349,7 +349,12 @@ class Vanagon
|
|
349
349
|
unless @patches.empty?
|
350
350
|
patchdir = File.join(workdir, "patches")
|
351
351
|
FileUtils.mkdir_p(patchdir)
|
352
|
-
|
352
|
+
@patches.each do |p|
|
353
|
+
target = File.join(patchdir, File.basename(p.path))
|
354
|
+
raise Vanagon::Error, "Duplicate patch files detected, '#{p.path}' would have overwritten '#{target}'! Please ensure patch file names are unique across all components." if File.exist?(target)
|
355
|
+
|
356
|
+
FileUtils.cp(p.path, patchdir)
|
357
|
+
end
|
353
358
|
end
|
354
359
|
end
|
355
360
|
|
@@ -136,7 +136,7 @@ class Vanagon
|
|
136
136
|
# Checkout desired ref/sha, make noise about it, and fail
|
137
137
|
# entirely if we're unable to checkout that given ref/sha
|
138
138
|
def checkout!
|
139
|
-
warn "Checking out '#{ref}'
|
139
|
+
warn "Checking out '#{ref}' from Git repo '#{dirname}'"
|
140
140
|
clone.checkout(ref)
|
141
141
|
rescue ::Git::GitExecuteError
|
142
142
|
raise Vanagon::CheckoutFailed, "unable to checkout #{ref} from '#{url}'"
|
data/lib/vanagon/optparse.rb
CHANGED
@@ -44,12 +44,6 @@ class Vanagon
|
|
44
44
|
@options[:configdir] = configuration_directory
|
45
45
|
end
|
46
46
|
|
47
|
-
opts.on("-t HOST",
|
48
|
-
"--target HOST",
|
49
|
-
"Name of target machine for build and packaging (defaults to requesting from the pooler)") do |target|
|
50
|
-
@options[:target] = target
|
51
|
-
end
|
52
|
-
|
53
47
|
opts.on("-e ENGINE",
|
54
48
|
"--engine ENGINE",
|
55
49
|
"Custom engine to use [base, local, docker, pooler] (defaults to \"pooler\")") do |engine|
|
data/lib/vanagon/platform.rb
CHANGED
@@ -319,14 +319,14 @@ class Vanagon
|
|
319
319
|
# @return [true, false] true if it is a redhat variety or uses rpm
|
320
320
|
# under the hood, false otherwise
|
321
321
|
def is_rpm?
|
322
|
-
return !!@name.match(/^(aix|cisco-wrlinux|el|eos|fedora|sles|redhat)-.*$/)
|
322
|
+
return !!@name.match(/^(aix|cisco-wrlinux|el|eos|fedora|sles|redhat|redhatfips)-.*$/)
|
323
323
|
end
|
324
324
|
|
325
325
|
# Utility matcher to determine is the platform is an enterprise linux variety
|
326
326
|
#
|
327
327
|
# @return [true, false] true if it is a enterprise linux variety, false otherwise
|
328
328
|
def is_el?
|
329
|
-
return !!@name.match(/^(el|redhat)-.*$/)
|
329
|
+
return !!@name.match(/^(el|redhat|redhatfips)-.*$/)
|
330
330
|
end
|
331
331
|
|
332
332
|
# Utility matcher to determine is the platform is a sles variety
|
@@ -469,13 +469,27 @@ class Vanagon
|
|
469
469
|
final_archive = "output/#{name_and_version_and_platform}.tar.gz"
|
470
470
|
archive_directory = "#{project.name}-archive"
|
471
471
|
metadata = project.build_manifest_json(true)
|
472
|
+
|
473
|
+
# previously, we weren't properly handling the case of custom BOM paths.
|
474
|
+
# If we have a custom BOM path, during Makefile execution, the top-level
|
475
|
+
# BOM is moved to the custom path. So, when cleaning up BOMs for non-custom
|
476
|
+
# paths we just want to remove the BOM at the top level of the tarball.
|
477
|
+
# But, if we have a custom BOM path we want to move it back to where it
|
478
|
+
# was prior to the Makefile execution so we can preserve it as an artifact
|
479
|
+
# but not leave it to conflict if it's installed in the same custom path
|
480
|
+
# as a project using this archive.
|
481
|
+
bill_of_materials_command = 'rm -f bill-of-materials'
|
482
|
+
if project.bill_of_materials
|
483
|
+
bill_of_materials_command = "mv .#{project.bill_of_materials.path}/bill-of-materials ../.."
|
484
|
+
end
|
485
|
+
|
472
486
|
metadata.gsub!(/\n/, '\n')
|
473
487
|
[
|
474
488
|
"mkdir output",
|
475
489
|
"mkdir #{archive_directory}",
|
476
490
|
"gunzip -c #{name_and_version}.tar.gz | '#{tar}' -C #{archive_directory} -xf -",
|
477
491
|
"rm #{name_and_version}.tar.gz",
|
478
|
-
"cd #{archive_directory}/#{name_and_version};
|
492
|
+
"cd #{archive_directory}/#{name_and_version}; #{bill_of_materials_command}; #{tar} cf ../../#{name_and_version_and_platform}.tar *",
|
479
493
|
"gzip -9c #{name_and_version_and_platform}.tar > #{name_and_version_and_platform}.tar.gz",
|
480
494
|
"echo -e \"#{metadata}\" > output/#{name_and_version_and_platform}.json",
|
481
495
|
"cp bill-of-materials output/#{name_and_version_and_platform}-bill-of-materials ||:",
|
data/lib/vanagon/platform/dsl.rb
CHANGED
@@ -30,7 +30,7 @@ class Vanagon
|
|
30
30
|
@platform = case platform_name
|
31
31
|
when /^aix-/
|
32
32
|
Vanagon::Platform::RPM::AIX.new(@name)
|
33
|
-
when /^(cisco-wrlinux|el|fedora|redhat)-/
|
33
|
+
when /^(cisco-wrlinux|el|fedora|redhat|redhatfips)-/
|
34
34
|
Vanagon::Platform::RPM.new(@name)
|
35
35
|
when /^sles-/
|
36
36
|
Vanagon::Platform::RPM::SLES.new(@name)
|
data/lib/vanagon/project.rb
CHANGED
@@ -525,7 +525,13 @@ class Vanagon
|
|
525
525
|
#
|
526
526
|
# @return [Array] all the files and directories that should be included in the tarball
|
527
527
|
def get_tarball_files
|
528
|
-
files = ['
|
528
|
+
files = ['bill-of-materials']
|
529
|
+
|
530
|
+
if bill_of_materials
|
531
|
+
files = ["#{bill_of_materials.path}/bill-of-materials"]
|
532
|
+
end
|
533
|
+
|
534
|
+
files.push 'file-list'
|
529
535
|
files.push get_files.map(&:path)
|
530
536
|
files.push get_configfiles.map(&:path)
|
531
537
|
if @platform.is_windows?
|
@@ -193,4 +193,35 @@ describe "Vanagon::Component" do
|
|
193
193
|
subject.get_sources(@workdir)
|
194
194
|
end
|
195
195
|
end
|
196
|
+
|
197
|
+
describe "#get_patches" do
|
198
|
+
before :each do
|
199
|
+
@workdir = Dir.mktmpdir
|
200
|
+
end
|
201
|
+
|
202
|
+
let(:platform) do
|
203
|
+
plat = Vanagon::Platform::DSL.new('el-5-x86_64')
|
204
|
+
plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
|
205
|
+
plat._platform
|
206
|
+
end
|
207
|
+
|
208
|
+
let(:component) { Vanagon::Component::DSL.new('patches-test', {}, platform) }
|
209
|
+
|
210
|
+
context("when new patch file would overwrite existing patch file") do
|
211
|
+
let(:patch_file) { 'path/to/test.patch' }
|
212
|
+
|
213
|
+
before :each do
|
214
|
+
allow(FileUtils).to receive(:mkdir_p)
|
215
|
+
allow(FileUtils).to receive(:cp)
|
216
|
+
|
217
|
+
expect(File).to receive(:exist?).with(File.join(@workdir, 'patches', File.basename(patch_file))).and_return(true)
|
218
|
+
|
219
|
+
component.apply_patch(patch_file)
|
220
|
+
end
|
221
|
+
|
222
|
+
it "fails the build" do
|
223
|
+
expect { component._component.get_patches(@workdir) }.to raise_error(Vanagon::Error, /duplicate patch files/i)
|
224
|
+
end
|
225
|
+
end
|
226
|
+
end
|
196
227
|
end
|
@@ -45,7 +45,7 @@ describe Vanagon::OptParse do
|
|
45
45
|
|
46
46
|
|
47
47
|
describe "options that take a value" do
|
48
|
-
[:workdir, :configdir, :
|
48
|
+
[:workdir, :configdir, :engine].each do |option|
|
49
49
|
it "can create an option parser that accepts the #{option} option" do
|
50
50
|
subject = described_class.new("test", [option])
|
51
51
|
expect(subject.parse!(["--#{option}", "hello"])).to include(option => "hello")
|
@@ -53,7 +53,7 @@ describe Vanagon::OptParse do
|
|
53
53
|
end
|
54
54
|
|
55
55
|
describe "short options" do
|
56
|
-
[["w", :workdir], ["c", :configdir], ["
|
56
|
+
[["w", :workdir], ["c", :configdir], ["e", :engine]].each do |short, long|
|
57
57
|
it "maps the short option #{short} to #{long}" do
|
58
58
|
subject = described_class.new("test", [long])
|
59
59
|
expect(subject.parse!(["-#{short}", "hello"])).to include(long => "hello")
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Puppet Labs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-04-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: git
|
@@ -75,6 +75,7 @@ executables:
|
|
75
75
|
- ship
|
76
76
|
- render
|
77
77
|
- repo
|
78
|
+
- sign
|
78
79
|
- build_host_info
|
79
80
|
extensions: []
|
80
81
|
extra_rdoc_files: []
|
@@ -87,6 +88,7 @@ files:
|
|
87
88
|
- bin/render
|
88
89
|
- bin/repo
|
89
90
|
- bin/ship
|
91
|
+
- bin/sign
|
90
92
|
- lib/git/basic_submodules.rb
|
91
93
|
- lib/git/rev_list.rb
|
92
94
|
- lib/makefile.rb
|
@@ -257,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
257
259
|
version: '0'
|
258
260
|
requirements: []
|
259
261
|
rubyforge_project:
|
260
|
-
rubygems_version: 2.
|
262
|
+
rubygems_version: 2.6.10
|
261
263
|
signing_key:
|
262
264
|
specification_version: 3
|
263
265
|
summary: All of your packages will fit into this van with this one simple trick.
|