[packages/fpm-cookery] add support for rpm %attr

glen glen at pld-linux.org
Wed Aug 26 14:06:24 CEST 2015


commit 9b00b47bf6fc039411c330b26881313c823a0ff7
Author: Elan Ruusamäe <glen at delfi.ee>
Date:   Wed Aug 26 15:06:04 2015 +0300

    add support for rpm %attr
    
    https://github.com/bernd/fpm-cookery/pull/120

 fpm-cookery.spec     |  4 +++-
 rpm-attributes.patch | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 1 deletion(-)
---
diff --git a/fpm-cookery.spec b/fpm-cookery.spec
index 86b3e2f..77ce461 100644
--- a/fpm-cookery.spec
+++ b/fpm-cookery.spec
@@ -5,12 +5,13 @@
 Summary:	A tool for building software packages with fpm
 Name:		fpm-cookery
 Version:	0.29.0
-Release:	0.2
+Release:	0.5
 License:	BSD
 Group:		Development/Languages
 Source0:	http://rubygems.org/downloads/%{name}-%{version}.gem
 # Source0-md5:	bd210d6acb6a0519f8d940200917eefe
 Patch0:		svn-ignore-externals.patch
+Patch1:		rpm-attributes.patch
 URL:		https://github.com/bernd/fpm-cookery
 BuildRequires:	rpm-rubyprov
 BuildRequires:	rpmbuild(macros) >= 1.656
@@ -40,6 +41,7 @@ A tool for building software packages with fpm.
 %prep
 %setup -q
 %patch0 -p1
+%patch1 -p1
 %{__sed} -i -e '1 s,#!.*ruby,#!%{__ruby},' bin/*
 
 %build
diff --git a/rpm-attributes.patch b/rpm-attributes.patch
new file mode 100644
index 0000000..c454cde
--- /dev/null
+++ b/rpm-attributes.patch
@@ -0,0 +1,58 @@
+diff --git a/lib/fpm/cookery/package/package.rb b/lib/fpm/cookery/package/package.rb
+index 4d80344..38ec07a 100644
+--- a/lib/fpm/cookery/package/package.rb
++++ b/lib/fpm/cookery/package/package.rb
+@@ -42,6 +42,9 @@ module FPM
+           # overwrite the values from package_setup().
+           @fpm.attributes.merge!(recipe.fpm_attributes)
+ 
++          # also merge fpm.attrs (for %attr flags, rpm specific)
++          @fpm.attrs.merge!(recipe.rpm_attributes)
++
+           # The input for the FPM package will be set here.
+           package_input
+ 
+diff --git a/lib/fpm/cookery/recipe.rb b/lib/fpm/cookery/recipe.rb
+index ab23ca3..628b4a2 100644
+--- a/lib/fpm/cookery/recipe.rb
++++ b/lib/fpm/cookery/recipe.rb
+@@ -42,6 +42,7 @@ module FPM
+         # class variable.
+         klass.instance_variable_set(:@fpm_attributes, self.fpm_attributes.dup)
+         klass.instance_variable_set(:@environment, self.environment.dup)
++        klass.instance_variable_set(:@rpm_attributes, self.rpm_attributes.dup)
+       end
+ 
+       def self.platforms(valid_platforms)
+@@ -101,11 +102,23 @@ module FPM
+           @fpm_attributes
+         end
+ 
++        # record attributes[foo] = bar
++        # Supports both hash and argument assignment
++        #   rpm_attributes[:attr1] = xxxx
++        #   rpm_attributes :xxxx=>1, :yyyy=>2
++        def rpm_attributes(args=nil)
++          if args.is_a?(Hash)
++            @rpm_attributes.merge!(args)
++          end
++          @rpm_attributes
++        end
++
+         def environment
+           @environment
+         end
+       end
+       @fpm_attributes = {}
++      @rpm_attributes = {}
+       @environment = FPM::Cookery::Environment.new
+ 
+       def initialize(filename, config)
+@@ -132,6 +145,7 @@ module FPM
+       def pkgdir(path = nil)   (@pkgdir   || workdir('pkg'))/path         end
+       def cachedir(path = nil) (@cachedir || workdir('cache'))/path       end
+       def fpm_attributes() self.class.fpm_attributes end
++      def rpm_attributes() self.class.rpm_attributes end
+       def environment()        self.class.environment                      end
+ 
+       # Resolve dependencies from omnibus package.
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/fpm-cookery.git/commitdiff/9b00b47bf6fc039411c330b26881313c823a0ff7



More information about the pld-cvs-commit mailing list