[Piuparts-commits] [SCM] piuparts git repository branch, master, updated. eda668423fa87898c59d1075118693714aa5a053

Andreas Beckmann debian at abeckmann.de
Fri Dec 23 10:27:22 UTC 2011


The following commit has been merged in the master branch:
commit cac2186c2d32df704d96a290fd893964dbe8672b
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Sun Nov 6 15:00:58 2011 +0100

    limit the scope the temp_tgz exists
    
    simplify the temp_tgz handling, limit the scope where it exists
    add note where to use it for restore
    print whe notice about --end-meta a bit earlier and only if applicable
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/TODO b/TODO
index 05741f3..dcabe59 100644
--- a/TODO
+++ b/TODO
@@ -149,6 +149,8 @@ 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/piuparts.py b/piuparts.py
index d9e9b95..79b3b60 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -2016,17 +2016,16 @@ def install_and_upgrade_between_distros(package_files, packages):
     chroot.create()
     cid = do_on_panic(chroot.remove)
 
-    if settings.basetgz:
-        root_tgz = settings.basetgz
-    else:
-        root_tgz = chroot.create_temp_tgz_file()
-        chroot.pack_into_tgz(root_tgz)
-
     if settings.end_meta:
         # load root_info and selections
         root_info, selections = load_meta_data(settings.end_meta)
         chroot.pre_install_diversions = []  # FIXME: diversion info needs to be restored
     else:
+        if not settings.basetgz:
+            temp_tgz = chroot.create_temp_tgz_file()
+            # FIXME: on panic remove temp_tgz
+            chroot.pack_into_tgz(temp_tgz)
+
         chroot.upgrade_to_distros(settings.debian_distros[1:], [])
 
         chroot.check_for_no_processes()
@@ -2043,13 +2042,19 @@ def install_and_upgrade_between_distros(package_files, packages):
 
         chroot.remove()
         dont_do_on_panic(cid)
+
+        # leave indication in logfile why we do what we do
+        logging.info("Notice: package selections and meta data from target disto saved, now starting over from source distro. See the description of --save-end-meta and --end-meta to learn why this is neccessary and how to possibly avoid it.")
+
         chroot = get_chroot()
-        chroot.create()
+        if settings.basetgz:
+            chroot.create()
+        else:
+            # FIXME: restore from temp_tgz
+            chroot.remove_temp_tgz_file(temp_tgz)
+            chroot.create()
         cid = do_on_panic(chroot.remove)
 
-    # leave indication in logfile why we do what we do
-    logging.info("Notice: package selections and meta data from target disto saved, now starting over from source distro. See the description of --save-end-meta and --end-meta to learn why this is neccessary and how to possibly avoid it.")
-
     chroot.check_for_no_processes()
 
     chroot.install_packages_by_name(packages)
@@ -2074,8 +2079,6 @@ def install_and_upgrade_between_distros(package_files, packages):
 
     chroot.check_for_no_processes()
 
-    if root_tgz != settings.basetgz:
-        chroot.remove_temp_tgz_file(root_tgz)
     chroot.remove()
     dont_do_on_panic(cid)
 

-- 
piuparts git repository



More information about the Piuparts-commits mailing list