fpm-cookery 0.29.0 → 0.30.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 +19 -0
- data/README.md +2 -0
- data/lib/fpm/cookery/chain_packager.rb +27 -0
- data/lib/fpm/cookery/cli.rb +15 -0
- data/lib/fpm/cookery/dependency_inspector.rb +1 -1
- data/lib/fpm/cookery/lifecycle_hooks.rb +36 -3
- data/lib/fpm/cookery/log.rb +4 -0
- data/lib/fpm/cookery/omnibus_packager.rb +11 -1
- data/lib/fpm/cookery/packager.rb +19 -0
- data/lib/fpm/cookery/source_handler/svn.rb +2 -1
- data/lib/fpm/cookery/utils.rb +6 -1
- data/lib/fpm/cookery/version.rb +1 -1
- data/recipes/fpm-cookery/recipe.rb +27 -30
- metadata +3 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 5d4a540ee8894e347b9b30df41f55735f670f565
|
|
4
|
+
data.tar.gz: 974940d490281d11761d8e079e6c0f49df7f968b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 6b287616baef2e572014cf0ba9736191b0e50a363e25c54ae05d6f96854e8cf3774b74dc0b6a6c72cf43185798eedcc98bf8c88c359a3e48c9eededb1df73948
|
|
7
|
+
data.tar.gz: 22e6f563aa586c7e771f3fa9c1c172bde1a0fdd5ae420e4c2ea5352f2a83d31136beef972a57f6e5d737f8e4af95a0ebb780bc9eb0fa8d5a91be64414191e27b
|
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,22 @@
|
|
|
1
|
+
# v0.30.0 (2015-09-10)
|
|
2
|
+
* Add more lifecylce hooks:
|
|
3
|
+
* `before_package_create`
|
|
4
|
+
* `after_package_create`
|
|
5
|
+
* `before_source_download`
|
|
6
|
+
* `after_source_download`
|
|
7
|
+
* `before_source_extraction`
|
|
8
|
+
* `after_source_extraction`
|
|
9
|
+
* `before_build`
|
|
10
|
+
* `after_build`
|
|
11
|
+
* `before_install`
|
|
12
|
+
* `after_install`
|
|
13
|
+
* Remove some duplication in dependency handling. (glensc / #114)
|
|
14
|
+
* Add `:externals` option to SVN source handler. (glensc / #117)
|
|
15
|
+
* Use heredoc when calling hook script in fpm-cookery recipe. (glensc / #121)
|
|
16
|
+
* Add `sh()` method as an alias for `safesystem()`.
|
|
17
|
+
* Add `install-build-deps` CLI command to install all build dependencies. (cas-ei / #126)
|
|
18
|
+
* Fix no-deps CLI flags for omnibus style builds. (cas-ei / #124 / #125)
|
|
19
|
+
|
|
1
20
|
# v0.29.0 (2015-07-25)
|
|
2
21
|
* Start documentation at https://fpm-cookery.readthedocs.org/.
|
|
3
22
|
The documentation is now included in the source code (`docs/` directory) and
|
data/README.md
CHANGED
|
@@ -24,6 +24,8 @@ It is using __fpm__ to create the actual packages.
|
|
|
24
24
|
|
|
25
25
|
Please find the documentation page here: https://fpm-cookery.readthedocs.org/
|
|
26
26
|
|
|
27
|
+
The documentation source is located in the `docs/` folder. Pull requests welcome! :)
|
|
28
|
+
|
|
27
29
|
Hosting and building of the documentation is provided by the great [Read the Docs project](https://readthedocs.org/)!
|
|
28
30
|
|
|
29
31
|
## Why?
|
|
@@ -14,6 +14,33 @@ module FPM
|
|
|
14
14
|
@config = config
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
def install_build_deps
|
|
18
|
+
recipe.run_lifecycle_hook(:before_dependency_installation)
|
|
19
|
+
DependencyInspector.verify!([], recipe.build_depends)
|
|
20
|
+
recipe.chain_recipes.each do |name|
|
|
21
|
+
recipe_file = build_recipe_file_path(name)
|
|
22
|
+
unless File.exists?(recipe_file)
|
|
23
|
+
Log.fatal "Cannot find a recipe for #{name} at #{recipe_file}"
|
|
24
|
+
exit 1
|
|
25
|
+
end
|
|
26
|
+
FPM::Cookery::Book.instance.load_recipe(recipe_file, config) do |dep_recipe|
|
|
27
|
+
depPackager = FPM::Cookery::Packager.new(dep_recipe, config.to_hash)
|
|
28
|
+
depPackager.target = FPM::Cookery::Facts.target.to_s
|
|
29
|
+
|
|
30
|
+
#Chain, chain, chain ...
|
|
31
|
+
if dep_recipe.omnibus_package == true
|
|
32
|
+
FPM::Cookery::OmnibusPackager.new(depPackager, config).install_build_deps
|
|
33
|
+
elsif dep_recipe.chain_package == true
|
|
34
|
+
FPM::Cookery::ChainPackager.new(depPackager, config).install_build_deps
|
|
35
|
+
else
|
|
36
|
+
depPackager.install_build_deps
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
recipe.run_lifecycle_hook(:after_dependency_installation)
|
|
40
|
+
Log.info("Build dependencies installed!")
|
|
41
|
+
end
|
|
42
|
+
end
|
|
43
|
+
|
|
17
44
|
def run
|
|
18
45
|
Log.info "Recipe #{recipe.name} is a chain package; looking for child recipes to build"
|
|
19
46
|
|
data/lib/fpm/cookery/cli.rb
CHANGED
|
@@ -131,6 +131,20 @@ module FPM
|
|
|
131
131
|
end
|
|
132
132
|
end
|
|
133
133
|
|
|
134
|
+
class InstallBuildDepsCmd < Command
|
|
135
|
+
parameter '[RECIPE]', 'the recipe file', :default => 'recipe.rb'
|
|
136
|
+
|
|
137
|
+
def exec(config, recipe, packager)
|
|
138
|
+
if recipe.omnibus_package == true
|
|
139
|
+
FPM::Cookery::OmnibusPackager.new(packager, config).install_build_deps
|
|
140
|
+
elsif recipe.chain_package == true
|
|
141
|
+
FPM::Cookery::ChainPackager.new(packager, config).install_build_deps
|
|
142
|
+
else
|
|
143
|
+
packager.install_build_deps
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|
|
147
|
+
|
|
134
148
|
class ShowDepsCmd < Command
|
|
135
149
|
parameter '[RECIPE]', 'the recipe file', :default => 'recipe.rb'
|
|
136
150
|
|
|
@@ -144,6 +158,7 @@ module FPM
|
|
|
144
158
|
subcommand 'package', 'builds the package', PackageCmd
|
|
145
159
|
subcommand 'clean', 'cleans up', CleanCmd
|
|
146
160
|
subcommand 'install-deps', 'installs build and runtime dependencies', InstallDepsCmd
|
|
161
|
+
subcommand 'install-build-deps', 'installs build dependencies', InstallBuildDepsCmd
|
|
147
162
|
subcommand 'show-deps', 'show build and runtime dependencies', ShowDepsCmd
|
|
148
163
|
end
|
|
149
164
|
end
|
|
@@ -70,7 +70,7 @@ module FPM
|
|
|
70
70
|
:ensure => "present"
|
|
71
71
|
})
|
|
72
72
|
result = Puppet::Resource.indirection.save(resource)[1]
|
|
73
|
-
failed =
|
|
73
|
+
failed = result.resource_statuses.values.first.failed
|
|
74
74
|
if failed
|
|
75
75
|
Log.fatal "While processing depends package '#{package}':"
|
|
76
76
|
result.logs.each {|log_line| Log.fatal log_line}
|
|
@@ -3,9 +3,9 @@ require 'fpm/cookery/log'
|
|
|
3
3
|
module FPM
|
|
4
4
|
module Cookery
|
|
5
5
|
module LifecycleHooks
|
|
6
|
-
def run_lifecycle_hook(hook_name)
|
|
7
|
-
Log.debug("Run lifecycle hook: #{hook_name}")
|
|
8
|
-
self.__send__(hook_name)
|
|
6
|
+
def run_lifecycle_hook(hook_name, *args)
|
|
7
|
+
Log.debug("Run lifecycle hook: #{hook_name} (args: #{args.inspect})")
|
|
8
|
+
self.__send__(hook_name, *args)
|
|
9
9
|
end
|
|
10
10
|
|
|
11
11
|
def before_dependency_installation
|
|
@@ -13,6 +13,39 @@ module FPM
|
|
|
13
13
|
|
|
14
14
|
def after_dependency_installation
|
|
15
15
|
end
|
|
16
|
+
|
|
17
|
+
def before_source_download
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def after_source_download
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def before_source_extraction
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# Gets a FPM::Cookery::Path object pointing to the extracted source as argument.
|
|
27
|
+
def after_source_extraction(extracted_source)
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def before_build
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def after_build
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def before_install
|
|
37
|
+
end
|
|
38
|
+
|
|
39
|
+
def after_install
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
# Gets a FPM::Package object as argument.
|
|
43
|
+
def before_package_create(package)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
# Gets a FPM::Package object as argument.
|
|
47
|
+
def after_package_create(package)
|
|
48
|
+
end
|
|
16
49
|
end
|
|
17
50
|
end
|
|
18
51
|
end
|
data/lib/fpm/cookery/log.rb
CHANGED
|
@@ -37,13 +37,23 @@ module FPM
|
|
|
37
37
|
dep_recipes
|
|
38
38
|
end
|
|
39
39
|
|
|
40
|
+
|
|
41
|
+
def install_build_deps
|
|
42
|
+
build_deps = load_omnibus_recipes(recipe).map(&:build_depends).flatten.uniq
|
|
43
|
+
recipe.run_lifecycle_hook(:before_dependency_installation)
|
|
44
|
+
DependencyInspector.verify!([], build_deps)
|
|
45
|
+
recipe.run_lifecycle_hook(:after_dependency_installation)
|
|
46
|
+
Log.info("Build dependencies installed!")
|
|
47
|
+
end
|
|
48
|
+
|
|
40
49
|
def run
|
|
41
50
|
# Omnibus packages are many builds in one package; e.g. Ruby + Puppet together.
|
|
42
51
|
Log.info "Recipe #{recipe.name} is an Omnibus package; looking for child recipes to build"
|
|
43
52
|
|
|
44
53
|
dep_recipes = load_omnibus_recipes(recipe)
|
|
45
54
|
dep_recipes.uniq.each do |dep_recipe|
|
|
46
|
-
pkg = FPM::Cookery::Packager.new(dep_recipe, :skip_package => true,
|
|
55
|
+
pkg = FPM::Cookery::Packager.new(dep_recipe, :skip_package => true,
|
|
56
|
+
:keep_destdir => true, :dependency_check => config.dependency_check )
|
|
47
57
|
pkg.target = FPM::Cookery::Facts.target.to_s
|
|
48
58
|
|
|
49
59
|
Log.info "Located recipe for child recipe #{dep_recipe.name}; starting build"
|
data/lib/fpm/cookery/packager.rb
CHANGED
|
@@ -43,6 +43,13 @@ module FPM
|
|
|
43
43
|
FileUtils.rm_rf(recipe.destdir)
|
|
44
44
|
end
|
|
45
45
|
|
|
46
|
+
def install_build_deps
|
|
47
|
+
recipe.run_lifecycle_hook(:before_dependency_installation)
|
|
48
|
+
DependencyInspector.verify!([], recipe.build_depends)
|
|
49
|
+
recipe.run_lifecycle_hook(:after_dependency_installation)
|
|
50
|
+
Log.info("Build dependencies installed!")
|
|
51
|
+
end
|
|
52
|
+
|
|
46
53
|
def install_deps
|
|
47
54
|
recipe.run_lifecycle_hook(:before_dependency_installation)
|
|
48
55
|
DependencyInspector.verify!(recipe.depends, recipe.build_depends)
|
|
@@ -50,6 +57,7 @@ module FPM
|
|
|
50
57
|
Log.info("All dependencies installed!")
|
|
51
58
|
end
|
|
52
59
|
|
|
60
|
+
|
|
53
61
|
def dispense
|
|
54
62
|
env = ENV.to_hash
|
|
55
63
|
package_name = "#{recipe.name}-#{recipe.version}"
|
|
@@ -73,8 +81,10 @@ module FPM
|
|
|
73
81
|
|
|
74
82
|
recipe.cachedir.mkdir
|
|
75
83
|
Dir.chdir(recipe.cachedir) do
|
|
84
|
+
recipe.run_lifecycle_hook(:before_source_download)
|
|
76
85
|
Log.info "Fetching source: #{source.source_url}"
|
|
77
86
|
source.fetch(:quiet => config[:quiet])
|
|
87
|
+
recipe.run_lifecycle_hook(:after_source_download)
|
|
78
88
|
|
|
79
89
|
if source.checksum?
|
|
80
90
|
SourceIntegrityCheck.new(recipe).tap do |check|
|
|
@@ -103,6 +113,7 @@ module FPM
|
|
|
103
113
|
|
|
104
114
|
recipe.builddir.mkdir
|
|
105
115
|
Dir.chdir(recipe.builddir) do
|
|
116
|
+
recipe.run_lifecycle_hook(:before_source_extraction)
|
|
106
117
|
extracted_source = source.extract
|
|
107
118
|
|
|
108
119
|
if recipe.extracted_source
|
|
@@ -110,6 +121,8 @@ module FPM
|
|
|
110
121
|
extracted_source = recipe.extracted_source
|
|
111
122
|
end
|
|
112
123
|
|
|
124
|
+
recipe.run_lifecycle_hook(:after_source_extraction, recipe.builddir(extracted_source))
|
|
125
|
+
|
|
113
126
|
Dir.chdir(extracted_source) do
|
|
114
127
|
#Source::Patches.new(recipe.patches).apply!
|
|
115
128
|
|
|
@@ -119,8 +132,10 @@ module FPM
|
|
|
119
132
|
Log.warn "Skipping build of #{recipe.name} because build cookie found (#{build_cookie})," \
|
|
120
133
|
" use \"fpm-cook clean\" to rebuild!"
|
|
121
134
|
else
|
|
135
|
+
recipe.run_lifecycle_hook(:before_build)
|
|
122
136
|
Log.info "Building in #{File.expand_path(extracted_source, recipe.builddir)}"
|
|
123
137
|
recipe.build and FileUtils.touch(build_cookie)
|
|
138
|
+
recipe.run_lifecycle_hook(:after_build)
|
|
124
139
|
end
|
|
125
140
|
|
|
126
141
|
FileUtils.rm_rf(recipe.destdir) unless keep_destdir?
|
|
@@ -129,7 +144,9 @@ module FPM
|
|
|
129
144
|
begin
|
|
130
145
|
recipe.installing = true
|
|
131
146
|
Log.info "Installing into #{recipe.destdir}"
|
|
147
|
+
recipe.run_lifecycle_hook(:before_install)
|
|
132
148
|
recipe.install
|
|
149
|
+
recipe.run_lifecycle_hook(:after_install)
|
|
133
150
|
ensure
|
|
134
151
|
recipe.installing = false
|
|
135
152
|
end
|
|
@@ -170,8 +187,10 @@ module FPM
|
|
|
170
187
|
|
|
171
188
|
output = input.convert(output_class)
|
|
172
189
|
|
|
190
|
+
recipe.run_lifecycle_hook(:before_package_create, output)
|
|
173
191
|
begin
|
|
174
192
|
output.output(output.to_s)
|
|
193
|
+
recipe.run_lifecycle_hook(:after_package_create, output)
|
|
175
194
|
rescue FPM::Package::FileAlreadyExists
|
|
176
195
|
Log.info "Removing existing package file: #{output.to_s}"
|
|
177
196
|
FileUtils.rm_f(output.to_s)
|
|
@@ -26,7 +26,8 @@ module FPM
|
|
|
26
26
|
private
|
|
27
27
|
def svn(url, path)
|
|
28
28
|
revision = options[:revision] || 'HEAD'
|
|
29
|
-
|
|
29
|
+
externals = '--ignore-externals' if !options[:externals]
|
|
30
|
+
safesystem('svn', 'export', '--force', externals, '-q', '-r', revision, url, path)
|
|
30
31
|
end
|
|
31
32
|
|
|
32
33
|
def extracted_source
|
data/lib/fpm/cookery/utils.rb
CHANGED
|
@@ -14,8 +14,13 @@ module FPM
|
|
|
14
14
|
return success
|
|
15
15
|
end
|
|
16
16
|
|
|
17
|
+
# Alias for safesystem.
|
|
18
|
+
def sh(*args)
|
|
19
|
+
safesystem(*args)
|
|
20
|
+
end
|
|
21
|
+
|
|
17
22
|
def cleanenv_safesystem(*args)
|
|
18
|
-
Log.
|
|
23
|
+
Log.deprecated("Use `environment.with_clean { safesystem(...) }` instead of `cleanenv_safesystem(...)` in the recipe")
|
|
19
24
|
environment.with_clean { safesystem(*args) }
|
|
20
25
|
end
|
|
21
26
|
|
data/lib/fpm/cookery/version.rb
CHANGED
|
@@ -21,8 +21,29 @@ class FPMCookery < FPM::Cookery::Recipe
|
|
|
21
21
|
destdir('bin').install workdir('fpm-cook.bin'), 'fpm-cook'
|
|
22
22
|
|
|
23
23
|
with_trueprefix do
|
|
24
|
-
create_post_install_hook
|
|
25
|
-
|
|
24
|
+
create_post_install_hook <<-EOF
|
|
25
|
+
set -e
|
|
26
|
+
|
|
27
|
+
BIN_PATH="#{destdir}/bin"
|
|
28
|
+
BIN="fpm-cook"
|
|
29
|
+
|
|
30
|
+
update-alternatives --install /usr/bin/$BIN $BIN $BIN_PATH/$BIN 100
|
|
31
|
+
|
|
32
|
+
exit 0
|
|
33
|
+
EOF
|
|
34
|
+
|
|
35
|
+
create_pre_uninstall_hook <<-EOF
|
|
36
|
+
set -e
|
|
37
|
+
|
|
38
|
+
BIN_PATH="#{destdir}/bin"
|
|
39
|
+
BIN="fpm-cook"
|
|
40
|
+
|
|
41
|
+
if [ "$1" != "upgrade" ]; then
|
|
42
|
+
update-alternatives --remove $BIN $BIN_PATH/$BIN
|
|
43
|
+
fi
|
|
44
|
+
|
|
45
|
+
exit 0
|
|
46
|
+
EOF
|
|
26
47
|
end
|
|
27
48
|
end
|
|
28
49
|
|
|
@@ -33,40 +54,16 @@ class FPMCookery < FPM::Cookery::Recipe
|
|
|
33
54
|
cleanenv_safesystem "#{destdir}/embedded/bin/gem install --no-ri --no-rdoc #{v} #{name}"
|
|
34
55
|
end
|
|
35
56
|
|
|
36
|
-
def create_post_install_hook
|
|
57
|
+
def create_post_install_hook(script, interpreter = "/bin/sh")
|
|
37
58
|
File.open(builddir('post-install'), 'w', 0755) do |f|
|
|
38
|
-
f.write
|
|
39
|
-
#!/bin/sh
|
|
40
|
-
set -e
|
|
41
|
-
|
|
42
|
-
BIN_PATH="#{destdir}/bin"
|
|
43
|
-
BIN="fpm-cook"
|
|
44
|
-
|
|
45
|
-
update-alternatives --install /usr/bin/$BIN $BIN $BIN_PATH/$BIN 100
|
|
46
|
-
|
|
47
|
-
exit 0
|
|
48
|
-
__POSTINST
|
|
49
|
-
|
|
59
|
+
f.write "#!#{interpreter}\n" + script.gsub(/^\s+/, '')
|
|
50
60
|
self.class.post_install(File.expand_path(f.path))
|
|
51
61
|
end
|
|
52
62
|
end
|
|
53
63
|
|
|
54
|
-
def create_pre_uninstall_hook
|
|
64
|
+
def create_pre_uninstall_hook(script, interpreter = "/bin/sh")
|
|
55
65
|
File.open(builddir('pre-uninstall'), 'w', 0755) do |f|
|
|
56
|
-
f.write
|
|
57
|
-
#!/bin/sh
|
|
58
|
-
set -e
|
|
59
|
-
|
|
60
|
-
BIN_PATH="#{destdir}/bin"
|
|
61
|
-
BIN="fpm-cook"
|
|
62
|
-
|
|
63
|
-
if [ "$1" != "upgrade" ]; then
|
|
64
|
-
update-alternatives --remove $BIN $BIN_PATH/$BIN
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
exit 0
|
|
68
|
-
__PRERM
|
|
69
|
-
|
|
66
|
+
f.write "#!#{interpreter}\n" + script.gsub(/^\s+/, '')
|
|
70
67
|
self.class.pre_uninstall(File.expand_path(f.path))
|
|
71
68
|
end
|
|
72
69
|
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.30.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: 2015-
|
|
11
|
+
date: 2015-09-10 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: rspec
|
|
@@ -242,7 +242,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
242
242
|
version: '0'
|
|
243
243
|
requirements: []
|
|
244
244
|
rubyforge_project: fpm-cookery
|
|
245
|
-
rubygems_version: 2.2.
|
|
245
|
+
rubygems_version: 2.2.5
|
|
246
246
|
signing_key:
|
|
247
247
|
specification_version: 4
|
|
248
248
|
summary: A tool for building software packages with fpm.
|