# How can I use local .deb files in my pbuilder builds?

Often I need to create packages which another package depend on (i.e. build dependencies). Instead of having all those packages first being build in my ppa (which can sometimes take some time), I would like to use the results directory from pbuilder as a source for the pbuilder itself.

How can I do this? Can I do this via a hook?

-

You can stick them in a simple repo created with dpkg-scanpackages and make that available via apache. Then update pbuilder's apt config to use your repo.

-
See also wiki.ubuntu.com/PbuilderHowto#Building With Local Packages. Not sure if their OTHERMIRROR example, against local file system works right off. I took the easy route of using a localhost path for my extra package repo. –  andol Sep 4 '10 at 22:01

This can be done a few ways. As mentioned by adol, the Ubuntu wiki has a nice example of how to do this by creating a local repository with mini-dinstall and adding that to your pbuilder config. Dennis' answer about using dpkg-scanpackages works as well.

I've been doing this recently with apt-ftparchive. I like this approach since I find it very light weight. Here's annotated example of what I do:

# From my ~/.pbuilderrc file

# Location of the dir where you keep pbuilder hook scripts.
HOOKDIR="/home/andrew/.pbuilder-hooks"

# Path to your local repo to be used as a mirror written as apt source line.
OTHERMIRROR="deb file:///home/andrew/pbuilder/local_repo ./"

# Path to your local repo. This tells pbuilder to mount this directory so it is available in the chroot.
BINDMOUNTS="/home/andrew/pbuilder/local_repo"

# As we need to have the apt-ftparchive command, we need to insure this package is installed.
EXTRAPACKAGES="apt-utils"


You also need a pbuilder hook:

# From my ~/.pbuilder-hooks/D5update-local-repo file

# Path to the local repo.
LOCAL_REPO="/home/andrew/pbuilder/local_repo"

# Generate a Packages file.
(cd \$LOCAL_REPO ; apt-ftparchive packages . > Packages)

# Update to include any new packages in the local repo.
apt-get update


Now all you have to do is drop the packages into your local repo and they will be available to pbuilder. If you are trying to chain build a string of dependencies you can make you pbuilder results directory as your local repo directory.

You can probably imagine other variations on this. For instance, you could use dput with a post_upload_command to generate the Packages file instead of using the hook.

This Debian wiki page could also be helpful.

-
The hook file needs to be called D05... (two digit number) and needs to be executable. Also (at least when using pbuilder-dist) after adding the apt-utils extra package you have to call pbuilder-dist <dist> update --override-config once. And also also again with pbuilder-dist you need to set the OTHERMIRROR as an environment variable as it overrides the config-file setting. –  BubuIIC Jun 13 '14 at 12:46