Re: Is there an easy way to get a simple dict of rpm attributes from xml metadata?
seth vidal <[email protected]>
| Newsgroups | gmane.linux.rpm.metadata |
|---|---|
| Message-ID | <1113686500.22733.21.camel@cutter> |
> The plan was to have the tracker's back-end script download the xml
> files for a repository, then use code from Seth's importmetadata.py
> (http://www.linux.duke.edu/~skvidal/metadata/) to load up a packageSack
> with all of the metadata in it. I could convert each set of rpm data in
> the sack into an instace of tracker's internal repo.rpmInfo class, since
> I already have code to handle putting those into the database.
>
sadly the metadata import routines there are a bit out of date.
> Does anyone have suggestions for an alternative that I may be missing?
> All I know about what tools have already been written is what I've
> gleaned from the code I can find, so maybe there's something more suited
> to my purposes. Something that takes an xml file and returns a dict akin
> to what rpm.headerLoad() returns would be ideal. Does such a thing
> already exist?
>
> Thanks, and sorry if any of this sounds dumb. =;)
Well it depends on what you're trying to do but you could always just:
import yum
foo = yum.YumBase()
foo.doConfigSetup()
foo.doRepoSetup()
foo.doSackSetup()
foo.pkgSack is a package Sack object and it's filled with PackageObject
instances.
then you can just do:
for pkg in foo.pkgSack:
print pkg.returnSimple('description')
print dir(pkg)
Then you can take that data and store it however you want.
-sv