Development/Packaging/BuildSystem/Theory
From Mandriva
Status: Work in progress
Contents |
Introduction
What it is
The Mandriva Buildsystem is a collection of repositories and bots created to automate the process of building distribution packages in a clean, trusted environment, offering revison control of package data and metadata and transparent multi-architecture support.
The system as it exists today was implemented by Florent Villard using custom tools and third-party products such as Youri and Mdvsys. It can be roughly separated in a Front desk subsystem which receives and stores packages, and a Build core subsystem that performs the actual build. The Front desk was designed by Gustavo Niemeyer for use in the Conectiva buildsystem, and the Build core is a brainchild of Florent Villard.
About this document
This description of the build system was primarily written for build system maintainers, and not for package developers. It is also not an original design document: instead, it was written after an analysis of the implemented system, so names and terms used in this document (such as "build box" or "the pipeline") may not match names and terms used in the original buildsystem design. Furthermore, this document only presents the general concepts of how the system works: discussion of problems and possible improvements are in Build System Improvements, and installation details are in Build System Details.
Curious users might find the description of the system interesting, since knowing the internals allows the user to take advantage of the design and implementation to work in a more productive way. This knowledge, however, is not essential and one can use the system normally after reading only the end-user documentation.
Further reference
- Build System Details: the gory implementation details.
- Build System Improvements: some ways to solve problems in the current build system.
- Repository quickstart: user's guide for the repository system.
- Build system index: the master index for Buildsystem-related documents.
How it works
The big picture
The build systems's main characters are Ulri (the scheduler), Iurt (the builder) and Emi (the uploader). Ulri keeps a queue of incoming packages and chooses a suitable build node to build packages on, and runs Iurt on it. Emi asynchronously collects resulting packages from Iurt jobs and uploads them to the distribution repository.
Build system architecture (View large | SVG)
Package flow
The complete package pathway goes through a six-stage pipeline, the first stage being the developer's computer and the last one being the FTP site from where the final product can be obtained.
The Pipeline (View large | SVG)
The implementation
Package transport
The build system relies in different protocols for data transfer and control, including scp, NFS and HTTP. Data is copied to/from the Subversion repository using svn+ssh, source packages are sent to the build cluster via scp and binary packages are retrieved also using scp.
Protocols used for package transport and control (View large | SVG)
Pipeline stages
Most of the system runs in kenobi. It serves the subversion repository, both input and output queues, has a local copy of the distribution repository and runs the scheduler. The final upload to the distribution directory is performed by a script that runs in ken.
Actual location of pipeline stages (View large | SVG)
The build cluster
The build cluster builds binary packages for different targets and architectures (such as i586 2007.1 or x86_64 cooker). It currently has three i586 nodes (n1, n3 and n5) and two x86_64 nodes (seggie and deborah). A single source rpm package is dispatched to all architectures and is considered "built" only if build succeeds in all mandatory architectures.
Cluster nodes must have an account for the build user, with sudo access to run iurt. Nodes are scheduled using ssh and files copied with scp, so the build user should be able to authenticate using public key instead of an interactive password.
Final upload
The scheduler
Queue management
Packages wait in the input queue until scheduled. At each run the scheduler checks for availability of build nodes for each package in the queue; if there is a free build bot it dispatches the build job for build in that node, otherwise it exits.