[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 598b6e35a85c0dcb90f4906bf4366180fe8fee53
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Fri Jun 15 15:25:42 2012 +0200

    p: cleanup temp_tgz on panic
    
    add panic handler that clean up the temp_tgz
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/TODO b/TODO
index 5e32fe1..cf25c43 100644
--- a/TODO
+++ b/TODO
@@ -123,8 +123,6 @@ for 0.50 and later:
 Low priority stuff (a.k.a. "nobody's said they must have it now")
 -----------------------------------------------------------------
 
-- piuparts.py: add a panic handler to remove the temp_tgz
-
 - create archive of broken packages to provide test cases for
   piuparts testing.
 
diff --git a/debian/changelog b/debian/changelog
index 472f95b..d380ff4 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -59,6 +59,7 @@ piuparts (0.45) UNRELEASED; urgency=low
       in the chroot.
     - Perform chroot cleanup after receiving Ctrl-C/SIGINT, too.
     - Let Chroot register/de-register the cleanup panic handler.
+    - Remove temp_tgz on error exit.
   * 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 1d93bf2..5641ba9 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -2165,7 +2165,7 @@ def install_and_upgrade_between_distros(package_files, packages):
         temp_tgz = None
         if chroot.was_bootstrapped():
             temp_tgz = chroot.create_temp_tgz_file()
-            # FIXME: on panic remove temp_tgz
+            panic_handler_id = do_on_panic(lambda: chroot.remove_temp_tgz_file(temp_tgz))
             chroot.pack_into_tgz(temp_tgz)
 
         chroot.upgrade_to_distros(settings.debian_distros[1:], [])
@@ -2193,6 +2193,7 @@ def install_and_upgrade_between_distros(package_files, packages):
         else:
             chroot.create(temp_tgz)
             chroot.remove_temp_tgz_file(temp_tgz)
+            dont_do_on_panic(panic_handler_id)
 
     chroot.check_for_no_processes()
 

-- 
piuparts git repository



More information about the Piuparts-commits mailing list