Bug#526471: [PATCH 3/3] Bug#526471: pbuilder: pdebuild-internal fails to execute hook scripts

Francesco Poli (t1000) frx at firenze.linux.it
Fri May 1 16:53:28 UTC 2009


Fix bug #526471: set HOOKDIR and invoke executehooks inside the chroot
root (in pdebuild-internal)
---
 AUTHORS           |    1 +
 debian/changelog  |    5 +++--
 pdebuild-internal |   14 ++++++++++----
 3 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index 77d0885..87c7817 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -12,4 +12,5 @@ Henrique de Moraes Holschuh <hmh at debian.org> -- portion of pbuilder-satisfydepen
 Daniel Schepler <schepler at math.berkeley.edu> -- many patches, --preserve-buildplace
 Sam Hartman <hartmans at debian.org> -- bind-mount patch
 Mattia Dongili <malattia at linux.it> -- user-mode-linux support
+Francesco Poli <frx at firenze.linux.it> -- pdebuild-internal execute hook patch
 
diff --git a/debian/changelog b/debian/changelog
index a3c5ce1..8cc58bc 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,8 +1,9 @@
 pbuilder (0.188) UNRELEASED; urgency=low
 
-  * 
+  * Fix "pdebuild-internal fails to execute hook scripts": set HOOKDIR and
+    invoke executehooks inside the chroot root (Closes: #526471)
 
- -- Francesco Poli (t1000) <frx at firenze.linux.it>  Fri, 01 May 2009 17:19:03 +0200
+ -- Francesco Poli (t1000) <frx at firenze.linux.it>  Fri, 01 May 2009 17:25:15 +0200
 
 pbuilder (0.187) unstable; urgency=low
 
diff --git a/pdebuild-internal b/pdebuild-internal
index ce624b2..1cff0f0 100644
--- a/pdebuild-internal
+++ b/pdebuild-internal
@@ -1,6 +1,7 @@
 #! /bin/bash
 #   pbuilder-internal -- personal Debian package builder, internal routine
 #   Copyright (C) 2003-2007 Junichi Uekawa
+#   Copyright (C) 2008-2009 Francesco Poli
 #
 #   This program is free software; you can redistribute it and/or modify
 #   it under the terms of the GNU General Public License as published by
@@ -77,11 +78,16 @@ while [ -n "$1" ]; do
     esac
 done
 
+# set the temporary hook directory as HOOKDIR, if present
+hooks=tmp/hooks
+if [ -d "/$hooks" ]; then
+    HOOKDIR="/$hooks"
+fi
 # fool pbuilder-runhooks to use / as buildplace, since I am inside chroot.
 BUILDPLACE=
 . /usr/lib/pbuilder/pbuilder-runhooks
 
-executehooks "D"
+(cd / && executehooks "D")
 export PBCURRENTCOMMANDLINEOPERATION="pdebuild"
 "$PBUILDERSATISFYDEPENDSCMD"
 apt-get install -y --force-yes fakeroot
@@ -93,7 +99,7 @@ useradd -g pbgroup -u "${BUILDRESULTUID}" -o pbuser
 # what about id -G output? if other groups than the designated is used, we're stuffed.
 export HOME=$(pwd)/../
 
-executehooks "A"
+(cd / && executehooks "A")
 
 # do build with that user.
 export DEBBUILDOPTS
@@ -103,8 +109,8 @@ if echo /usr/bin/dpkg-buildpackage -rfakeroot -us -uc '${DEBBUILDOPTS}' | \
     # build was successful
     :
 else
-    executehooks "C"
+    (cd / && executehooks "C")
     exit 1
 fi
 
-executehooks "B"
+(cd / && executehooks "B")
-- 
1.6.2.1






More information about the Pbuilder-maint mailing list