createrepo-0.4.8-cachefix.patch
authorPaul Nasrat <pnasrat@redhat.com>
Wed, 16 May 2007 07:59:25 +0000 (07:59 +0000)
committerPaul Nasrat <pnasrat@redhat.com>
Wed, 16 May 2007 07:59:25 +0000 (07:59 +0000)
  * changes the way the hashkey for the cache is generated. (The original
    version just used rpm.RPMTAG_SIGMD5, which was the same for the same
    signed and unsigned package. However, this lead to a wrong checksum
    ending up in the metadata.)
Christoph Thiel <cthiel@suse.de>

dumpMetadata.py

index 147fee7b14bfa4e09df6e7feccb3bb289f6976a2..11d854d12fc4680feb4ab4399928db7858d972c9 100644 (file)
@@ -586,9 +586,13 @@ class RpmMetaData:
         if not self.options['cache']:
             return getChecksum(self.options['sumtype'], fo)
 
-        key = "".join([hex(ord(x))[2:].zfill(2)
-                       for x in tuple(self.hdr[rpm.RPMTAG_SIGMD5])])
+        t = []
+        t.append("".join(self.hdr[rpm.RPMTAG_SIGGPG]))   
+        t.append("".join(self.hdr[rpm.RPMTAG_SIGPGP]))
+        t.append("".join(self.hdr[rpm.RPMTAG_HDRID]))
 
+        key = md5.new("".join(t)).hexdigest()
+                                        
         csumtag = '%s-%s' % (self.hdr['name'] , key)
         csumfile = '%s/%s' % (self.options['cachedir'], csumtag)
         if os.path.exists(csumfile) and self.mtime <= os.stat(csumfile)[8]: