[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.44-712-g09a3a78
Andreas Beckmann
debian at abeckmann.de
Sun Jun 17 13:36:43 UTC 2012
The following commit has been merged in the develop branch:
commit b3ab6834ab6f47f2dc99164adfe2a3057172f929
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Fri Jun 15 15:31:57 2012 +0200
p: cleanup metapackage on panic
add panic handler to cleanup the metapackage build directory
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/debian/changelog b/debian/changelog
index d380ff4..40aa2b5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -60,6 +60,7 @@ piuparts (0.45) UNRELEASED; urgency=low
- Perform chroot cleanup after receiving Ctrl-C/SIGINT, too.
- Let Chroot register/de-register the cleanup panic handler.
- Remove temp_tgz on error exit.
+ - Remove metapackage build directory on error exit. (Closes: #663702)
* piuparts.conf:
- Make master-command a [global] instead of a [section] setting.
The section name will be given as an argument to this command.
diff --git a/piuparts.py b/piuparts.py
index 5641ba9..b00ab19 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -499,6 +499,7 @@ def make_metapackage(name, depends, conflicts):
# Inspired by pbuilder's pbuilder-satisfydepends-aptitude
tmpdir = tempfile.mkdtemp(dir=settings.tmpdir)
+ panic_handler_id = do_on_panic(lambda: shutil.rmtree(tmpdir))
old_umask = os.umask(0)
os.makedirs(os.path.join(tmpdir, name, 'DEBIAN'), mode = 0755)
os.umask(old_umask)
@@ -521,6 +522,7 @@ def make_metapackage(name, depends, conflicts):
control.dump())
run(['dpkg-deb', '-b', os.path.join(tmpdir, name)])
+ dont_do_on_panic(panic_handler_id)
return os.path.join(tmpdir, name) + '.deb'
@@ -2034,13 +2036,16 @@ def install_purge_test(chroot, chroot_state, package_files, packages):
all_conflicts = ", ".join(conflicts)
metapackage = make_metapackage("piuparts-depends-dummy",
all_depends, all_conflicts)
+ cleanup_metapackage = lambda: shutil.rmtree(os.path.dirname(metapackage))
+ panic_handler_id = do_on_panic(cleanup_metapackage)
# Install the metapackage
chroot.install_package_files([metapackage])
# Now remove it
metapackagename = os.path.basename(metapackage)[:-4]
chroot.purge_packages([metapackagename])
- shutil.rmtree(os.path.dirname(metapackage))
+ cleanup_metapackage()
+ dont_do_on_panic(panic_handler_id)
# Save the file ownership information so we can tell which
# modifications were caused by the actual packages we are testing,
--
piuparts git repository
More information about the Piuparts-commits
mailing list