As part of the infrastructure team for Linaro, I’m working on various kinds of build service — particular image builds and package builds.  Both of these involve running things like ‘apt-get update’ and ‘debootstrap’ a lot, and for as I’m in New Zealand and the servers these commands pull from are in London, a caching proxy between the board and the internet makes things go a _lot_ faster.

On Michael Hope‘s recommendation I installed polipo which seems to mostly work, although it seems to fall over whenever I sleep my laptop, which is a bit lame.  I have it configured to listen on 10.0.0.1 and answer requests from 127.0.0.1 and 10.0.0.0/24 (so I can point programs running on my laptop at it if I want/to test it’s working).  My config file looks like this:

proxyAddress = 10.0.0.1
allowedClients = 127.0.0.1, 10.0.0.0/24
cacheIsShared = false
dnsUseGethostbyname = happily

The only non-trivial thing to figure out was the dnsUseGethostbyname thing — this is required for hostnames in /etc/hosts to be resolved by the proxy, something that matters when the board is trying to download files from “librarian.launchpad.dev”.

Then it just remains to set http_proxy to http://10.0.0.1:8123/ in .bashrc on the board and allow the http_proxy environment variable to be passed though sudo by adding the following line using visudo:

Defaults        env_keep += "http_proxy"

Then just enjoy the better performance of the package manipulations (after the first time, at least).