Re: CVS access problem

Hans-Peter Jansen <[email protected]>
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
Am Mittwoch, 28. Juni 2006 15:29 schrieb seth vidal:
> On Wed, 2006-06-28 at 14:24 +0200, Hans-Peter Jansen wrote:
> > Hi Seth,
>
> once more, with feeling, please test it out.

Well, actually it takes a commit to see the difference. How about this one:

--- dumpMetadata.py.orig	2006-06-10 01:31:04.000000000 +0200
+++ dumpMetadata.py	2006-06-28 17:02:21.804109025 +0200
@@ -570,7 +570,29 @@ class RpmMetaData:
         if not self.options['cache']:
             return getChecksum(self.options['sumtype'], fo)
         
-        csumtag = '%s-%s' % (self.hdr['name'] , self.hdr[rpm.RPMTAG_SHA1HEADER])
+        # grabbing the checksum can be easy..
+        key = None
+        for h in (rpm.RPMTAG_SHA1HEADER, rpm.RPMTAG_RSAHEADER, rpm.RPMTAG_DSAHEADER):
+            key = self.hdr[h]
+            if key:
+                break
+
+        # ..or taking a bit more effort
+        if not key:
+            for h in (rpm.RPMTAG_SIGPGP, rpm.RPMTAG_SIGMD5, rpm.RPMTAG_SIGGPG):
+                key = self.hdr[h]
+                if key:
+                    # generate hexdigest from signature
+                    key = "".join([hex(ord(x))[2:].zfill(2)
+                                for x in tuple(self.hdr[h])])
+                    break
+         
+        # still no go? bail out
+        if not key:
+            raise MDError, "Error determining the rpm pkg chksum/signature from %s " % \
+                            self.hdr['name']
+
+        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]:
             csumo = open(csumfile, 'r')
--- ChangeLog~	2006-06-28 14:13:32.000000000 +0200
+++ ChangeLog	2006-06-28 17:07:40.272558470 +0200
@@ -1,3 +1,9 @@
+2006-06-28 17:03  [email protected]
+
+	* dumpMetadata.py:
+	forward port the more robust rpm header chksum/signature retrieval
+	procedure and bail out on failure
+
 2006-06-15 11:39  lmacken
 
 	* ChangeLog, genpkgmetadata.py, docs/createrepo.8: 2006-06-15 11:40


;-),
Pete
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.