Two patches from SUSE

Christoph Thiel <[email protected]>
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
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.)

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-skip-symlinks.patch (text/x-patch, 1.9 KB)
--- genpkgmetadata.py
+++ genpkgmetadata.py
@@ -83,6 +83,8 @@
             for fn in names:
                 if os.path.isdir(fn):
                     continue
+                if self.cmds['skip-symlinks'] and os.path.islink(fn):
+                    continue
                 elif fn[-extlen:].lower() == '%s' % (ext):
                     relativepath = dirname.replace(startdir, "", 1)
                     relativepath = relativepath.lstrip("/")
@@ -382,13 +384,15 @@
     cmds['database'] = False
     cmds['file-pattern-match'] = ['.*bin\/.*', '^\/etc\/.*', '^\/usr\/lib\/sendmail$']
     cmds['dir-pattern-match'] = ['.*bin\/.*', '^\/etc\/.*']
+    cmds['skip-symlinks'] = False
 
     try:
-        gopts, argsleft = getopt.getopt(args, 'phqVvndg:s:x:u:c:o:C', ['help', 'exclude=',
+        gopts, argsleft = getopt.getopt(args, 'phqVvndg:s:x:u:c:o:CS', ['help', 'exclude=',
                                                                   'quiet', 'verbose', 'cachedir=', 'basedir=',
                                                                   'baseurl=', 'groupfile=', 'checksum=',
                                                                   'version', 'pretty', 'split', 'outputdir=',
-                                                                  'noepoch', 'checkts', 'database'])
+                                                                  'noepoch', 'checkts', 'database', 
+                                                                  'skip-symlinks'])
     except getopt.error, e:
         errorprint(_('Options Error: %s.') % e)
         usage()
@@ -456,6 +460,8 @@
                 cmds['noepoch'] = True
             elif arg in ['-d', '--database']:
                 cmds['database'] = True
+            elif arg in ['-S', '--skip-symlinks']:
+                cmds['skip-symlinks'] = True
                 
     except ValueError, e:
         errorprint(_('Options Error: %s') % e)
createrepo-0.4.8-cachefix.patch (text/x-patch, 756 B)
--- dumpMetadata.py
+++ dumpMetadata.py
@@ -595,9 +595,13 @@
         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]:
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.