[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Fetching and building dependencies automatically

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.

The target systems where these packages will be run are RHEL4, and we have a
satellite server, so distributing those packages is easy.

However, I am looking for a way to automate the building of packages. The
goal is to have a fully repeatable package build where I start with a single
.spec file, type one command, and the package is built, installing and/or
building dependencies as necessary. Then, when I need a new version of this
package in 6 months' time, I can just update the spec file and issue one
command again.

rpmbuild by itself doesn't do this. It can't download the source files from
the URLs in the spec file, and just aborts if BuildRequires packages are not

So in a bit more detail, what I want is:

1. I ask it to build package X (like 'rpmbuild -bb package-X.spec')

2. It automatically downloads the source tarball and patches into the
   SOURCES directory, using the URL(s) in the spec file

3. It installs all "BuildRequires" packages (and in turn any "Requires"
   packages of those packages)

4. It builds.

Step 3 is recursive. Ideally I'd like it to try to install binary packages
first; if they're not available, then build those from source too.

The main driver for this is to be able to package our own in-house written
software into RPMs, so as to be able to deploy it via satellite server. The
source code is in CVS or SVN; we can write and maintain our own spec files;
but the actual RPM build process is horribly manual at present.

To give a concrete example using a public package, try this:

When you try to build this, you get into dependency hell with 16 other
packages(*) needing to be built and installed.

Now, 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. 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
   (which in turn causes more aborts and recursion)

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 an easy-to-repeat 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 is there a solution? This is bread-and-butter for
FreeBSD (using the ports tree) but doesn't seem to be standard with RPM.

So far, the nearest I've been able to find to my requirements is 'mach':

This doesn't support up2date (it needs yum or apt), and doesn't explicitly
support RHEL. However it may be possible to modify it.

I looked briefly at OpenSUSE build service source, but it looks too
heavyweight for my needs (it's geared up to being a full public-accessed web

Rolling my own solution doesn't look straightforward. Whilst there seems to
be a documented API for *installing* RPMs:
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).

If anyone has pointed to any other solutions to be looking at, I'd be very
grateful to hear of them.




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]