****************
launchpad-buildd
****************

This project is the build daemon used by Launchpad's package-building
infrastructure.

It is licensed under the GNU Affero General Public Licence, version 3 (see the
file LICENCE) except for some files originating elsewhere, which are marked
with the licence that applies.

See https://dev.launchpad.net/ for more context.

----

In order to build the package you need dpkg-dev and fakeroot

To build the package do:

debian/rules package
dpkg-buildpackage -rfakeroot -b

It will "fail" because the package built in the "wrong" place. Don't
worry about that.

To clean up, do:

fakeroot debian/rules clean
rm launchpad-buildd*deb
rm ../launchpad-buildd*changes


Developing
************

First of all, it is recommended that you create a lxc container, since the
following steps will make changes in your system. And since some build types
will only work with virtualized containers, creating a lxc vm is the best way
to go. You can create a container with the following command:

        lxc launch --vm ubuntu:18.04 lp-builddev

Note that you may want to have a profile to share the source code with the
container before running the above command.

Then, inside the container, install the necessary dependencies:

        sudo apt-get update
        cat system-dependencies.txt | sudo xargs apt-get install -y

This should be enough for you to be able to run `make check`, which runs the
test suite both in python2 and python3.

More information on how to integrate it with Launchpad can be found here:
https://dev.launchpad.net/Soyuz/HowToDevelopWithBuildd

Now, happy coding.


Production deployment notes
***************************

In Launchpad's production build farm, launchpad-buildd is deployed via base
virtual machine images constructed by taking standard Ubuntu cloud images
and installing launchpad-buildd in them from
https://launchpad.net/~canonical-is-sa/+archive/ubuntu/buildd.  This is done
by
https://code.launchpad.net/~canonical-sysadmins/canonical-is-charms/launchpad-buildd-image-modifier
(currently private, sorry).

At present (November 2020), most of these base VM images are built from
Ubuntu bionic, and launchpad-buildd runs on Python 3.  However, it's
necessary to support the powerpc architecture until at least April 2021 (end
of standard maintenance for xenial), and the powerpc base images need to
stay on xenial since that architecture is no longer supported by bionic;
furthermore, the version of Twisted in xenial has some bugs that break
launchpad-buildd when running on Python 3.  As a result, launchpad-buildd
must run on both Python 2 and 3 for the time being.
