8

I have a apt-cacher-ng server on my LAN network, and I was wondering how I could "force" pbuilder to use it (to speed up package builds).

Typical setup client-side of the cache goes something like this:

In /etc/apt/apt.conf:

Acquire::http { Proxy "http://servername:3142"; };

Lekensteyn
  • 171,743
  • 65
  • 311
  • 401
jrg
  • 60,101
  • 54
  • 172
  • 246
  • pbuilder has a `--mirror` option that i guess sets the mirror to use. Try setting it to apt-cache-ng server address. – Salem Jan 17 '12 at 17:03
  • @Salem I don't think that'd do it, since apt-cacher-ng is just a proxy not a mirror. – jrg Jan 17 '12 at 17:07
  • @jrg apt-cacher-ng can run as a mirror. Simply use `http://servername:3142/ubuntu` as your mirror url. – T0xicCode Apr 16 '13 at 20:24

3 Answers3

3

If you set export http_proxy=http://your-proxy:8080/ in ~/.pbuilderrc it will use that proxy for the package downloads.

I just tried it on my setup, and it worked. As best I could tell from the internet traffic, I didn't have to download anything while running pbuilder create.

The nice thing is that this way also works when you are creating the tarball, not just after you create it and then modify it.

Azendale
  • 11,811
  • 9
  • 47
  • 70
3

Like this:

$ sudo pbuilder --login --save-after-login
# echo 'Acquire::http { Proxy "http://servername:3142"; };' > /etc/apt/apt.conf.d/02proxy
# exit
$

Alternatively, you could use the --execute option:

$ sudo pbuilder --execute --save-after-exec -- /tmp/setup-apt-proxy.sh

... where /tmp/setup-apt-proxy.sh contains commands to create /etc/apt/apt.conf.d/02proxy.

Alexis Wilke
  • 2,632
  • 2
  • 21
  • 33
jamesodhunt
  • 1,970
  • 15
  • 11
  • Will `servername` be found from the build environment? Shouldn't one use an IP address instead, since the proxy is most certainly local? – Alexis Wilke Jul 24 '16 at 23:21
0

I used the --mirror argument, eg:

sudo pbuilder create --debootstrapopts --variant=buildd --configfile ~/.pbuilderrc --mirror http://localhost:3142/us.archive.ubuntu.com/ubuntu/ main restricted universe multiverse

verify the caching hits on the proxy:

$ tail -f  /var/log/apt-cacher/access.log 
Thu Dec 19 19:16:33 2013|26140|::ffff:127.0.0.1|HIT|1272844|us.archive.ubuntu.com_ubuntu_dists_precise_main_binary-amd64_Packages.bz2
Thu Dec 19 19:18:45 2013|26647|::ffff:127.0.0.1|HIT|49563|us.archive.ubuntu.com_ubuntu_dists_precise_Release
Thu Dec 19 19:18:45 2013|26663|::ffff:127.0.0.1|HIT|198|us.archive.ubuntu.com_ubuntu_dists_precise_Release.gpg
Thu Dec 19 19:18:46 2013|26707|::ffff:127.0.0.1|HIT|1272844|us.archive.ubuntu.com_ubuntu_dists_precise_main_binary-amd64_Packages.bz2
kom
  • 351
  • 3
  • 4