fpm-cookery 0.33.0 → 0.34.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 +4 -4
- data/CHANGELOG.md +16 -2
- data/docs/pages/getting-started.rst +2 -2
- data/fpm-cookery.gemspec +1 -1
- data/lib/fpm/cookery/cli.rb +6 -7
- data/lib/fpm/cookery/facts.rb +1 -1
- data/lib/fpm/cookery/hiera.rb +5 -1
- data/lib/fpm/cookery/hiera/scope.rb +10 -0
- data/lib/fpm/cookery/packager.rb +9 -3
- data/lib/fpm/cookery/recipe.rb +10 -2
- data/lib/fpm/cookery/source_handler.rb +1 -2
- data/lib/fpm/cookery/source_handler/noop.rb +4 -0
- data/lib/fpm/cookery/source_handler/svn.rb +12 -2
- data/lib/fpm/cookery/source_handler/template.rb +4 -0
- data/lib/fpm/cookery/source_integrity_check.rb +1 -1
- data/lib/fpm/cookery/utils.rb +19 -3
- data/lib/fpm/cookery/version.rb +1 -1
- data/recipes/activemq/recipe.rb +15 -0
- data/spec/recipe_spec.rb +73 -0
- data/spec/source_handler_spec.rb +45 -0
- data/spec/source_integrity_check_spec.rb +38 -0
- data/spec/utils_spec.rb +23 -0
- metadata +13 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 3086c69abf17303cb1bd39d5745435e2166e28a7
|
|
4
|
+
data.tar.gz: 4200c639a242f38313db74b31eb8231e749ea864
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 0d85461efb89f476da92433f2394a6db4ecbfc09258018cdc7a4b4151118d663a2c52c19540ae006ad1b548bb6f2ca946fa90bc44f1e6d3e80fa50a31532e805
|
|
7
|
+
data.tar.gz: f8550d9d07dfddaa4dd74d46f62294a66d35186c49fea36c95da77f7431870d25b8c3f8f93bee0da1cd87512b12ec7906b4abad7493bed1edd3297c9660f5cad
|
data/CHANGELOG.md
CHANGED
|
@@ -1,4 +1,18 @@
|
|
|
1
|
-
# v0.
|
|
1
|
+
# v0.34.0 (2019-06-01)
|
|
2
|
+
* Use factor defaults for `platform` and `target` values. (FooBarQuaxx / #189)
|
|
3
|
+
* Add `:username` and `:password` parameters to the SVN source handler. (tomeon / #191)
|
|
4
|
+
* Add `Recipe#extract` method to allow custom extraction logic.
|
|
5
|
+
* Fix tmux location in getting started guide. (cvhbsk / #195)
|
|
6
|
+
* Use RPM target for SLES platform. (FooBarQuaxx / #198)
|
|
7
|
+
* Add `targets` block for target specific setting in recipe. (FooBarQuaxx / #199)
|
|
8
|
+
* Ensure `:noop` sources are always treated as fetchable. (tomeon / #200)
|
|
9
|
+
* Allow usage of newer puppet versions. (lukasz-e / #201)
|
|
10
|
+
* Add sha512 checksum support. (b00ga / #202)
|
|
11
|
+
* Remove duplicate require. (FooBarQuaxx / #204)
|
|
12
|
+
* Automatically gunzip gzipped patch files. (davewongillies / #208)
|
|
13
|
+
* Add a golang util. (davewongillies / #209)
|
|
14
|
+
|
|
15
|
+
# v0.33.0 (2017-07-09)
|
|
2
16
|
* Hiera lookups of recipe data from templated YAML files. (BaxterStockman / #150)
|
|
3
17
|
* Travis-CI build matrix improvements. (thedrow / #155)
|
|
4
18
|
* Expose `lsbcodename` fact. (thedrow / #158)
|
|
@@ -17,7 +31,7 @@
|
|
|
17
31
|
* Add "safe\_yaml" dependency. (davewongillies / #186, #154)
|
|
18
32
|
* Add `rpm_dist` method. (sfzylad / #190)
|
|
19
33
|
|
|
20
|
-
# v0.32.0
|
|
34
|
+
# v0.32.0 (2016-06-14)
|
|
21
35
|
* Add `sourcedir` accessor that holds the path to the extracted source. (#132)
|
|
22
36
|
* Add support for DirRecipe and Directory Handler. (cas-ei / #147)
|
|
23
37
|
* Extend virtualenv support. (MrPrimate / #146)
|
|
@@ -67,8 +67,8 @@ afterwards. Use your text editor to add the code to the ``recipe.rb`` file.
|
|
|
67
67
|
|
|
68
68
|
name 'tmux'
|
|
69
69
|
version '1.9a'
|
|
70
|
-
homepage 'http://tmux.
|
|
71
|
-
source '
|
|
70
|
+
homepage 'http://tmux.github.io'
|
|
71
|
+
source 'https://github.com/tmux/tmux/releases/download/1.9a/tmux-1.9a.tar.gz'
|
|
72
72
|
|
|
73
73
|
build_depends 'libevent-dev', 'libncurses5-dev'
|
|
74
74
|
depends 'libevent-2.0-5'
|
data/fpm-cookery.gemspec
CHANGED
|
@@ -24,7 +24,7 @@ Gem::Specification.new do |s|
|
|
|
24
24
|
s.add_development_dependency "simplecov", "~> 0.11"
|
|
25
25
|
s.add_runtime_dependency "fpm", "~> 1.1"
|
|
26
26
|
s.add_runtime_dependency "facter"
|
|
27
|
-
s.add_runtime_dependency "puppet", "
|
|
27
|
+
s.add_runtime_dependency "puppet", ">= 3.4", "< 6.0"
|
|
28
28
|
s.add_runtime_dependency "addressable", "~> 2.3.8"
|
|
29
29
|
s.add_runtime_dependency "systemu"
|
|
30
30
|
s.add_runtime_dependency "json", ">= 1.7.7", "< 2.0"
|
data/lib/fpm/cookery/cli.rb
CHANGED
|
@@ -59,18 +59,17 @@ module FPM
|
|
|
59
59
|
end
|
|
60
60
|
|
|
61
61
|
# Override the detected platform.
|
|
62
|
-
if platform
|
|
62
|
+
if platform.nil?
|
|
63
|
+
config.platform = FPM::Cookery::Facts.platform
|
|
64
|
+
else
|
|
63
65
|
FPM::Cookery::Facts.platform = platform
|
|
64
66
|
end
|
|
65
67
|
|
|
66
|
-
if target
|
|
68
|
+
if target.nil?
|
|
69
|
+
config.target = FPM::Cookery::Facts.target
|
|
70
|
+
else
|
|
67
71
|
FPM::Cookery::Facts.target = target
|
|
68
72
|
end
|
|
69
|
-
|
|
70
|
-
if FPM::Cookery::Facts.target.nil?
|
|
71
|
-
Log.error "No target given and we're unable to detect your platform"
|
|
72
|
-
exit 1
|
|
73
|
-
end
|
|
74
73
|
end
|
|
75
74
|
|
|
76
75
|
def execute
|
data/lib/fpm/cookery/facts.rb
CHANGED
|
@@ -31,7 +31,7 @@ module FPM
|
|
|
31
31
|
def target
|
|
32
32
|
@target ||= case platform
|
|
33
33
|
when :centos, :redhat, :fedora, :amazon,
|
|
34
|
-
:scientific, :oraclelinux
|
|
34
|
+
:scientific, :oraclelinux, :sles then :rpm
|
|
35
35
|
when :debian, :ubuntu then :deb
|
|
36
36
|
when :darwin then :osxpkg
|
|
37
37
|
when :alpine then :apk
|
data/lib/fpm/cookery/hiera.rb
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
require 'hiera'
|
|
2
|
+
require 'hiera/version'
|
|
2
3
|
require 'fpm/cookery/hiera/defaults'
|
|
3
4
|
require 'fpm/cookery/hiera/scope'
|
|
4
5
|
require 'fpm/cookery/log/hiera'
|
|
@@ -26,7 +27,10 @@ module FPM
|
|
|
26
27
|
# Provides a default scope, and attempts to look up the key both as a
|
|
27
28
|
# string and as a symbol.
|
|
28
29
|
def lookup(key, default = nil, scope = self.scope, *rest)
|
|
29
|
-
|
|
30
|
+
|
|
31
|
+
(Gem::Version.new(::Hiera.version) < Gem::Version.new('2.0.0') &&
|
|
32
|
+
super(key.to_sym, default, scope, *rest)) ||
|
|
33
|
+
super(key.to_s, default, scope, *rest)
|
|
30
34
|
end
|
|
31
35
|
alias_method :[], :lookup
|
|
32
36
|
end
|
|
@@ -29,6 +29,16 @@ module FPM
|
|
|
29
29
|
result.value
|
|
30
30
|
end
|
|
31
31
|
end
|
|
32
|
+
|
|
33
|
+
# Newer versions of Hiera requires also +#include?+ method for context
|
|
34
|
+
def include?(name)
|
|
35
|
+
[recipe, FPM::Cookery::Facts].each do |source|
|
|
36
|
+
return true if source.respond_to?(name)
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
# If not found, check in +Facter+.
|
|
40
|
+
! Facter[name].nil?
|
|
41
|
+
end
|
|
32
42
|
end
|
|
33
43
|
end
|
|
34
44
|
end
|
data/lib/fpm/cookery/packager.rb
CHANGED
|
@@ -90,7 +90,7 @@ module FPM
|
|
|
90
90
|
if source.checksum?
|
|
91
91
|
SourceIntegrityCheck.new(recipe).tap do |check|
|
|
92
92
|
if check.checksum_missing?
|
|
93
|
-
Log.warn 'Recipe does not provide a checksum. (sha256, sha1 or md5)'
|
|
93
|
+
Log.warn 'Recipe does not provide a checksum. (sha512, sha256, sha1 or md5)'
|
|
94
94
|
Log.puts <<-__WARN
|
|
95
95
|
Digest: #{check.digest}
|
|
96
96
|
Checksum: #{check.checksum_actual}
|
|
@@ -123,7 +123,13 @@ module FPM
|
|
|
123
123
|
extracted_source = File.read(extract_cookie).chomp
|
|
124
124
|
Log.debug "Extract cookie exists, using existing source directory: #{extracted_source}"
|
|
125
125
|
else
|
|
126
|
-
|
|
126
|
+
# First check if the Recipe#extract method returns a source location
|
|
127
|
+
extracted_source = recipe.extract
|
|
128
|
+
if extracted_source.nil?
|
|
129
|
+
# Recipe extraction method didn't return the extracted source
|
|
130
|
+
# so we use the extraction method of the source handler
|
|
131
|
+
extracted_source = source.extract
|
|
132
|
+
end
|
|
127
133
|
File.open(extract_cookie, 'w', 0644) {|f| f.puts(extracted_source) }
|
|
128
134
|
end
|
|
129
135
|
|
|
@@ -168,7 +174,7 @@ module FPM
|
|
|
168
174
|
end
|
|
169
175
|
end #end chdir extracted_source
|
|
170
176
|
end #end chdir builddir
|
|
171
|
-
end #end
|
|
177
|
+
end #end source_handler.fetchable?
|
|
172
178
|
|
|
173
179
|
if skip_package?
|
|
174
180
|
Log.info "Package building disabled"
|
data/lib/fpm/cookery/recipe.rb
CHANGED
|
@@ -19,7 +19,6 @@ require 'fpm/cookery/package/npm'
|
|
|
19
19
|
require 'fpm/cookery/package/pear'
|
|
20
20
|
require 'fpm/cookery/package/python'
|
|
21
21
|
require 'fpm/cookery/package/virtualenv'
|
|
22
|
-
require 'fpm/cookery/log'
|
|
23
22
|
|
|
24
23
|
module FPM
|
|
25
24
|
module Cookery
|
|
@@ -32,7 +31,7 @@ module FPM
|
|
|
32
31
|
extend FPM::Cookery::InheritableAttr
|
|
33
32
|
|
|
34
33
|
attr_rw :arch, :description, :rpm_dist, :homepage, :maintainer, :md5, :name,
|
|
35
|
-
:revision, :section, :sha1, :sha256, :spec, :vendor, :version,
|
|
34
|
+
:revision, :section, :sha1, :sha256, :sha512, :spec, :vendor, :version,
|
|
36
35
|
:pre_install, :post_install, :pre_uninstall, :post_uninstall,
|
|
37
36
|
:license, :omnibus_package, :omnibus_dir, :chain_package,
|
|
38
37
|
:default_prefix
|
|
@@ -65,6 +64,10 @@ module FPM
|
|
|
65
64
|
Array(archs).member?(FPM::Cookery::Facts.arch) and block_given? ? yield : false
|
|
66
65
|
end
|
|
67
66
|
|
|
67
|
+
def targets(valid_targets)
|
|
68
|
+
Array(valid_targets).member?(FPM::Cookery::Facts.target) and block_given? ? yield : false
|
|
69
|
+
end
|
|
70
|
+
|
|
68
71
|
def platform
|
|
69
72
|
FPM::Cookery::Facts.platform
|
|
70
73
|
end
|
|
@@ -143,6 +146,11 @@ module FPM
|
|
|
143
146
|
apply unless defer_application
|
|
144
147
|
end
|
|
145
148
|
|
|
149
|
+
# Custom source extraction code, must return the extracted source directory.
|
|
150
|
+
def extract
|
|
151
|
+
nil
|
|
152
|
+
end
|
|
153
|
+
|
|
146
154
|
def to_h
|
|
147
155
|
attr_registry.values.flatten.each_with_object({}) do |m, a|
|
|
148
156
|
a[m] = send(m) unless m == :attr_registry
|
|
@@ -17,8 +17,7 @@ module FPM
|
|
|
17
17
|
REQUIRED_METHODS = [:fetch, :extract]
|
|
18
18
|
|
|
19
19
|
extend Forwardable
|
|
20
|
-
def_delegators :@handler, :fetch, :extract, :local_path, :checksum?
|
|
21
|
-
def_delegators :@source, :fetchable?
|
|
20
|
+
def_delegators :@handler, :fetch, :extract, :local_path, :checksum?, :fetchable?
|
|
22
21
|
|
|
23
22
|
attr_reader :source_url
|
|
24
23
|
|
|
@@ -25,9 +25,19 @@ module FPM
|
|
|
25
25
|
|
|
26
26
|
private
|
|
27
27
|
def svn(url, path)
|
|
28
|
+
extra_args = []
|
|
29
|
+
|
|
30
|
+
extra_args << '--ignore-externals' if !options[:externals]
|
|
31
|
+
|
|
32
|
+
[:username, :password].each do |opt|
|
|
33
|
+
if options.key? opt
|
|
34
|
+
extra_args << "--#{opt}" << options[opt]
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
|
|
28
38
|
revision = options[:revision] || 'HEAD'
|
|
29
|
-
|
|
30
|
-
safesystem('svn', 'export', '--force',
|
|
39
|
+
|
|
40
|
+
safesystem('svn', 'export', '--force', *extra_args, '-q', '-r', revision, url, path)
|
|
31
41
|
end
|
|
32
42
|
|
|
33
43
|
def extracted_source
|
data/lib/fpm/cookery/utils.rb
CHANGED
|
@@ -6,8 +6,13 @@ module FPM
|
|
|
6
6
|
protected
|
|
7
7
|
# From fpm. (lib/fpm/util.rb)
|
|
8
8
|
def safesystem(*args)
|
|
9
|
-
#
|
|
10
|
-
|
|
9
|
+
# Process the arguments:
|
|
10
|
+
# - Convert all arguments to strings because "system" cannot handle
|
|
11
|
+
# keys (avoids TypeError)
|
|
12
|
+
# - Make sure to avoid nil elements in args. This might happen on 1.8.
|
|
13
|
+
safe_args = args.map(&:to_s).compact.flatten
|
|
14
|
+
Log.debug("Executing command: #{safe_args.inspect}")
|
|
15
|
+
success = system(*safe_args)
|
|
11
16
|
if !success
|
|
12
17
|
raise "'system(#{args.inspect})' failed with error code: #{$?.exitstatus}"
|
|
13
18
|
end
|
|
@@ -83,7 +88,18 @@ module FPM
|
|
|
83
88
|
def patch(src, level = 0)
|
|
84
89
|
raise "patch level must be integer" unless level.is_a?(Fixnum)
|
|
85
90
|
raise "#{src} does not exist" unless File.exist? src
|
|
86
|
-
|
|
91
|
+
|
|
92
|
+
if "#{src}".end_with?('.gz')
|
|
93
|
+
safesystem "gunzip -c #{src} | patch -p#{level} --batch"
|
|
94
|
+
else
|
|
95
|
+
safesystem "patch -p#{level} --batch < #{src}"
|
|
96
|
+
end
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
def go(*args)
|
|
100
|
+
args = argument_build(*args)
|
|
101
|
+
args.each {|a| a == '--mod=vendor' && ENV['GO111MODULE'] = 'on' }
|
|
102
|
+
safesystem 'go', *args
|
|
87
103
|
end
|
|
88
104
|
end
|
|
89
105
|
end
|
data/lib/fpm/cookery/version.rb
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class ActiveMQ < FPM::Cookery::Recipe
|
|
2
|
+
name 'apache-activemq'
|
|
3
|
+
version '5.15.6'
|
|
4
|
+
url 'http://archive.apache.org/dist/activemq/5.15.6/apache-activemq-5.15.6-bin.tar.gz'
|
|
5
|
+
# Checksum from http://archive.apache.org/dist/activemq/5.15.6/apache-activemq-5.15.6-bin.tar.gz.sha512
|
|
6
|
+
sha512 'a1b931a25c513f83f4f712cc126ee67a2b196ea23a243aa6cafe357ea03f721fba6cb566701e5c0e1f2f7ad8954807361364635c45d5069ec2dbf0ba5c6b588b'
|
|
7
|
+
|
|
8
|
+
def build
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
def install
|
|
12
|
+
opt.install Dir["#{builddir}/*"]
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
end
|
data/spec/recipe_spec.rb
CHANGED
|
@@ -111,6 +111,12 @@ describe "Recipe" do
|
|
|
111
111
|
end
|
|
112
112
|
end
|
|
113
113
|
|
|
114
|
+
describe "#sha512" do
|
|
115
|
+
it "can be set" do
|
|
116
|
+
check_attribute(:sha512, '123456789abcdef')
|
|
117
|
+
end
|
|
118
|
+
end
|
|
119
|
+
|
|
114
120
|
describe "#sha256" do
|
|
115
121
|
it "can be set" do
|
|
116
122
|
check_attribute(:sha256, '123456789abcdef')
|
|
@@ -465,6 +471,67 @@ describe "Recipe" do
|
|
|
465
471
|
end
|
|
466
472
|
end
|
|
467
473
|
|
|
474
|
+
describe ".targets" do
|
|
475
|
+
before do
|
|
476
|
+
FPM::Cookery::Facts.class_eval do
|
|
477
|
+
class << self
|
|
478
|
+
alias_method :target_orig, :target
|
|
479
|
+
def target; :rpm; end
|
|
480
|
+
end
|
|
481
|
+
end
|
|
482
|
+
end
|
|
483
|
+
|
|
484
|
+
after do
|
|
485
|
+
FPM::Cookery::Facts.class_eval do
|
|
486
|
+
class << self
|
|
487
|
+
alias_method :target, :target_orig
|
|
488
|
+
end
|
|
489
|
+
end
|
|
490
|
+
end
|
|
491
|
+
|
|
492
|
+
describe "with a list of targets" do
|
|
493
|
+
it "allows target specific settings" do
|
|
494
|
+
recipe_klass.class_eval do
|
|
495
|
+
vendor 'a'
|
|
496
|
+
|
|
497
|
+
targets [:rpm, :deb] do
|
|
498
|
+
vendor 'b'
|
|
499
|
+
end
|
|
500
|
+
end
|
|
501
|
+
|
|
502
|
+
expect(recipe_klass.new.vendor).to eq('b')
|
|
503
|
+
end
|
|
504
|
+
end
|
|
505
|
+
|
|
506
|
+
describe "with a single target" do
|
|
507
|
+
it "allows target specific settings" do
|
|
508
|
+
recipe_klass.class_eval do
|
|
509
|
+
vendor 'a'
|
|
510
|
+
|
|
511
|
+
targets :rpm do
|
|
512
|
+
vendor 'b'
|
|
513
|
+
end
|
|
514
|
+
end
|
|
515
|
+
|
|
516
|
+
expect(recipe_klass.new.vendor).to eq('b')
|
|
517
|
+
end
|
|
518
|
+
end
|
|
519
|
+
|
|
520
|
+
describe "without a matching target" do
|
|
521
|
+
it "does not set target specific settings" do
|
|
522
|
+
recipe_klass.class_eval do
|
|
523
|
+
vendor 'a'
|
|
524
|
+
|
|
525
|
+
targets :deb do
|
|
526
|
+
vendor 'b'
|
|
527
|
+
end
|
|
528
|
+
end
|
|
529
|
+
|
|
530
|
+
expect(recipe_klass.new.vendor).to eq('a')
|
|
531
|
+
end
|
|
532
|
+
end
|
|
533
|
+
end
|
|
534
|
+
|
|
468
535
|
describe ".platform" do
|
|
469
536
|
it 'matches the current platform from FPM::Cookery::Facts' do
|
|
470
537
|
expect(recipe_klass.platform).to eq(FPM::Cookery::Facts.platform)
|
|
@@ -667,4 +734,10 @@ describe "Recipe" do
|
|
|
667
734
|
end
|
|
668
735
|
end
|
|
669
736
|
end
|
|
737
|
+
|
|
738
|
+
describe "#extract" do
|
|
739
|
+
it "returns nil by default" do
|
|
740
|
+
expect(recipe.extract).to be_nil
|
|
741
|
+
end
|
|
742
|
+
end
|
|
670
743
|
end
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
require 'fpm/cookery/source'
|
|
3
|
+
require 'fpm/cookery/source_handler'
|
|
4
|
+
|
|
5
|
+
describe 'SourceHandler' do
|
|
6
|
+
let(:cachedir) { FPM::Cookery::Path.new('/tmp/cache') }
|
|
7
|
+
let(:builddir) { FPM::Cookery::Path.new('/tmp/build') }
|
|
8
|
+
|
|
9
|
+
describe "#fetchable?" do
|
|
10
|
+
context "when using the noop source handler" do
|
|
11
|
+
it "always returns true" do
|
|
12
|
+
nil_source = FPM::Cookery::Source.new(nil, :with => :noop)
|
|
13
|
+
empty_source = FPM::Cookery::Source.new('', :with => :noop)
|
|
14
|
+
|
|
15
|
+
nil_handler = FPM::Cookery::SourceHandler.new(nil_source, cachedir, builddir)
|
|
16
|
+
empty_handler = FPM::Cookery::SourceHandler.new(empty_source, cachedir, builddir)
|
|
17
|
+
|
|
18
|
+
expect(nil_handler.fetchable?).to eq(true)
|
|
19
|
+
expect(empty_handler.fetchable?).to eq(true)
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
context "otherwise" do
|
|
24
|
+
it "returns true when the source URI is non-empty" do
|
|
25
|
+
fetchable_sources = [
|
|
26
|
+
['https://somedomain.io/project-1.2-3.tar.xz'],
|
|
27
|
+
['https://git.mysite.cat/atonic.git', :with => :git],
|
|
28
|
+
['/var/src', :with => :directory],
|
|
29
|
+
].map { |s| FPM::Cookery::Source.new(*s) }
|
|
30
|
+
|
|
31
|
+
unfetchable_sources = [
|
|
32
|
+
[''],
|
|
33
|
+
[nil, :with => :git],
|
|
34
|
+
['', :with => :directory],
|
|
35
|
+
].map { |s| FPM::Cookery::Source.new(*s) }
|
|
36
|
+
|
|
37
|
+
fetchable_handlers = fetchable_sources.map { |fs| FPM::Cookery::SourceHandler.new(fs, cachedir, builddir) }
|
|
38
|
+
unfetchable_handlers = unfetchable_sources.map { |us| FPM::Cookery::SourceHandler.new(us, cachedir, builddir) }
|
|
39
|
+
|
|
40
|
+
expect(fetchable_handlers.map(&:fetchable?)).to all(eq(true))
|
|
41
|
+
expect(unfetchable_handlers.map(&:fetchable?)).to all(eq(false))
|
|
42
|
+
end
|
|
43
|
+
end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -48,6 +48,44 @@ describe "SourceIntegrityCheck" do
|
|
|
48
48
|
end
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
+
describe "with a correct sha512 checksum defined" do
|
|
52
|
+
describe "#error?" do
|
|
53
|
+
it "returns false" do
|
|
54
|
+
allow(recipe).to receive(:sha512).and_return('488f02db910d6a12f194ed62d7e6a89d9e408c8354acb875cf81c5fb284022cd320d4803a968f8754f5cc53797d515994619f669d359e3b4f989801a39ee6ffd')
|
|
55
|
+
|
|
56
|
+
expect(check.error?).to eq(false)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
describe "with a wrong sha512 checksum defined" do
|
|
62
|
+
before do
|
|
63
|
+
allow(recipe).to receive(:sha512).and_return('xxxx02db910d6a12f194ed62d7e6a89d9e408c8354acb875cf81c5fb284022cd320d4803a968f8754f5cc53797d515994619f669d359e3b4f989801a39ee6ffd')
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
describe "#error?" do
|
|
67
|
+
it "returns true" do
|
|
68
|
+
expect(check.error?).to eq(true)
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it "has checksum_expected set to the expected checksum" do
|
|
73
|
+
expect(check.checksum_expected).to eq('xxxx02db910d6a12f194ed62d7e6a89d9e408c8354acb875cf81c5fb284022cd320d4803a968f8754f5cc53797d515994619f669d359e3b4f989801a39ee6ffd')
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
it "has checksum_actual set to the actual checksum" do
|
|
77
|
+
expect(check.checksum_actual).to eq('488f02db910d6a12f194ed62d7e6a89d9e408c8354acb875cf81c5fb284022cd320d4803a968f8754f5cc53797d515994619f669d359e3b4f989801a39ee6ffd')
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
it "has filename set" do
|
|
81
|
+
expect(check.filename).to eq(fixture_path('test-source-1.0.tar.gz'))
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
it "has digest set to :sha512" do
|
|
85
|
+
expect(check.digest).to eq(:sha512)
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
51
89
|
describe "with a correct sha256 checksum defined" do
|
|
52
90
|
describe "#error?" do
|
|
53
91
|
it "returns false" do
|
data/spec/utils_spec.rb
CHANGED
|
@@ -20,6 +20,14 @@ describe FPM::Cookery::Utils do
|
|
|
20
20
|
def run_configure_mix
|
|
21
21
|
configure '--first=okay', '--second=okay', :hello_world => true, :prefix => '/usr', 'a-dash' => 1
|
|
22
22
|
end
|
|
23
|
+
|
|
24
|
+
def run_go_build
|
|
25
|
+
go 'build', '-mod=vendor', '-v'
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def run_go_build_hash
|
|
29
|
+
go :build, :mod => 'vendor', :v => true
|
|
30
|
+
end
|
|
23
31
|
end
|
|
24
32
|
|
|
25
33
|
let(:test) { TestUtils.new }
|
|
@@ -58,4 +66,19 @@ describe FPM::Cookery::Utils do
|
|
|
58
66
|
end
|
|
59
67
|
end
|
|
60
68
|
end
|
|
69
|
+
describe '#go' do
|
|
70
|
+
context 'with a list of string arguments' do
|
|
71
|
+
it 'calls go with the correct arguments' do
|
|
72
|
+
expect(test).to receive(:system).with('go', 'build', '-mod=vendor', '-v')
|
|
73
|
+
test.run_go_build
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
context 'with hash arguments' do
|
|
78
|
+
it 'calls go with the correct arguments' do
|
|
79
|
+
expect(test).to receive(:system).with('go', 'build', '--mod=vendor', '--v')
|
|
80
|
+
test.run_go_build_hash
|
|
81
|
+
end
|
|
82
|
+
end
|
|
83
|
+
end
|
|
61
84
|
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: fpm-cookery
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.34.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Bernd Ahlers
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2019-06-01 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -98,16 +98,22 @@ dependencies:
|
|
|
98
98
|
name: puppet
|
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
|
100
100
|
requirements:
|
|
101
|
-
- - "
|
|
101
|
+
- - ">="
|
|
102
102
|
- !ruby/object:Gem::Version
|
|
103
103
|
version: '3.4'
|
|
104
|
+
- - "<"
|
|
105
|
+
- !ruby/object:Gem::Version
|
|
106
|
+
version: '6.0'
|
|
104
107
|
type: :runtime
|
|
105
108
|
prerelease: false
|
|
106
109
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
110
|
requirements:
|
|
108
|
-
- - "
|
|
111
|
+
- - ">="
|
|
109
112
|
- !ruby/object:Gem::Version
|
|
110
113
|
version: '3.4'
|
|
114
|
+
- - "<"
|
|
115
|
+
- !ruby/object:Gem::Version
|
|
116
|
+
version: '6.0'
|
|
111
117
|
- !ruby/object:Gem::Dependency
|
|
112
118
|
name: addressable
|
|
113
119
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -263,6 +269,7 @@ files:
|
|
|
263
269
|
- lib/fpm/cookery/utils.rb
|
|
264
270
|
- lib/fpm/cookery/version.rb
|
|
265
271
|
- lib/hiera/fpm_cookery_logger.rb
|
|
272
|
+
- recipes/activemq/recipe.rb
|
|
266
273
|
- recipes/arr-pm/recipe.rb
|
|
267
274
|
- recipes/backports/recipe.rb
|
|
268
275
|
- recipes/cabin/recipe.rb
|
|
@@ -325,6 +332,7 @@ files:
|
|
|
325
332
|
- spec/path_helper_spec.rb
|
|
326
333
|
- spec/path_spec.rb
|
|
327
334
|
- spec/recipe_spec.rb
|
|
335
|
+
- spec/source_handler_spec.rb
|
|
328
336
|
- spec/source_integrity_check_spec.rb
|
|
329
337
|
- spec/source_spec.rb
|
|
330
338
|
- spec/spec_helper.rb
|
|
@@ -349,7 +357,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
349
357
|
version: '0'
|
|
350
358
|
requirements: []
|
|
351
359
|
rubyforge_project: fpm-cookery
|
|
352
|
-
rubygems_version: 2.5.1
|
|
360
|
+
rubygems_version: 2.5.2.1
|
|
353
361
|
signing_key:
|
|
354
362
|
specification_version: 4
|
|
355
363
|
summary: A tool for building software packages with fpm.
|