summaryrefslogtreecommitdiffstats
path: root/src/pyfedpkg/__init__.py
diff options
context:
space:
mode:
authorJesse Keating <jkeating@redhat.com>2010-08-11 22:53:03 -0700
committerJesse Keating <jkeating@redhat.com>2010-08-11 22:53:03 -0700
commit5111c3568fcae1f803939cb5bf2486927bb8b390 (patch)
treeb87f789ca578d1a5103304c8f988282fa40c6fee /src/pyfedpkg/__init__.py
parent96ea3b00cef392fba08fb772f5a48571f0f19e27 (diff)
downloadfedora-packager-5111c3568fcae1f803939cb5bf2486927bb8b390.tar.gz
fedora-packager-5111c3568fcae1f803939cb5bf2486927bb8b390.tar.xz
fedora-packager-5111c3568fcae1f803939cb5bf2486927bb8b390.zip
Define a default hashtype, and fix it for el4/5
Diffstat (limited to 'src/pyfedpkg/__init__.py')
-rw-r--r--src/pyfedpkg/__init__.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/pyfedpkg/__init__.py b/src/pyfedpkg/__init__.py
index d2f5cda..baf409a 100644
--- a/src/pyfedpkg/__init__.py
+++ b/src/pyfedpkg/__init__.py
@@ -852,6 +852,11 @@ class PackageModule:
self.ver = self.getver()
self.rel = self.getrel()
self.nvr = '%s-%s-%s' % (self.module, self.ver, self.rel)
+ # Define the hashtype to use for srpms
+ # Default to sha256 hash type
+ self.hashtype = 'sha256'
+ if self.branch.startswith('el5') or self.branch.startswith('el4'):
+ self.hashtype = 'md5'
def build(self, skip_tag=False, scratch=False, background=False,
url=None, chain=None):
@@ -1411,7 +1416,7 @@ class PackageModule:
_run_command(cmd)
return
- def srpm(self, hashtype='sha256'):
+ def srpm(self, hashtype=None):
"""Create an srpm using hashtype from content in the module
Requires sources already downloaded.
@@ -1420,6 +1425,9 @@ 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,