Re: Two patches from SUSE

Christoph Thiel <[email protected]>
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
On Wed, May 16, 2007 at 09:03:28AM +0100, Paul Nasrat wrote:
> On Wed, 2007-05-16 at 08:30 +0300, Panu Matilainen wrote:
> > On Fri, 4 May 2007, Christoph Thiel wrote:
> > 
> > > Hi there,
> > >
> > > please find two patches attached:
> > >
> > >  createrepo-0.4.8-skip-symlinks.patch
> > >  * adds an option to skip symlinks (-S, --skip-symlinks)
> > >
> > >  createrepo-0.4.8-cachefix.patch
> > >  * 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.)
> 
> Commited will be in 0.4.9

Please find a slightly changed createrepo-0.4.8-cachefix.patch attached. I
had to add another check for older RPM versions, that behave differently.


Best,
Christoph
-- 
Christoph Thiel, Tech. Project Management, Research & Development
SUSE LINUX Products GmbH, GF: Markus Rex, HRB 16746 (AG Nürnberg)

_______________________________________________
Rpm-metadata mailing list
[email protected]
https://lists.dulug.duke.edu/mailman/listinfo/rpm-metadata
createrepo-0.4.8-cachefix.patch (text/x-patch, 968 B)
--- dumpMetadata.py
+++ dumpMetadata.py
@@ -595,9 +595,16 @@
         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 = []
+        if type(self.hdr[rpm.RPMTAG_SIGGPG]) is not types.NoneType:
+          t.append("".join(self.hdr[rpm.RPMTAG_SIGGPG]))   
+        if type(self.hdr[rpm.RPMTAG_SIGPGP]) is not types.NoneType:
+          t.append("".join(self.hdr[rpm.RPMTAG_SIGPGP]))
+        if type(self.hdr[rpm.RPMTAG_HDRID]) is not types.NoneType:
+          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]:
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.