Using cowbuilder and reprepro with unreleased libraries


There exists a superior solution to this problem, which is documented in Enrico Zini's pbuilder tips. See there for how to do this using the OTHERMIRROR option.

My current workflow is having my reprepro available over HTTPS and running

cowbuilder --update --othermirror 'deb [ allow-insecure=yes trusted=yes ] unstable main' --override-config

before any cowbuilder builds which need local repositories; a

cowbuilder --update --override-config

restores the original builder (probably limited to situations where an update of the base system doesn't actually install packages from the local repository).

The text below is being kept online for reference only.

The problem

When you are packaging new software for Debian and a library it depends on, you probably want to build it in a clean environment before publishing it. An easy way to get such an environment is cowbuilder.

For testing new packages before uploading them, it is sometimes useful to have an own repository, maintaining which is quite easy with reprepro.

If there are dependencies between a bunch of new packages, they can't easily be built in cowbuilder as cowbuilder per default only queries Debian's main repository and area.

Additionally, when building packages from the contrib area, the packages built can build-depend on packge from non-free or contrib. These dependencies can't be satisfied from the default configuration either.

The solution

Create a pbuilder configuration (as cowbuilder is based on pbuilder), let's call it ~/.config/pbuilder/rc-myrepo:

BINDMOUNTS="<path to your repository> $HOOKDIR"

When this configuration is included in a cowbuilder run, the repository and the HOOKDIR will be bind-mounted into the build environment, and scripts from the rc-myrepo-hooks directory will be executed at appropriate places during the build run.

Next, create a directory ~/.config/pbuilder/rc-myrepo-hooks and a file ~/.config/pbuilder/rc-myrepo-hooks/D10-myrepo (and set it executable):

echo "adding own repository"
echo "deb file://<path to your repository> unstable main contrib" >> /etc/apt/sources.list

echo "updating index"
apt-get update

(In this example, both the main and the contrib areas are used from the reprepro repository.)

If you want to build contrib packages, put the following two lines below the #! line:

echo "adding non-free to sources.list"
sed -i 's/main/main contrib non-free/g' /etc/apt/sources.list

Now, you can build your packges using:

sudo cowbuilder --build <package>-<version>.dsc --configfile ~/.config/pbuilder/rc-myrepo