On Sun, 2005-12-04 at 16:35 -0300, Marcos Dione wrote: > hi all. first things first, I'm not subscribed to the list, so please take > care your answer is also sento to me directly. > > I'm developing a little mirroring utility with consistency in mind: the > databases should be consistent to the packages in the mirror, and not blindly > mirror the upstream server. > > anyways, it's developed in python, and now only supports apt-style repos, > but my next move is to support yum-based repos. > > I downloaded yum source code, but it notably lacks of documentation. I'm > looking for the class that, given the database files, shows it to me in a OO > way, preferably as a list of objects that represent a package. I found mdparser > and mdcache, but I'm not sure if any of those is what I'm looking for. > > so, can you gimme a hand here? I will really appreciate. Well the metadata is just xml, you can parse that with whatever, but if you want to use the yum routines to do it you should be able to this: import yum my = yum.YumBase() my.doConfigSetup() my.doRepoSetup(thisrepo='the name or glob of the repos you want to look through) my.doSackSetup(thisrepo='the name or glob of the repos you want to look through) for package_object in my.pkgSack: print package_object that should give you the list of all the packages in the repo. and for more examples like this one - take a look at the yum-utils programs. -sv