[pbuilder] 03/03: Add builtin eatmydata support

Mattia Rizzolo mattia at debian.org
Wed May 25 16:31:30 UTC 2016


This is an automated email from the git hooks/post-receive script.

mattia pushed a commit to branch master
in repository pbuilder.

commit 1ad3cf8c39daac75b1246056a20ae0f21e0e3683
Author: Mattia Rizzolo <mattia at debian.org>
Date:   Wed May 25 16:30:47 2016 +0000

    Add builtin eatmydata support
    
    Closes: #606158
---
 debian/control                      |  1 +
 pbuilder-checkparams                | 19 ++++++++++++++++---
 pbuilder-createbuildenv             |  8 ++++++++
 pbuilder-modules                    | 17 +++++++++++++++--
 pbuilder-satisfydepends-checkparams |  9 +++++++++
 pbuilder-satisfydepends-funcs       |  1 +
 pbuilder-updatebuildenv             |  9 +++++++++
 pbuilderrc                          |  1 +
 pbuilderrc.5                        |  6 ++++++
 9 files changed, 66 insertions(+), 5 deletions(-)

diff --git a/debian/control b/debian/control
index b89ce84..363f11e 100644
--- a/debian/control
+++ b/debian/control
@@ -24,6 +24,7 @@ Depends: debootstrap | cdebootstrap,
          wget,
          ${misc:Depends}
 Recommends: devscripts,
+            eatmydata,
             fakeroot,
             net-tools | iproute2,
             sudo
diff --git a/pbuilder-checkparams b/pbuilder-checkparams
index 549d2a5..5a7add6 100755
--- a/pbuilder-checkparams
+++ b/pbuilder-checkparams
@@ -327,9 +327,6 @@ BASEBUILDPLACE="$BUILDPLACE"
 if [ "${INTERNAL_BUILD_UML}" != "yes" -a "${PRESERVE_BUILDPLACE}" != "yes" ]; then
     BUILDPLACE="$BUILDPLACE/$$"
 fi
-if [ -z "${CHROOTEXEC}" ]; then
-    CHROOTEXEC="chroot $BUILDPLACE "
-fi
 
 # sanity check of LOGLEVEL
 case "$LOGLEVEL" in
@@ -341,6 +338,22 @@ case "$LOGLEVEL" in
         ;;
 esac
 
+# set up CHROOTEXEC
+if [ -z "${CHROOTEXEC}" ]; then
+    CHROOTEXEC="chroot $BUILDPLACE "
+    if [ "$EATMYDATA" = "yes" ]; then
+        if /sbin/ldconfig -p | grep libeatmydata >/dev/null 2>&1 ; then
+            if ! which eatmydata > /dev/null 2>&1 ; then
+                log.w "the eatmydata binary is not installed on the host, not using it."
+                EATMYDATA=no
+            fi
+        else
+            log.w "libeatmydata is not installed on the host, not using it."
+            EATMYDATA=no
+        fi
+    fi
+fi
+
 # handle 'experimental' specially. -- required for raw pbuilder (create/update) only.
 case "$PBUILDER_OPERATION" in
     update|create)
diff --git a/pbuilder-createbuildenv b/pbuilder-createbuildenv
index 916144c..aef4cb9 100755
--- a/pbuilder-createbuildenv
+++ b/pbuilder-createbuildenv
@@ -110,6 +110,14 @@ if [ -n "$CCACHEDIR" ]; then
 else
     REMOVEPACKAGES="$REMOVEPACKAGES ccache"
 fi
+if [ "$EATMYDATA" = "yes" ]; then
+    # the eatmydata binary is going nowhere anytime soon, while the libeatmydata1
+    # binary is shaped like a shared library, so the name might change, etc.
+    # Install this package instead, it's cheap enough.
+    EXTRAPACKAGES="$EXTRAPACKAGES eatmydata"
+else
+    REMOVEPACKAGES="$REMOVEPACKAGES eatmydata"
+fi
 
 if [ -n "$REMOVEPACKAGES" ]; then remove_packages $REMOVEPACKAGES ; fi
 recover_aptcache
