[Rpm-metadata] Is there an easy way to get a simple dict of rpm attributes from xml metadata?

Brad Smith brads at redhat.com
Mon Apr 18 01:27:26 UTC 2005


On Sat, 2005-04-16 at 14:21, seth vidal wrote:
> sadly the metadata import routines there are a bit out of date.

Meaning I shouldn't expect any of that to work with an actual xml-ified
repo?

Am I right in thinking that the code you provided would expect to
receive urls from a yum.conf? I need to be able to pass a url (or file
descriptor) for primary.xml or repomd.xml and get back a hash. But hey,
if this is as close as I'm going to get, then I can import and tweak as
necessary. I would have messed around with the code and answered some of
these questions myself, but I'm having a bit of trouble getting it to
run...

> Well it depends on what you're trying to do but you could always just:

<code snipped>

What version of Yum should I be using for this? The version that comes
with FC2 doesn't seem to include a yum module, so I grabbed the 2.1.11
source rpm and copied the modules from it into site-packages. However,
the snippet you provided still didn't work (see below). The problems
persisted when I forced a proper installation of the binary rpm, just in
case I'd missed something (yes, I know this probably breaks package
installation, but for now I just wanted the modules in place). Here's
what happens:

Python 2.3.3 (#1, May  7 2004, 10:31:40)
[GCC 3.3.3 20040412 (Red Hat Linux 3.3.3-7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import yum
>>> foo = yum.YumBase()
>>> foo.doConfigSetup()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: YumBase instance has no attribute 'doConfigSetup'
>>> foo.doRepoSetup()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
AttributeError: YumBase instance has no attribute 'doRepoSetup'
>>> foo.doSackSetup()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/usr/lib/python2.3/site-packages/yum/__init__.py", line 84, in
doSackSetup
    self.log(3, 'Setting up Package Sacks')
AttributeError: YumBase instance has no attribute 'log'
>>>

Looking through the code in the srpm I can't see any definition for eg
doConfigSetup() in YumBase or Depsolve. I assume I have the wrong
version and/or it's some sort of dependency issue since I'm trying to do
it under FC2, but the system that tracker is hosted on is running
RH7.3(!!) and I don't have any control over that, so I'm going to have
to figure out which modules I need and copy them into the tracker
directory regardless. Any ideas?

Thanks again,
--Brad

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://lists.baseurl.org/pipermail/rpm-metadata/attachments/20050417/7fc4625b/attachment.pgp 


More information about the Rpm-metadata mailing list