apply two patches from dgregor@redhat.com
authorSeth Vidal <skvidal@linux.duke.edu>
Fri, 13 Jan 2006 06:24:50 +0000 (06:24 +0000)
committerSeth Vidal <skvidal@linux.duke.edu>
Fri, 13 Jan 2006 06:24:50 +0000 (06:24 +0000)
- verifies that the checksum cache file is more recent than the
corresponding rpm
- move around cmds dict initialization to make it more consistent.

dumpMetadata.py
genpkgmetadata.py

index 18fb83c3d77f3feaac647e2fa3b3e530b3ef65ee..188f734d60eafc7e1e00cc49c84573fd76b09612 100644 (file)
@@ -568,7 +568,7 @@ class RpmMetaData:
         
         csumtag = '%s-%s' % (self.hdr['name'] , self.hdr[rpm.RPMTAG_SHA1HEADER])
         csumfile = '%s/%s' % (self.options['cachedir'], csumtag)
-        if os.path.exists(csumfile):
+        if os.path.exists(csumfile) and self.mtime <= os.stat(csumfile)[8]:
             csumo = open(csumfile, 'r')
             checksum = csumo.readline()
             csumo.close()
index a7973c1cf5458ea71ae31f5c06e7793586641a84..4d1f697cbfd3c7a35cbee5e5660d34efc3437d61 100755 (executable)
@@ -416,6 +416,14 @@ def parseArgs(args):
         errorprint(_('Options Error: %s') % e)
         usage()
 
+    #setup some defaults
+    cmds['primaryfile'] = 'primary.xml.gz'
+    cmds['filelistsfile'] = 'filelists.xml.gz'
+    cmds['otherfile'] = 'other.xml.gz'
+    cmds['repomdfile'] = 'repomd.xml'
+    cmds['tempdir'] = '.repodata'
+    cmds['finaldir'] = 'repodata'
+    cmds['olddir'] = '.olddata'
 
     return cmds, directories
 
@@ -449,16 +457,7 @@ def main(args):
         if not checkAndMakeDir(a):
             errorprint(_('Error: cannot open/write to cache dir %s' % a))
             usage()
-        cmds['cachdir'] = a
-
-    #setup some defaults
-    cmds['primaryfile'] = 'primary.xml.gz'
-    cmds['filelistsfile'] = 'filelists.xml.gz'
-    cmds['otherfile'] = 'other.xml.gz'
-    cmds['repomdfile'] = 'repomd.xml'
-    cmds['tempdir'] = '.repodata'
-    cmds['finaldir'] = 'repodata'
-    cmds['olddir'] = '.olddata'
+        cmds['cachedir'] = a
 
     # start the sanity/stupidity checks
     if not os.path.exists(os.path.join(cmds['basedir'], directory)):