diff --git a/pbuilder-modules b/pbuilder-modules
index e53686b..6be096c 100644
--- a/pbuilder-modules
+++ b/pbuilder-modules
@@ -514,7 +514,7 @@ function copy_local_configuration () {
 function extractbuildplace () {
     # after calling this function, umountproc, and cleanbuildplace
     # needs to be called. Please trap it after calling this function.
-
+    local TAR=tar
     if [ "${INTERNAL_BUILD_UML}" != "yes" -a ! \( "${PRESERVE_BUILDPLACE}" = "yes" -a -d "$BUILDPLACE" \) ]; then
         cleanbuildplace
         log.i "Building the build Environment"
@@ -527,7 +527,10 @@ function extractbuildplace () {
             log.e "failed to find $BASETGZ, have you done <pbuilder create> to create your base tarball yet?"
             exit 1
         fi
-        if ! (cd "$BUILDPLACE" && tar -x --use-compress-program "$COMPRESSPROG" -p -f "$BASETGZ"); then
+        if [ "$EATMYDATA" = "yes" ]; then
+            TAR="eatmydata tar"
+        fi
+        if ! (cd "$BUILDPLACE" && $TAR -x --use-compress-program "$COMPRESSPROG" -p -f "$BASETGZ"); then
             log.e "failed to extract $BASETGZ to $BUILDPLACE"
             exit 1
         fi
@@ -571,6 +574,16 @@ function extractbuildplace () {
             log.w "Could not create compatibility symlink because /tmp/buildd exists and it is not a directory"
         fi
     fi
+
+    if [ "$EATMYDATA" = "yes" ]; then
+        if $CHROOTEXEC /sbin/ldconfig -p | grep -q libeatmydata && $CHROOTEXEC which eatmydata > /dev/null 2>&1 ; then
+            log.i "using eatmydata during job"
+            CHROOTEXEC="chroot $BUILDPLACE eatmydata"
+        else
+            log.w "eatmydata is not (yet) installed inside the chroot, not using it."
+        fi
+    fi
+
     executehooks "H"
 }
 
diff --git a/pbuilder-satisfydepends-checkparams b/pbuilder-satisfydepends-checkparams
index c6e8de9..684b700 100755
--- a/pbuilder-satisfydepends-checkparams
+++ b/pbuilder-satisfydepends-checkparams
@@ -28,6 +28,7 @@ FORCEVERSION=""
 CONTINUE_FAIL="no"
 CHROOTEXEC_AFTER_INTERNAL_CHROOTEXEC=no
 ALLOWUNTRUSTED=no
+EATMYDATA=no
 
 while [ -n "$1" ]; do
     case "$1" in
@@ -86,6 +87,10 @@ while [ -n "$1" ]; do
 	    ALLOWUNTRUSTED=yes
 	    shift;
 	    ;;
+    --eatmydata)
+        EATMYDATA=yes
+        shift
+        ;;
 	--help|-h|*)
 	    print_help
 	    exit 1
@@ -102,4 +107,8 @@ if [ $ALLOWUNTRUSTED = yes ]; then
 	APTITUDEOPT[${#APTITUDEOPT[@]}]='Aptitude::CmdLine::Ignore-Trust-Violations=true'
 fi
 
+if [ "$EATMYDATA" = "yes" ]; then
+    CHROOTEXEC="$CHROOTEXEC eatmydata"
+fi
+
 checkbuilddep_internal
diff --git a/pbuilder-satisfydepends-funcs b/pbuilder-satisfydepends-funcs
index 18ae33b..969ae5c 100755
--- a/pbuilder-satisfydepends-funcs
+++ b/pbuilder-satisfydepends-funcs
@@ -362,6 +362,7 @@ Copyright 2002-2007  Junichi Uekawa <dancer at debian.org>
 --echo:        echo mode, do nothing. (--force-version required for most operation)
 --force-version: skip version check.
 --continue-fail: continue even when failed.
+--eatmydata    wrap the chroots commands with eatmydata
 
 EOF
 }
diff --git a/pbuilder-updatebuildenv b/pbuilder-updatebuildenv
index fafe891..8718c14 100755
--- a/pbuilder-updatebuildenv
+++ b/pbuilder-updatebuildenv
@@ -58,6 +58,15 @@ else
     REMOVEPACKAGES="$REMOVEPACKAGES ccache"
 fi
 
+if [ "$EATMYDATA" = "yes" ]; then
+    # the eatmydata binary is going nowhere anytime soon, while the libeatmydata1
+    # binary is shaped like a shared library, so the name might change, etc.
+    # Install this package instead, it's cheap enough.
+    EXTRAPACKAGES="$EXTRAPACKAGES eatmydata"
+else
+    REMOVEPACKAGES="$REMOVEPACKAGES eatmydata"
+fi
+
 if [ "$DEBDELTA" = "yes" ]; then
     EXTRAPACKAGES="$EXTRAPACKAGES debdelta python-apt xdelta3"
 else
diff --git a/pbuilderrc b/pbuilderrc
index 45106f7..1a7f0cd 100644
--- a/pbuilderrc
+++ b/pbuilderrc
@@ -44,6 +44,7 @@ APTCACHEHARDLINK="yes"
 REMOVEPACKAGES=""
 #HOOKDIR="/usr/lib/pbuilder/hooks"
 HOOKDIR=""
+EATMYDATA=no
 # NB: this var is private to pbuilder; ccache uses "CCACHE_DIR" instead
 # CCACHEDIR="/var/cache/pbuilder/ccache"
 CCACHEDIR=""
diff --git a/pbuilderrc.5 b/pbuilderrc.5
index 8d1aa2c..d653660 100644
--- a/pbuilderrc.5
+++ b/pbuilderrc.5
@@ -112,6 +112,12 @@ command-line option.
 The path is not canonicalized, so you should specify a full-path,
 not a relative path.
 .TP
+.BI "EATMYDATA=" "no"
+Enable or disable the builtin eatmydata support.
+.br
+For this to work the library of the same architecture as the one inside the
+chroot has to be installed in the host.
+.TP
 .BI "CCACHEDIR=" "/var/cache/pbuilder/ccache"
 Specifies where ccache will keep its cached compiler output.
 If this is specified, ccache will be installed upon pbuilder create or

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pbuilder/pbuilder.git



More information about the Pbuilder-maint mailing list