On Wednesday 13 April 2011 15.10:19 A Mennucc wrote: > I dont see any patch in bug 606158 maybe you should check it... a.
Arrgh. I have too many projects started any lying around half-finished. I
didn't even remember that I did this one.
Oh well. Maybe you've got some time to test this / get it into a shape
worthy of being accepted into pbuilder. patch attached.
thanks for kicking me.
-- vbi
--
<Lo-lan-do> モインさん?
<nobse> Lo-lan-do: Gesundheit.
-- #debian-devel
diff --git a/debian/control b/debian/control
--- a/debian/control
+++ b/debian/control
@@ -30,7 +30,8 @@
devscripts
Suggests: pbuilder-uml,
gdebi-core,
- cowdancer
+ cowdancer,
+ eatmydata
Description: personal package builder for Debian packages
pbuilder constructs a chroot system, and builds a package inside the
chroot.
diff --git a/pbuilder b/pbuilder
--- a/pbuilder
+++ b/pbuilder
@@ -69,7 +69,7 @@
"
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
--- a/pbuilder-buildpackage-funcs
+++ b/pbuilder-buildpackage-funcs
@@ -50,7 +50,7 @@
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
--- a/pbuilder-checkparams
+++ b/pbuilder-checkparams
@@ -217,6 +217,10 @@
OUTPUTFILE[${#OUTPUTFILE[@]}]="$2";
shift; shift;
;;
+ --no-eatmydata)
+ EATMYDATA="no"
+ shift;
+ ;;
## internal options.
--internal-chrootexec)
@@ -306,3 +310,13 @@
# 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
diff --git a/pbuilder-createbuildenv b/pbuilder-createbuildenv
--- a/pbuilder-createbuildenv
+++ b/pbuilder-createbuildenv
@@ -79,6 +79,11 @@
copy_local_configuration
installaptlines
+# 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 "
@@ -102,6 +107,12 @@
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
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -431,6 +431,12 @@
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
}
diff --git a/pbuilder-satisfydepends-checkparams b/pbuilder-satisfydepends-checkparams
--- a/pbuilder-satisfydepends-checkparams
+++ b/pbuilder-satisfydepends-checkparams
@@ -50,6 +50,10 @@
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
--- a/pbuilder.8
+++ b/pbuilder.8
@@ -399,8 +399,12 @@
and want to keep the size of the aptcache down.
.TP
+.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
--- a/pdebuild-checkparams
+++ b/pdebuild-checkparams
@@ -99,6 +99,10 @@
PDEBUILD_PBUILDER="$2"
shift; shift;
;;
+ --no-eatmydata)
+ EATMYDATA="no"
+ shift;
+ ;;
--help)
showhelp
;;
diff --git a/pdebuild-internal b/pdebuild-internal
--- a/pdebuild-internal
+++ b/pdebuild-internal
@@ -89,6 +89,14 @@
# 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,
signature.asc
Description: This is a digitally signed message part.

