createrepo-0.4.8-skip-symlinks.patch
authorPaul Nasrat <pnasrat@redhat.com>
Wed, 16 May 2007 07:58:49 +0000 (07:58 +0000)
committerPaul Nasrat <pnasrat@redhat.com>
Wed, 16 May 2007 07:58:49 +0000 (07:58 +0000)
  * adds an option to skip symlinks (-S, --skip-symlinks)
Christoph Thiel <cthiel@suse.de>

genpkgmetadata.py

index d2c003b1a41de5e210ac92b9e61a30541c14fcee..3801653afcbc71583d3e0bde694e2d9bb59d7ed5 100755 (executable)
@@ -83,6 +83,8 @@ class MetaDataGenerator:
             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("/")
@@ -381,13 +383,15 @@ def parseArgs(args):
     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()
@@ -455,6 +459,8 @@ def parseArgs(args):
                 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)