summaryrefslogtreecommitdiffstats
path: root/src/pyfedpkg/__init__.py
diff options
context:
space:
mode:
authorHans Ulrich Niedermann <hun@n-dimensional.de>2011-01-21 13:59:34 +0100
committerHans Ulrich Niedermann <hun@n-dimensional.de>2011-02-05 01:24:12 +0100
commit3738d0af3674b700122265ce173b23ae80d4e31c (patch)
tree4806a2a20ea43e3b82824b677a9418dd7b634d70 /src/pyfedpkg/__init__.py
parent3324262aa9f763f4716e602658f4ff59588cdf8a (diff)
downloadfedora-packager-3738d0af3674b700122265ce173b23ae80d4e31c.tar.gz
fedora-packager-3738d0af3674b700122265ce173b23ae80d4e31c.tar.xz
fedora-packager-3738d0af3674b700122265ce173b23ae80d4e31c.zip
Unify --md5 parameter handling
Unify handling of the --md5 parameter between the two targets using it: 'fedpkg local' and 'fedpkg srpm'. If no --md5 parameter is given, then the default hashtype is used, as determined in PackageModule.__init__() ('md5' for el5 and el6, and 'sha256' for everything else). If an --md5 parameter is given, then use the 'md5' hashtype.
Diffstat (limited to 'src/pyfedpkg/__init__.py')
-rw-r--r--src/pyfedpkg/__init__.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index f913774..fdfdfe7 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -1523,7 +1523,7 @@ class PackageModule:
_run_command(cmd, shell=True)
return
- def local(self, arch=None, hashtype='sha256'):
+ def local(self, arch=None, hashtype=None):
"""rpmbuild locally for given arch.
Takes arch to build for, and hashtype to build with.
@@ -1534,6 +1534,10 @@ class PackageModule:
"""
+ # Figure out which hashtype to use, if not provided one
+ if not hashtype:
+ hashtype = self.hashtype
+
# This could really use a list of arches to build for and loop over
# Get the sources
sources(self.path)
@@ -1740,9 +1744,11 @@ class PackageModule:
cmd = ['rpmbuild']
cmd.extend(self.rpmdefines)
+
# Figure out which hashtype to use, if not provided one
if not hashtype:
hashtype = self.hashtype
+
# This may need to get updated if we ever change our checksum default
if not hashtype == 'sha256':
cmd.extend(["--define '_source_filedigest_algorithm %s'" % hashtype,