[pbuilder] Make it possible to pass --bindmounts to pdebuild

Sandro Mani smani at fedoraproject.org
Fri Oct 18 11:44:32 UTC 2013


commit e2aeb17394b12474ef78966ff5f86835ba361670
Author: Sandro Mani <manisandro at gmail.com>
Date:   Fri Oct 18 13:44:29 2013 +0200

    Make it possible to pass --bindmounts to pdebuild

 pbuilder.spec                      |    9 +++++-
 pbuilder_pdebuild-bindmounts.patch |   59 ++++++++++++++++++++++++++++++++++++
 2 files changed, 67 insertions(+), 1 deletions(-)
---
diff --git a/pbuilder.spec b/pbuilder.spec
index a666ce3..8e3b35c 100644
--- a/pbuilder.spec
+++ b/pbuilder.spec
@@ -1,6 +1,6 @@
 Name:           pbuilder
 Version:        0.215
-Release:        5%{?dist}
+Release:        6%{?dist}
 Summary:        Personal package builder for Debian packages
 
 License:        GPLv2+
@@ -15,6 +15,9 @@ Patch1:         pbuilder_no-chown.patch
 Patch2:         pbuilder_pbuilderrc.patch
 # Don't test non-existing ubuntu arm-mirrors
 Patch3:         pbuilder_test-arm.patch
+# Make it possible to pass --bindmounts to pdebuild, see
+# http://lists.alioth.debian.org/pipermail/pbuilder-maint/2013-October/004839.html
+Patch4:         pbuilder_pdebuild-bindmounts.patch
 
 BuildArch:      noarch
 
@@ -44,6 +47,7 @@ dependencies.
 %patch1 -p1
 %patch2 -p1
 %patch3 -p1
+%patch4 -p1
 
 # Adjust ccache path
 sed -i 's|/usr/lib/ccache|%{_libdir}/ccache|g' pbuilderrc
@@ -116,6 +120,9 @@ make check
 
 
 %changelog
+* Fri Oct 18 2013 Sandro Mani <manisandro at gmail.com> - 0.215-6
+- Add patch to make it possible to pass --bindmounts to pdebuild
+
 * Mon Oct 14 2013 Sandro Mani <manisandro at gmail.com> - 0.215-5
 - Package is noarch
 - Co-own %{_sysconfdir}/bash_completion.d/
diff --git a/pbuilder_pdebuild-bindmounts.patch b/pbuilder_pdebuild-bindmounts.patch
new file mode 100644
index 0000000..2f87a57
--- /dev/null
+++ b/pbuilder_pdebuild-bindmounts.patch
@@ -0,0 +1,59 @@
+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 scm-commits mailing list