[PATCH] Allow to pass --bindmounts to pdebuild
Sandro Mani
manisandro at gmail.com
Fri Oct 18 11:42:51 UTC 2013
Hi,
The patch below allows users to pass --bindmounts to pdebuild. Possible
usecase: given a large codebase, this allows the user to bindmount the
source tree inside the chroot and do an out-of-tree build, removing the
need to do a time-expensive svn checkout inside the chroot. This makes
automatic, commit-triggered build-regression testing very fast (combined
with ccache).
Thanks,
Sandro
diff -rupN pbuilder-0.215/pdebuild pbuilder-0.215-new/pdebuild
--- pbuilder-0.215/pdebuild 2012-03-13 09:25:00.000000000 +0100
+++ pbuilder-0.215-new/pdebuild 2013-10-18 11:59:53.628462602 +0200
@@ -48,7 +48,7 @@ if [ "${USE_PDEBUILD_INTERNAL}" = 'yes'
${PDEBUILD_PBUILDER} \
--execute \
${EXTRA_CONFIGFILE[@]/#/--configfile } \
- --bindmounts $(readlink -f ..) \
+ --bindmounts "$(readlink -f ..) ${BINDMOUNTS}" \
"$@" \
-- \
/usr/lib/pbuilder/pdebuild-internal \
@@ -85,6 +85,7 @@ else
--buildresult "${BUILDRESULT}" \
--debbuildopts "" \
--debbuildopts "${DEBBUILDOPTS}" \
+ --bindmounts "${BINDMOUNTS}" \
"$@" \
../"${PKG_SOURCENAME}_${PKG_VERSION}".dsc
fi
diff -rupN pbuilder-0.215/pdebuild.1 pbuilder-0.215-new/pdebuild.1
--- pbuilder-0.215/pdebuild.1 2010-01-31 04:52:57.000000000 +0100
+++ pbuilder-0.215-new/pdebuild.1 2013-10-18 12:01:26.342176261 +0200
@@ -90,6 +90,14 @@ Note that for pdebuild, debbuildopts nee
option in the command-line, not as a pbuilder option.
.TP
+.BI "\-\-bindmounts " "bind-mount-points"
+Bind-mount the specified directories to inside the chroot.
+.I "bind-mount-points"
+is a space-delimited list of directories to bind-mount which should be
+specified in a space-delimited manner, surrounded in double quotations,
like:
+.B """/srv /somedir /someotherdir"""
+
+.TP
.BI "\-\-use\-pdebuild\-internal"
Uses a different implementation of pdebuild, which calls clean and
build inside
the chroot, using bind-mounts.
diff -rupN pbuilder-0.215/pdebuild-checkparams
pbuilder-0.215-new/pdebuild-checkparams
--- pbuilder-0.215/pdebuild-checkparams 2010-01-03 03:38:09.000000000
+0100
+++ pbuilder-0.215-new/pdebuild-checkparams 2013-10-18
11:59:25.117915468 +0200
@@ -45,6 +45,10 @@ while [ -n "$1" ]; do
DEBBUILDOPTS="${2:+$DEBBUILDOPTS $2}";
shift; shift;
;;
+ --bindmounts)
+ BINDMOUNTS="${BINDMOUNTS} $2"
+ shift; shift;
+ ;;
--configfile)
if [ ! -f "$2" ]; then
log "E: Config file $2 does not exist"
@@ -130,3 +134,6 @@ fi
if [ -z "${PDEBUILD_PBUILDER}" ]; then
PDEBUILD_PBUILDER="pbuilder"
fi
+
+# sort BINDMOUNTS to ensure that deeper directories are mounted last
+BINDMOUNTS="$(for i in $BINDMOUNTS; do echo $i; done | sort -u)"
More information about the Pbuilder-maint
mailing list