dburrows/ blog/ entry/ HOWTO get and compile the apt source repository using bzr

Getting apt

apt's source code is managed using bzr. Very fine tutorials and documentation on bzr exist on the Web; I'll give a brief rundown of some useful commands here, but you should read bzr-specific documentation to get a complete understanding of it. bzr is available in the Debian repositories, and likely other distributions have a package of it as well.

The master apt branch for Debian is available at http://bzr.debian.org/apt/debian-sid. Yes, that looks like an empty directory if you view it with a Web browser, but it really contains the source tree. To retrieve it, run:

bzr branch http://bzr.debian.org/apt/debian-sid apt-debian-sid

That will download the repository to the directory apt-debian-sid. It takes a long time to download a fresh copy of the code, so be patient. When bzr branch finishes running, you have a new private copy of the source tree to work with. You can commit changes with bzr commit, download updates with bzr merge, see what you've changed with bzr diff, and copy your changes to a public location with bzr push. Read the bzr manpage and user's manual for full documentation on how to use bzr.

Other public repositories of apt code include:


Compiling apt from its repository

To compile apt, you'll need the following packages on Debian:

That will allow you to build apt without installing it by running make. xmlto is not listed in the Build-Depends line of apt, but you won't be able to produce manpages without it. In particular, you'll need it to produce a Debian package (see below).


Installing a build of the apt repository

The easiest way to install a custom build of apt out of a repository checkout is to build a Debian package from the checkout. Install the following packages:

and run the following command in the top-level directory of the apt repository:

dpkg-buildpackage -rfakeroot -us -uc

This will compile apt and produce several .deb packages in the parent directory of the repository. To install the generated packages, I recommend first installing the devscripts package and then running debi. You can also install the .deb packages by hand by running dpkg -i FILENAME.deb (...).

Warning: installing an interim build of apt is likely to break all the packages that depend on it, such as aptitude and synaptic; interim builds might also be buggy and do strange things to your system. You should not install an unreleased version of apt unless you are sure that you can fix any problems that you encounter as a result of doing so.