genpkgmetadata.py

[email protected] (Seth Vidal)
Newsgroups gmane.linux.rpm.metadata
Message-ID <[email protected]>
 genpkgmetadata.py |   26 ++++++++++++++++++++++----
 1 file changed, 22 insertions(+), 4 deletions(-)

New commits:
commit f1bd59b83143f96ebae749509b8149f9bcd1dd38
Author: Seth Vidal <[email protected]>
Date:   Wed Nov 14 15:16:26 2007 -0500

    merge pkglist option to HEAD

diff --git a/genpkgmetadata.py b/genpkgmetadata.py
index 22b7c85..b4f4c82 100755
--- a/genpkgmetadata.py
+++ b/genpkgmetadata.py
@@ -59,6 +59,7 @@ def usage(retval=1):
      -c, --cachedir <dir> = specify which dir to use for the checksum cache
      -C, --checkts = don't generate repo metadata, if their ctimes are newer
                      than the rpm ctimes.
+     -i, --pkglist = use only these files from the directory specified
      -h, --help = show this help
      -V, --version = output version
      -p, --pretty = output xml files in pretty format.
@@ -138,7 +139,11 @@ class MetaDataGenerator:
             #and scan the old repo
             self.oldData = readMetadata.MetadataIndex(self.cmds['outputdir'],
                                                       basefile, flfile, otherfile, opts)
-        files = self.getFileList(self.cmds['basedir'], directory, '.rpm')
+        if self.cmds['pkglist']:
+            files = self.cmds['pkglist']
+        else:
+            files = self.getFileList(self.cmds['basedir'], directory, '.rpm')
+            
         files = self.trimRpms(files)
         self.pkgcount = len(files)
         self.openMetadataDocs()
@@ -414,14 +419,15 @@ def parseArgs(args):
     cmds['file-pattern-match'] = ['.*bin\/.*', '^\/etc\/.*', '^\/usr\/lib\/sendmail$']
     cmds['dir-pattern-match'] = ['.*bin\/.*', '^\/etc\/.*']
     cmds['skip-symlinks'] = False
+    cmds['pkglist'] = []
 
     try:
-        gopts, argsleft = getopt.getopt(args, 'phqVvndg:s:x:u:c:o:CS', ['help', 'exclude=',
+        gopts, argsleft = getopt.getopt(args, 'phqVvndg:s:x:u:c:o:CSi:', ['help', 'exclude=',
                                                                   'quiet', 'verbose', 'cachedir=', 'basedir=',
                                                                   'baseurl=', 'groupfile=', 'checksum=',
                                                                   'version', 'pretty', 'split', 'outputdir=',
                                                                   'noepoch', 'checkts', 'database', 'update',
-                                                                  'skip-symlinks'])
+                                                                  'skip-symlinks', 'pkglist='])
     except getopt.error, e:
         errorprint(_('Options Error: %s.') % e)
         usage()
@@ -493,7 +499,9 @@ def parseArgs(args):
                 cmds['database'] = True
             elif arg in ['-S', '--skip-symlinks']:
                 cmds['skip-symlinks'] = True
-                
+            elif arg in ['-i', '--pkglist']:
+                cmds['pkglist'] = a
+                                
     except ValueError, e:
         errorprint(_('Options Error: %s') % e)
         usage()
@@ -533,6 +541,16 @@ def parseArgs(args):
             usage()
         cmds['cachedir'] = a
 
+    if cmds['pkglist']:
+        lst = []
+        pfo = open(cmds['pkglist'], 'r')
+        for line in pfo.readlines():
+            line = line.replace('\n', '')
+            lst.append(line)
+        pfo.close()
+            
+        cmds['pkglist'] = lst
+        
     #setup some defaults
     cmds['primaryfile'] = 'primary.xml.gz'
     cmds['filelistsfile'] = 'filelists.xml.gz'
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.