From 0df9afbeb29ea708ad5b4f16551076f1c9d43f56 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 | 3 +++ src/pyfedpkg/__init__.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/fedpkg.py b/src/fedpkg.py index 5551722..a62755f 100755 --- a/src/fedpkg.py +++ b/src/fedpkg.py @@ -1155,6 +1155,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 4a36ffc..52998ee 100644 --- a/src/pyfedpkg/__init__.py +++ b/src/pyfedpkg/__init__.py @@ -1681,7 +1681,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. @@ -1692,6 +1692,11 @@ class PackageModule: if not hashtype: hashtype = self.hashtype + if fix_permissions: + _run_command(cmd=['git', 'ls-files', '-z'], + pipe= ['xargs', '-0', 'chmod', 'a+r'], + shell=False) + cmd = ['rpmbuild'] cmd.extend(self.rpmdefines) # This may need to get updated if we ever change our checksum default -- cgit