Apt repositories

Aus Free Software
Version vom 18. Februar 2012, 10:57 Uhr von Mati (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

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.

How To

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.

chroot environments

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

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:

description=Ubuntu Karmic (amd64)

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

* = 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


... 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.