I used in the past to build some custom RPM packages for the Linux distribution of my choice, Fedora Core. Building packages is not that difficult, it just requires a prepared environment, some skill to script how a software should be compiled and installed on the machine, and a relative patience, to restart the process from the beginning, when an unexpected error occurs during package generation, which can take a repeated long time when the software to be packaged is a big project. The following items are required:
The drawback of this method is that building a package uses the compilation tools of your own machine, which may introduce subtle problems (for example if the packages of your machine are not up to date, or if you use a non standard compiler by default, if you have a non-standard PATH, or even if your spec file is buggy you can potentially delete files by mistake,...).
Another typical problem with this method is that it is only possible to build packages for the distribution that is running on the build machine, and not for another one. For these reasons, it is important to have a sanitized build environment, that will be independant of the host build environment.
The Fedora project provides a complete infrastructure for building RPM packages, managing the whole chain, starting from the spec file handling, to the publication of packages and their related yum metadata on a remote server, for several Fedora Core distributions simultaneously.
Mock is a chroot-ed environment, automatically configured with a minimal set of packages, and used to build RPM packages. It relies on a set of yum repositories, and can generate build environment for several distributions in parallel. The drawback of mock is the counterpart of its force : it is slow to generate the build environment, because it installs with yum and RPM a minimal linux distribution each time a package is to be build. Hopefully this stage can be optimized :
Plague is the client-server infrastructure used to build Fedora Extras packages. It defines a set of builders, whose role is to receive a .src.rpm file, to build the package using mock locally, and to return the binary packages along with the compilation log to spot errors occuring during the compilation. The more builder you have, the better your build requests are processed. Builder can generate binaries for architectures that are compatible with their host architecture.
A plague server collects build requests, queues them, and dispatches them to the builders, it also collects generated packages, and build logs. All this information is made available via a web interface.
A plague client on the package maintainer machine is a command-line tool, that communicates with the build server, and is used to submit src.rpm packages to be compiled. In this case, src.rpm packages are _not_ the result of a previous compilation, but simply the container that includes the tarball, patches and the spec file needed to compile the program (rpmbuild -bs <specfile> is used to generate this src.rpm file). The client can process the build queue, kill pending jobs, requeue them, query the builders status for example.
The last step of this infrastructure is a CVS server, used to store spec files, and patches for each package. A directory different is created for each package, subdirectories are created to handle branches for multiple distribution versions (FC-4, FC-5, FC-6, devel, ...). Spec files and patches files are versioned in these subdirectories.
Push scripts
The extras-buildsys module of the fedora CVS repository provides some handy python scripts, that collect plague-builded packages, sign them with GnuPG, puts them in a common tree, creates the repodata information for yum, generates html pages describing them, and eventually uploads the final tree onto a remote web server.
The directory layout of packages as generated by plague is specific, because is stores each package version into a specific directory, and each architecture binaries in subdirs. These directories are processed by createrepo, because their content needs to be made available to mock too.
In the mock configuration of each builder, the following repos are needed:
Goodies : viewcvs, bonsai and lxr
Links
The Plague server : http://bellet.info/build
ViewCVS: http://bellet.info/viewcvs
Bonsai: http://bellet.info/bonsai/toplevel.cgi?treeid=extras
External links
http://fedoraproject.org/wiki/Projects/Mock
http://fedoraproject.org/wiki/Projects/Plague
http://fedoraproject.org/wiki/Infrastructure/VersionControl/Current
http://fedoraproject.org/wiki/Extras/UsingCvsFaq