]>
Commit | Line | Data |
---|---|---|
9b00b47b ER |
1 | diff --git a/lib/fpm/cookery/package/package.rb b/lib/fpm/cookery/package/package.rb |
2 | index 4d80344..38ec07a 100644 | |
3 | --- a/lib/fpm/cookery/package/package.rb | |
4 | +++ b/lib/fpm/cookery/package/package.rb | |
5 | @@ -42,6 +42,9 @@ module FPM | |
6 | # overwrite the values from package_setup(). | |
7 | @fpm.attributes.merge!(recipe.fpm_attributes) | |
8 | ||
9 | + # also merge fpm.attrs (for %attr flags, rpm specific) | |
10 | + @fpm.attrs.merge!(recipe.rpm_attributes) | |
11 | + | |
12 | # The input for the FPM package will be set here. | |
13 | package_input | |
14 | ||
15 | diff --git a/lib/fpm/cookery/recipe.rb b/lib/fpm/cookery/recipe.rb | |
16 | index ab23ca3..628b4a2 100644 | |
17 | --- a/lib/fpm/cookery/recipe.rb | |
18 | +++ b/lib/fpm/cookery/recipe.rb | |
19 | @@ -42,6 +42,7 @@ module FPM | |
20 | # class variable. | |
21 | klass.instance_variable_set(:@fpm_attributes, self.fpm_attributes.dup) | |
22 | klass.instance_variable_set(:@environment, self.environment.dup) | |
23 | + klass.instance_variable_set(:@rpm_attributes, self.rpm_attributes.dup) | |
24 | end | |
25 | ||
26 | def self.platforms(valid_platforms) | |
27 | @@ -101,11 +102,23 @@ module FPM | |
28 | @fpm_attributes | |
29 | end | |
30 | ||
31 | + # record attributes[foo] = bar | |
32 | + # Supports both hash and argument assignment | |
33 | + # rpm_attributes[:attr1] = xxxx | |
34 | + # rpm_attributes :xxxx=>1, :yyyy=>2 | |
35 | + def rpm_attributes(args=nil) | |
36 | + if args.is_a?(Hash) | |
37 | + @rpm_attributes.merge!(args) | |
38 | + end | |
39 | + @rpm_attributes | |
40 | + end | |
41 | + | |
42 | def environment | |
43 | @environment | |
44 | end | |
45 | end | |
46 | @fpm_attributes = {} | |
47 | + @rpm_attributes = {} | |
48 | @environment = FPM::Cookery::Environment.new | |
49 | ||
50 | def initialize(filename, config) | |
51 | @@ -132,6 +145,7 @@ module FPM | |
52 | def pkgdir(path = nil) (@pkgdir || workdir('pkg'))/path end | |
53 | def cachedir(path = nil) (@cachedir || workdir('cache'))/path end | |
54 | def fpm_attributes() self.class.fpm_attributes end | |
55 | + def rpm_attributes() self.class.rpm_attributes end | |
56 | def environment() self.class.environment end | |
57 | ||
58 | # Resolve dependencies from omnibus package. |