diff options
author | Sol Jerome <solj@ices.utexas.edu> | 2010-02-01 16:31:35 +0000 |
---|---|---|
committer | Sol Jerome <solj@ices.utexas.edu> | 2010-02-01 16:31:35 +0000 |
commit | 618425388b594baea6c40f6b6fbac60eddc6efde (patch) | |
tree | 80660fbbca77db4b1afebf46ac3586011ca1f0dd /src/lib | |
parent | ad377a77ed88a8a4b0615dd2d2e984bef5b15d93 (diff) | |
download | bcfg2-618425388b594baea6c40f6b6fbac60eddc6efde.tar.gz bcfg2-618425388b594baea6c40f6b6fbac60eddc6efde.tar.bz2 bcfg2-618425388b594baea6c40f6b6fbac60eddc6efde.zip |
rpmtools: Use hashlib for 2.5 or greater clients
This patch uses the hashlib module included in python2.5 or greater by
default. It will still fall back to the old behavior for clients which
have 2.4 or earlier. This resolves ticket #840.
Signed-off-by: Sol Jerome <solj@ices.utexas.edu>
git-svn-id: https://svn.mcs.anl.gov/repos/bcfg/trunk/bcfg2@5710 ce84e21b-d406-0410-9b95-82705330c041
Diffstat (limited to 'src/lib')
-rwxr-xr-x | src/lib/Client/Tools/rpmtools.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/Client/Tools/rpmtools.py b/src/lib/Client/Tools/rpmtools.py index 9f98e9fcd..c9385196f 100755 --- a/src/lib/Client/Tools/rpmtools.py +++ b/src/lib/Client/Tools/rpmtools.py @@ -21,7 +21,13 @@ __revision__ = '$Revision$' import grp -import md5 +try: + import hashlib + py24compat = False +except: + # FIXME: Remove when client python dep is 2.5 or greater + py24compat = True + import md5 import optparse import os import pwd @@ -279,7 +285,10 @@ def prelink_md5_check(filename): prelink = True fsize = 0 - chksum = md5.new() + if py24compat: + chksum = md5.new() + else: + chksum = hashlib.md5() while 1: data = plf.read() if not data: |