We have repositories for the APT package management system. Originally coming from the TUn!x project, they have grown into providing the official daily build for Spectrum and hosting virtually all Jabber related packages.
All the code as well as all the packages are in a various git repositories.
- This How To assumes solid knowledge in shell scripting and some knowledge of the python programming language
- This How To does not cover how to actually create new Debian packages, there are a many tutorials on the Internet, please refer to them. Our infrastructure does require two additional targets in the debian/rules file, they are described in an extra section.
The first thing you will have to do, is set up a chroot environment for every distribution and every architecture that you want to build packages for. There is a good How To for that in the Ubuntu Wiki.
The rest of the How To (and some of the code in these scripts) assumes that you have set up your chroots in /chroot. Each environment is named dist-arch. So our directory layout looks like this:
mati@haumea:/chroot$ ls hardy-amd64 hardy-i386 intrepid-amd64 intrepid-i386
The script mchroot executes a command for every directory it finds in /chroot. The string DIR is replaced with the directory at hand. You therefor should configure all your schroots (see Ubuntu Wiki) to have exactly the same name as these directories, example:
[karmic-amd64] description=Ubuntu Karmic (amd64) location=/chroot/karmic-amd64 priority=3 users=mati groups=users root-groups=root
Please make sure that the /home directory is remounted in every chroot so that directories in your /home is available everywhere.
All our packages are in git repositories. The packages are normal Debian packages but follow a few extra conventions. The conformance to these conventions is assumed by the script build_package.py.
Because you don't want all the extracted source code in the repository (but only the files in the debian directory), the debian/rules file has two additional targets:
- The prepare target extracts the original source into the current directory. In other words, it transforms a directory that only contains the debian/ directory into a directory from which a debian package can be build with 'debian/rules binary' (that is, the normal package building procedure).
- Reverses the above step.
You can check any of the rules files in our git repositories for examples. They tend to be almost the same for every package.
Packages are located in a directory that corresponds to the distribution for which they should be build. If the directory is called 'all', it means that the package is intended for every distribution. If a package is located in all and in, say, lenny, the package in all will be built for every distribution EXCEPT lenny, where the package in the lenny directory will be built. See the git repositories for an example of how this structure looks.
Additionally, every package should have a .cfg-file with the same name in the above directory. build.py moves the created packages into a directory structure conforming to an APT repository. The file should have a section "components" that names in which components ("universe", "multiverse", etc. on Ubuntu) the packages should be available. The files are always located in the 'all' component and symlinks will be created for every other component. Use '*' to name every package created, you can also name individual package that extend components. Here is an example
[components] * = jabber jabber-clients pidgin libpurple0 = spectrum
In this case, every binary package created will be available in the components jabber, jabber-clients and pidgin, libpurle0 will additionally available in the component 'spectrum'.
Building the packages
Now that you have your chroots and your packages ready, it is time to build the package for all chroots that we have configured. This is exactly what 'mchroot' is for:
mchroot schroot -c DIR -d /home/mati/repositories/all/pidgin-2.6.6 ../../scripts/build.py
After completion, the packages just built will be available in ~/build in a directory structure that reflects an apt repository.
Maintaining the apt repository
The repo-maint script creates the index files of an apt repository. Because some information is retrieved dynamically, you have to create some directories etc. yourself. Here is an example structure that should be available
dists/ dists/lenny/ dists/lenny/Release.head dists/lenny/all/ dists/lenny/all/all/ dists/lenny/all/source/ dists/lenny/all/binary-amd64/ dists/lenny/all/binary-i386/
... where 'lenny' is the distribution, Release.head is used for the Release-files (see here for an example), 'all' (the one directly under lenny) is the component, 'all' (the one beneath 'lenny/all') contains all the packages and the 'binary-arch' directories will have the release files for each architecture that you build for.