From 267d1e8d17b1845d311c401cfcff13da25643005 Mon Sep 17 00:00:00 2001 From: Hans Ulrich Niedermann Date: Fri, 21 Jan 2011 15:52:42 +0100 Subject: Fix permission of files to be put into SRPM Add an option '--fix-permissions' to the 'fedpkg srpm' call. If the '--fix-permissions' option is not given, the behaviour of 'fedpkg srpm' does not change at all. If the '--fix-permissions' option is given, fedpkg runs git ls-files -z | xargs -0 chmod a+r before running the normal rpmbuild command. This makes sure that all 0600 files the filesystem are changed to the usual 0644 before including them in .src.rpm file. --- src/fedpkg.py | 6 +++++- src/pyfedpkg/__init__.py | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/fedpkg.py b/src/fedpkg.py index e1e63e9..207f479 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -669,7 +669,8 @@ def srpm(args): try: mymodule = pyfedpkg.PackageModule(args.path, args.dist) pyfedpkg.sources(args.path) - mymodule.srpm(hashtype=args.hashtype) + mymodule.srpm(hashtype=args.hashtype, + fix_permissions=args.fix_permissions) except pyfedpkg.FedpkgError, e: log.error('Could not make an srpm: %s' % e) sys.exit(1) @@ -1147,6 +1148,9 @@ packages will be built sequentially. parser_srpm.add_argument('--md5', action = 'store_const', dest='hashtype', const='md5', default=None, help = 'Use md5 checksums (for older rpm hosts)') + parser_srpm.add_argument('--fix-permissions', action='store_true', + default=False, + help = 'Fix permissions of files to be put into .src.rpm file') parser_srpm.set_defaults(command = srpm) # switch branches diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py index fdfdfe7..510cfe7 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -1724,7 +1724,7 @@ class PackageModule: _run_command(cmd, shell=True) return - def srpm(self, hashtype=None): + def srpm(self, hashtype=None, fix_permissions=False): """Create an srpm using hashtype from content in the module Requires sources already downloaded. @@ -1742,6 +1742,11 @@ class PackageModule: # srpm is newer, don't redo it return + if fix_permissions: + _run_command(cmd=['git', 'ls-files', '-z'], + pipe= ['xargs', '-0', 'chmod', 'a+r'], + shell=False) + cmd = ['rpmbuild'] cmd.extend(self.rpmdefines) -- cgit