diff options
author | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2011-01-21 15:52:42 +0100 |
---|---|---|
committer | Hans Ulrich Niedermann <hun@n-dimensional.de> | 2011-01-21 17:09:46 +0100 |
commit | 0df9afbeb29ea708ad5b4f16551076f1c9d43f56 (patch) | |
tree | b733cbb318c68b586c4d49ec0315a0725aabbf35 | |
parent | b231f35b52825383c8b8d8f33b8fe651d78489b8 (diff) | |
download | fedora-packager-0df9afbeb29ea708ad5b4f16551076f1c9d43f56.tar.gz fedora-packager-0df9afbeb29ea708ad5b4f16551076f1c9d43f56.tar.xz fedora-packager-0df9afbeb29ea708ad5b4f16551076f1c9d43f56.zip |
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-x | src/fedpkg.py | 3 | ||||
-rw-r--r-- | src/pyfedpkg/__init__.py | 7 |
2 files changed, 9 insertions, 1 deletions
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 |