From eac6eb210d52f07a70ad9e5813792becf69ea62c Mon Sep 17 00:00:00 2001 From: Seth Vidal Date: Fri, 13 Jan 2006 06:24:50 +0000 Subject: [PATCH] apply two patches from dgregor@redhat.com - 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 | 2 +- genpkgmetadata.py | 19 +++++++++---------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/dumpMetadata.py b/dumpMetadata.py index 18fb83c..188f734 100644 --- a/dumpMetadata.py +++ b/dumpMetadata.py @@ -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() diff --git a/genpkgmetadata.py b/genpkgmetadata.py index a7973c1..4d1f697 100755 --- a/genpkgmetadata.py +++ b/genpkgmetadata.py @@ -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)): -- 2.34.1