summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2011-01-21 15:52:42 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2011-02-05 01:24:12 +0100
commit267d1e8d17b1845d311c401cfcff13da25643005 (patch)
tree787e998bff2954c47db27e9474d44daf88987264
parent3738d0af3674b700122265ce173b23ae80d4e31c (diff)
downloadfedora-packager-267d1e8d17b1845d311c401cfcff13da25643005.zip
fedora-packager-267d1e8d17b1845d311c401cfcff13da25643005.tar.gz
fedora-packager-267d1e8d17b1845d311c401cfcff13da25643005.tar.xz
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.
-rwxr-xr-xsrc/fedpkg.py6
-rw-r--r--src/pyfedpkg/__init__.py7
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)