Fetching and building dependencies automatically
Brian Candler
B.Candler at pobox.com
Tue Mar 6 15:56:53 CET 2007
Hello,
I have an RPM building question. I'm familiar with writing spec files and
building RPMs from them, and I can build individual packages just fine.
However, I've been unable to find a way to get rpmbuild to handle the
building of dependent packages recursively. What I want is:
1. Ask it to build package X (OK so far: rpmbuild -bb package-X.spec)
2. Automatically download the source tarball into the SOURCES directory,
using the URL in the spec file
3. Install all "BuildRequires" packages (and in turn any "Requires"
packages of those packages)
4. Build it
Step 3 is where the recursion comes in. Ideally I'd like it to try to
install binary packages first; if they're not available, then build those
from source too.
To give a concrete example, try building perl-SOAP-Lite as an RPM. Getting
hold of a suitable spec file is easy enough:
http://svn.rpmforge.net/svn/trunk/rpms/perl-SOAP-Lite/perl-SOAP-Lite.spec
However, when you try to build this, you get into dependency hell with 16
other packages(*) needing to be built and installed.
I don't mind downloading the spec files for those 17 packages. The trouble
is, the way I've been doing the building, it's a very manual process.
Perhaps I've been going about this the wrong way, but what I've been doing
is:
1. wget http://whatever/perl-SOAP-Lite.spec
(at this point, rpmbuild -bb perl-SOAP-Lite.spec fails because the
source hasn't been downloaded)
2. open the spec file, interpret the URL line to get the source location
then type (cd ../SOURCES; wget http://whatever/source-x.xx.tgz)
3. rpmbuild -bb perl-SOAP-Lite.spec
note the missing BuildRequires
4. recursively return to step 1 to build each of the BuildRequires
5. install the BuildRequires (rpm -Uvh ../RPMS/i386/whatever.rpm or
rpm -Uvh ../RPMS/noarch/whatever.rpm as appropriate)
This is a pain, and it doesn't exactly give a repeatable build.
I'd like to be able to check those 17 spec files into a local CVS, issue one
command, and get all of the packages built (and installed, where necessary
for the build to continue), in the correct order.
Wishful thinking? Or do you know of a solution for this?
This is bread-and-butter for FreeBSD (ports tree), and I'm pretty sure
Debian and gentoo can handle this too. But so far I've been unable to find
anything like this for RPM.
I'd also consider writing something like this, if it doesn't already exist.
However, whilst there seems to be a documented API for *installing* RPMs:
http://www.rpm.org/max-rpm/s1-rpm-rpmlib-functions.html
I've not found a corresponding API for *building* RPMs. (Well, I've found
/usr/include/rpm/rpmbuild.h, but it's pretty opaque to me). Perhaps it's OK
just to parse the output of rpmbuild.
Any pointers gratefully received.
Cheers,
Brian.
(*)
perl-Compress-Zlib
perl-MIME-Lite
perl-Net-Jabber
perl-Net-XMPP
perl-Authen-SASL
perl-XML-Stream
perl-GSSAPI
perl-Test-Pod
perl-Test-Pod-Coverage
perl-Pod-Simple
perl-Pod-Coverage
perl-Pod-Escapes
perl-Module-Build
perl-Devel-Symdump
perl-Archive-Tar
perl-ExtUtils-CBuilder
More information about the freshrpms-list
mailing list