ccache + pbuilder
As it looks like there is some ccache hype lately in Planet Debian, I’ll add some of my own.
I use pbuilder to build my packages and it was a real PITA when some big package like wesnoth or kdesomething failed to build and I’d to restart the build from scratch, so (after several months of procastination) I decided to add ccache powers to my pbuilder setup. In fact, it was quite easy, although a bit “dirty”.
-
Create a directory to store the ccache cache for your pbuilder, for example,
/var/cache/pbuilder/ccache - Create a directory to put the needed pbuilder hooks, for example, ~/debian/pbuilder-hooks/
-
Add an A (run just before starting the build) hook to set up ccache, for example, A01ccache:
#!/bin/sh
echo "Setting up ccache"
apt-get install ccache
cd /usr/lib/ccache
for c in *
do
ln -s /usr/bin/ccache /usr/sbin/$c
done
ln -s /var/cache/pbuilder/ccache /root/.ccache
This is the dirty bit, as I can’t set $PATH from one of the hooks, I link the ccache stuff into /usr/sbin/ which precedes /usr/bin/ in $PATH, if somebody knows any other clean way (i.e., without modifying the chroot) to do this, please tell me. -
I’ve two more hooks, to run interactive shells when the package finishes building (or fails building), note that you need to run the shell like this:
/bin/bash < /dev/tty > /dev/tty
-
Run pbuilder with the correct options, I’ve a script named wonderbuild to do this:
#!/bin/sh
pdebuild -- --bindmounts /var/cache/pbuilder/ccache --hookdir ~/debian/pbuilder-hooks/ $*
I expect this to be useful to somebody else, it works really great for me
Any improvement would be welcome.
November 30th, 2005 at 7:12 pm
pbuilder and ccache
Isaac, there is actually a cleaner way to do the same as your hook. Just add the following to your .pbuilderrc file :
export CCACHE_DIR=”/var/cache/pbuilder/ccache”
export PATH=”/usr/lib/ccache:${PATH}”
EXTRAPACKAGES=ccache
BINDMOUNTS=”${CCACH…
November 30th, 2005 at 7:31 pm
I’m not sure how but I managed to delete a very useful comment/trackback from Mike Hommey. http://web.glandium.org/blog/?p=55
“Isaac, there is actually a cleaner way to do the same as your hook. Just add the following to your .pbuilderrc file :
export CCACHE_DIR=”/var/cache/pbuilder/ccache”
export PATH=”/usr/lib/ccache:${PATH}”
EXTRAPACKAGES=ccache
BINDMOUNTS=”${CCACHE_DIR}”
…
February 19th, 2006 at 5:22 am
Playing The Angel
Lick the light switch …