creating build order from rpm spec files

Alfred Landrum <[email protected]>
Newsgroups gmane.linux.rpm.yum
Message-ID <CACB78C3.21F72%[email protected]>
I'm using the yum python api for the first time, and would appreciate
Any comments or guidance.

I've created a small utility that takes a set of rpm spec files and one or
more live yum repos, determines if the spec files can be built, and if so,
what is the required build order according to their dependencies.

This requires an extremely recent rpm lib, so that the rpm.parseSpec
result will generate the 'implicit self-provides' packages.  (See
correspondence with Panu Matilainen here :
http://lists.rpm.org/pipermail/rpm-list/2011-October/001020.html )

The utility works by:
- instantiating a yumbase instance using the supplied repos
- uses rpm.ts().parseSpec to get the rpm headers of the source & built
packages from a .spec file
- uses yum.packages.YumHeaderPackage and yum.packages.FakeRepository to
create a yum package from the rpm headers

It then creates a build order tree:
- finds source packages whose 'requires' are met by calling
returnPackageByDep on their dependencies.
- if the source package can be built, creates a fake package sack to hold
the built packages, and adds them to the yumbase .pkgSack metasack.
- iterates until no more source packages are left, or can be built.

I'm using yum 3.2.29 (on fedora 15).  A couple of specific questions:

- it looks like yum.packageSack.PackageSack never calls the
PackageSackBase init.  This was causing a attribute errors (no attributed
'added').  Is that a buglet?

- is there a straight forward way to create a host-independent yumbase
instance?  Since I want to use existing yum repos as part of the
dependency check, I'm creating a yum.conf file on the fly that lists the
given repos, and disables plugins, etc.  This feels relatively heavy
weight.

Thanks for any advice!

-Alfred
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.