[Rpm-metadata] test if repomd up to date?
Christoph Thiel
cthiel at suse.de
Wed Nov 2 10:34:06 UTC 2005
On Wed, 2 Nov 2005, Erich Focht wrote:
> thanks for the reply. How am I supposed to use cachedir? My attempts
> failed:
>
> focht/bin> createrepo --cachedir /media/usbdisk/SuSE9.3/repodata/repocache/ /media/usbdisk/SuSE9.3/
> Traceback (most recent call last):
> File "/usr/share/createrepo/genpkgmetadata.py", line 485, in ?
> main(sys.argv[1:])
> File "/usr/share/createrepo/genpkgmetadata.py", line 417, in main
> doPkgMetadata(cmds, ts)
> File "/usr/share/createrepo/genpkgmetadata.py", line 266, in doPkgMetadata
> mdobj = dumpMetadata.RpmMetaData(ts, file, cmds)
> File "/usr/share/createrepo/dumpMetadata.py", line 231, in __init__
> self.pkgid = self.doChecksumCache(fo)
> File "/usr/share/createrepo/dumpMetadata.py", line 565, in doChecksumCache
> csumtag = '%s-%s' % (self.hdr['name'] , self.hdr['hdrid'])
> KeyError: 'unknown header tag'
The "hdrid" header alias isn't available in the rpm (4.1.1) on SUSE Linux
9.3. But you could simply patch up your createrepo to use
"rpm.RPMTAG_SHA1HEADER" instead.
I'v attached the patch we currently apply to our createrepo package on
SUSE Linux.
Regards
Christoph
-------------- next part --------------
--- dumpMetadata.py
+++ dumpMetadata.py
@@ -562,7 +562,7 @@
if not self.options['cache']:
return getChecksum(self.options['sumtype'], fo)
- csumtag = '%s-%s' % (self.hdr['name'] , self.hdr['hdrid'])
+ csumtag = '%s-%s' % (self.hdr['name'] , self.hdr[rpm.RPMTAG_SHA1HEADER])
csumfile = '%s/%s' % (self.options['cachedir'], csumtag)
if os.path.exists(csumfile):
csumo = open(csumfile, 'r')
--- genpkgmetadata.py
+++ genpkgmetadata.py
@@ -202,6 +202,8 @@
errorprint(_('This option is deprecated'))
elif arg in ['-c', '--cachedir']:
cmds['cache'] = True
+ if not os.path.isabs(a):
+ a = os.path.join(os.getcwd(), a)
cmds['cachedir'] = a
if not checkAndMakeDir(a):
errorprint(_('Error: cannot open/write to cache dir %s' % a))
More information about the Rpm-metadata
mailing list