Ticket #11: createrepo-hashlib.patch
File createrepo-hashlib.patch, 1.4 kB (added by awillis, 8 years ago) |
---|
-
dumpMetadata.py
old new 21 21 import os 22 22 import rpm 23 23 import exceptions 24 import md5 25 import sha 24 import hashlib 26 25 import types 27 26 import struct 28 27 import re … … 44 43 def _write_gzip_header(self): 45 44 self.fileobj.write('\037\213') # magic header 46 45 self.fileobj.write('\010') # compression method 47 fname = self. filename[:-3]46 fname = self.name[:-3] 48 47 flags = 0 49 48 if fname: 50 49 flags = FNAME … … 122 121 opened_here = 1 123 122 fo = open(file, 'rb', CHUNK) 124 123 125 if sumtype == 'md5': 126 sum = md5.new() 127 elif sumtype == 'sha': 128 sum = sha.new() 129 else: 130 raise MDError, 'Error Checksumming file, wrong checksum type %s' % sumtype 124 sum = hashlib.new(sumtype) 131 125 chunk = fo.read 132 126 while chunk: 133 127 chunk = fo.read(CHUNK) … … 600 594 if type(self.hdr[rpm.RPMTAG_HDRID]) is not types.NoneType: 601 595 t.append("".join(self.hdr[rpm.RPMTAG_HDRID])) 602 596 603 key = md5.new("".join(t)).hexdigest()597 key = hashlib.new('md5', ''.join(t)).hexdigest() 604 598 605 599 csumtag = '%s-%s-%s-%s' % (os.path.basename(self.relativepath), 606 600 self.hdr[rpm.RPMTAG_SHA1HEADER],