Hi! Here's Adrian's patch, rebased onto pbuilder 213.
Please apply, even on ext4 it makes a drastic speed-up.
From 2ebea361de614b5e482bc71432c71e80e9f40e02 Mon Sep 17 00:00:00 2001 From: Adam Borowski <[email protected]> Date: Sun, 16 Dec 2012 17:55:12 +0100 Subject: [PATCH] Eatmydata integration (Adrian von Bidder). --- debian/control | 3 ++- pbuilder | 2 +- pbuilder-buildpackage-funcs | 2 +- pbuilder-checkparams | 14 ++++++++++++++ pbuilder-createbuildenv | 12 ++++++++++++ pbuilder-modules | 6 ++++++ pbuilder-satisfydepends-checkparams | 4 ++++ pbuilder.8 | 6 +++++- pdebuild-checkparams | 4 ++++ pdebuild-internal | 8 ++++++++ 10 files changed, 57 insertions(+), 4 deletions(-) diff --git a/debian/control b/debian/control index f4a1f94..47b77ad 100644 --- a/debian/control +++ b/debian/control @@ -31,7 +31,8 @@ Recommends: fakeroot, devscripts Suggests: pbuilder-uml, gdebi-core, - cowdancer + cowdancer, + eatmydata Homepage: http://pbuilder.alioth.debian.org Description: personal package builder for Debian packages pbuilder constructs a chroot system, and builds a package inside the diff --git a/pbuilder b/pbuilder index d816183..4bfee48 100755 --- a/pbuilder +++ b/pbuilder @@ -69,7 +69,7 @@ File extracted to: $BUILDPLACE " fi executehooks "F" - (${CHROOTEXEC} bin/bash -c 'exec -a -bash bin/bash') + (${CHROOTEXEC} /bin/bash -c 'exec -a -bash bin/bash') RET=$? save_aptcache diff --git a/pbuilder-buildpackage-funcs b/pbuilder-buildpackage-funcs index 3083f03..98d6de1 100644 --- a/pbuilder-buildpackage-funcs +++ b/pbuilder-buildpackage-funcs @@ -50,7 +50,7 @@ function checkbuilddep () { fi # install extra packages to the chroot if [ -n "$EXTRAPACKAGES" ]; then - $CHROOTEXEC usr/bin/apt-get -q -y "${APTGETOPT[@]}" install ${EXTRAPACKAGES} + $CHROOTEXEC /usr/bin/apt-get -q -y "${APTGETOPT[@]}" install ${EXTRAPACKAGES} fi } diff --git a/pbuilder-checkparams b/pbuilder-checkparams index 3cdc48e..cf08d77 100755 --- a/pbuilder-checkparams +++ b/pbuilder-checkparams @@ -231,6 +231,10 @@ while [ -n "$1" ]; do OUTPUTFILE[${#OUTPUTFILE[@]}]="$2"; shift; shift; ;; + --no-eatmydata) + EATMYDATA="no" + shift; + ;; ## internal options. --internal-chrootexec) @@ -321,6 +325,16 @@ fi # sort BINDMOUNTS to ensure that deeper directories are mounted last BINDMOUNTS="$(for i in $BINDMOUNTS; do echo $i; done | sort -u)" +# enable eatmydata if available and not disabled +if [ -f "/usr/lib/libeatmydata/libeatmydata.so" -a "$EATMYDATA" != "no" ]; then + if [ -z "$LD_PRELOAD" ]; then + export LD_PRELOAD="/usr/lib/libeatmydata/libeatmydata.so" + else + pbuilder_old_LD_PRELOAD="$LD_PRELOAD" + export LD_PRELOAD="$LD_PRELOAD:/usr/lib/libeatmydata/libeatmydata.so" + fi +fi + if [ "$ALLOWUNTRUSTED" = "yes" ]; then PBUILDERSATISFYDEPENDSOPT[${#PBUILDERSATISFYDEPENDSOPT[@]}]='--allow-untrusted' # Also duplicated in pbuilder-satisfydepends-checkparams! diff --git a/pbuilder-createbuildenv b/pbuilder-createbuildenv index 8362b1c..40057f4 100755 --- a/pbuilder-createbuildenv +++ b/pbuilder-createbuildenv @@ -89,6 +89,12 @@ mkdir -p "$BUILDPLACE/tmp/buildd" copy_local_configuration installaptlines add_additional_aptkeyrings + +# Can't use eatmydata while it is not yet installed in the chroot +if echo "$LD_PRELOAD" | grep -q libeatmydata.so; then + LD_PRELOAD="$pbuilder_old_LD_PRELOAD" +fi + executehooks "G" log "I: Refreshing the base.tgz " @@ -112,6 +118,12 @@ else EXTRAPACKAGES="$EXTRAPACKAGES ccache-" fi +if [ "$EATMYDATA" != "no" ]; then + EXTRAPACKAGES="$EXTRAPACKAGES eatmydata" +else + EXTRAPACKAGES="$EXTRAPACKAGES eatmydata-" +fi + if [ -n "$REMOVEPACKAGES" ]; then # FIXME this wont work if the packages have some reverse dependencies; # apt-get can also remove package, either with apt-get remove or purge, or diff --git a/pbuilder-modules b/pbuilder-modules index 5c935eb..ebf60ce 100644 --- a/pbuilder-modules +++ b/pbuilder-modules @@ -457,6 +457,12 @@ function extractbuildplace () { mountproc mkdir -p "$BUILDPLACE/tmp/buildd" + + # if available inside the chroot and if not disabled, use eatmydata: + if [ -f "$BUILDPLACE/usr/lib/libeatmydata/libeatmydata.so" \ + -a "$EATMYDATA" != "no" ]; then + CHROOTEXEC="$CHROOTEXEC eatmydata " + fi } function echobacktime () { diff --git a/pbuilder-satisfydepends-checkparams b/pbuilder-satisfydepends-checkparams index 24a601f..2df9717 100755 --- a/pbuilder-satisfydepends-checkparams +++ b/pbuilder-satisfydepends-checkparams @@ -44,6 +44,10 @@ while [ -n "$1" ]; do echo '--chroot specified after --internal-chrootexec' >&2 exit 1 fi + if [ -f "$CHROOT/usr/lib/libeatmydata/libeatmydata.so" \ + -a "$EATMYDATA" != "no" ]; then + CHROOTEXEC="$CHROOTEXEC eatmydata " + fi shift; shift ;; --internal-chrootexec) diff --git a/pbuilder.8 b/pbuilder.8 index a2f37c3..64c6ec6 100644 --- a/pbuilder.8 +++ b/pbuilder.8 @@ -417,8 +417,12 @@ This is useful when you keep a aptcache directory for each distribution and want to keep the size of the aptcache down. .TP -.BI "\-\-help" +.BI "\-\-no\-eatmydata" +Do not use eatmydata. Eatmydata is used by default if installed (on the host +system when creating the base.tgz or in the base.tgz for all other operations.) +.TP +.BI "\-\-help" Show a brief help message. .SH "MORE SPECIFIC OPTIONS" diff --git a/pdebuild-checkparams b/pdebuild-checkparams index b6ba0ed..f49002c 100644 --- a/pdebuild-checkparams +++ b/pdebuild-checkparams @@ -99,6 +99,10 @@ while [ -n "$1" ]; do PDEBUILD_PBUILDER="$2" shift; shift; ;; + --no-eatmydata) + EATMYDATA="no" + shift; + ;; --help) showhelp ;; diff --git a/pdebuild-internal b/pdebuild-internal index 0c4fb99..79c330a 100644 --- a/pdebuild-internal +++ b/pdebuild-internal @@ -89,6 +89,14 @@ BUILDPLACE=/ # chroot command will just chroot to /, which will effectively chdir # to / and nothing else. CHROOTEXEC="chroot $BUILDPLACE " +# if not explicitly disabled and if available: enable eatmydata +if [ -f "/usr/lib/libeatmydata/libeatmydata.so" -a "$EATMYDATA" != "no" ]; then + if [ -z "$LD_PRELOAD" ]; then + export LD_PRELOAD="/usr/lib/libeatmydata/libeatmydata.so" + else + export LD_PRELOAD="$LD_PRELOAD:/usr/lib/libeatmydata/libeatmydata.so" + fi +fi # make HOOKDIR contain something if there is a hook, to fool HOOKDIR # check inside pbuilder-runhooks that there is HOOKDIR # configuration. We don't call loadhooks or unloadhooks ourselves, -- 1.8.1.rc0
signature.asc
Description: Digital signature

