Package: pbuilder
Version: 0.220
Severity: minor
User: [email protected]
Usertag: pbuilder
X-Debbugs-CC: [email protected]
Control: submitter -1 [email protected]


Let me open another bug for this :)

----- Forwarded message from Yves-Alexis Perez <[email protected]> -----

Date: Thu, 19 Nov 2015 11:40:22 +0100
From: Yves-Alexis Perez <[email protected]>
To: [email protected], [email protected]
Subject: Bug#652527: Update on this

I tried to start using an I hook for the exact same reason (dpkg-
scanpackages), but my $BUILDRESULT is a specific folder in my homedir, which
is bind mounted by pbuilder.

Unfortunately, the bind-mounts are removed *before* I hooks are run, which
means I actually can't use it for that.

Is there a possibility to unmount stuff after that?

----- End forwarded message -----

I actually see no reason to umount stuff before the very end, and given
that this behaviour is not documented, so I'm tempted to change this.
Personally I'd also find it more clean/clear.
See the attached diff, would it solve the problem for you?  Maybe you
can think of any downside?

-- 
regards,
                        Mattia Rizzolo

GPG Key: 66AE 2B4A FCCF 3F52 DA18  4D18 4B04 3FCD B944 4540      .''`.
more about me:  http://mapreri.org                              : :'  :
Launchpad user: https://launchpad.net/~mapreri                  `. `'`
Debian QA page: https://qa.debian.org/developer.php?login=mattia  `-
diff --git a/pbuilder-buildpackage b/pbuilder-buildpackage
index 54cf13e..ccd7eb7 100755
--- a/pbuilder-buildpackage
+++ b/pbuilder-buildpackage
@@ -174,37 +174,38 @@ if ! wait "${BUILD_PID}"; then
     eval "${KILL_WAIT_PID}"
     log.e "Failed autobuilding of package"
     executehooks "C"
     exit 1;
 else
     eval ${KILL_WAIT_PID}
     # build was successful
 fi
 
-trap umountproc_cleanbuildplace_trap exit sighup sigpipe
 executehooks "B"
-save_aptcache
-trap cleanbuildplace_trap exit sighup sigpipe
-umountproc
 
 if [ -d "${BUILDRESULT}" ]; then
     chown "${BUILDRESULTUID}:${BUILDRESULTGID}" "${BUILDPLACE}$BUILDDIR/"*
     chgrp "${BUILDRESULTGID}" "${BUILDPLACE}$BUILDDIR/"*
     for FILE in "${BUILDPLACE}$BUILDDIR"/*; do
         if [ -f "${FILE}" ]; then
             cp -p "${FILE}" "${BUILDRESULT}" || true
         fi
     done
     for FILE in "${ADDITIONAL_BUILDRESULTS[@]}"; do
         log.i "Trying to save additional result ${FILE}"
         cp -a "${BUILDPLACE}$BUILDDIR/"*"/${FILE}" "${BUILDRESULT}" || true
     done
     executehooks "I"
 else
     log.e "BUILDRESULT=[$BUILDRESULT] is not a directory."
 fi
 
+# final cleanup
+trap umountproc_cleanbuildplace_trap exit sighup sigpipe
+save_aptcache
+trap cleanbuildplace_trap exit sighup sigpipe
+umountproc
 :
 cleanbuildplace
 trap - exit sighup sigpipe
 echobacktime
 exit 0

Attachment: signature.asc
Description: PGP signature

Reply via email to