[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.42-19-g0359368

Andreas Beckmann debian at abeckmann.de
Fri Jan 13 09:48:48 UTC 2012


The following commit has been merged in the develop branch:
commit 0f51f6af85d2bf58fb04e041a8645198fdac4310
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Wed Jan 11 13:44:39 2012 +0100

    move root_info into chroot_status["tree"]
    
    prepare bundling all chroot state properties into one dict
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/piuparts.py b/piuparts.py
index 77e58ca..6014137 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -1838,8 +1838,8 @@ def process_changes(changes):
     return package_list
 
 
-def check_results(chroot, root_info, file_owners, deps_info=None):
-    """Check that current chroot state matches 'root_info'.
+def check_results(chroot, chroot_state, file_owners, deps_info=None):
+    """Check that current chroot state matches 'chroot_state'.
 
     If settings.warn_on_others is True and deps_info is not None, then only
     print a warning rather than failing if the current chroot contains files
@@ -1849,6 +1849,7 @@ def check_results(chroot, root_info, file_owners, deps_info=None):
     installed.)
     """
 
+    root_info = chroot_state["tree"]
     ok = True
     if settings.check_broken_diversions:
         (removed, added) = chroot.get_modified_diversions(chroot.pre_install_diversions)
@@ -1914,7 +1915,7 @@ def check_results(chroot, root_info, file_owners, deps_info=None):
     return ok
 
 
-def install_purge_test(chroot, root_info, selections, package_files, packages):
+def install_purge_test(chroot, chroot_state, selections, package_files, packages):
     """Do an install-purge test. Return True if successful, False if not.
        Assume 'root' is a directory already populated with a working
        chroot, with packages in states given by 'selections'."""
@@ -1986,10 +1987,10 @@ def install_purge_test(chroot, root_info, selections, package_files, packages):
     chroot.check_for_no_processes()
     chroot.check_for_broken_symlinks()
 
-    return check_results(chroot, root_info, file_owners, deps_info=deps_info)
+    return check_results(chroot, chroot_state, file_owners, deps_info=deps_info)
 
 
-def install_upgrade_test(chroot, root_info, selections, package_files, packages, old_packages):
+def install_upgrade_test(chroot, chroot_state, selections, package_files, packages, old_packages):
     """Install old_packages via apt-get, then upgrade from package files.
     Return True if successful, False if not."""
 
@@ -2018,14 +2019,14 @@ def install_upgrade_test(chroot, root_info, selections, package_files, packages,
     chroot.check_for_no_processes()
     chroot.check_for_broken_symlinks()
 
-    return check_results(chroot, root_info, file_owners)
+    return check_results(chroot, chroot_state, file_owners)
 
 
-def save_meta_data(filename, root_info, selections):
+def save_meta_data(filename, chroot_state, selections):
     """Save directory tree meta data into a file for fast access later."""
     logging.debug("Saving chroot meta data to %s" % filename)
     f = file(filename, "w")
-    pickle.dump((root_info, selections), f)
+    pickle.dump((chroot_state, selections), f)
     f.close()
 
 
@@ -2033,9 +2034,9 @@ def load_meta_data(filename):
     """Load meta data saved by 'save_meta_data'."""
     logging.debug("Loading chroot meta data from %s" % filename)
     f = file(filename, "r")
-    (root_info, selections) = pickle.load(f)
+    (chroot_state, selections) = pickle.load(f)
     f.close()
-    return root_info, selections
+    return chroot_state, selections
 
 
 def install_and_upgrade_between_distros(package_files, packages):
@@ -2072,7 +2073,7 @@ def install_and_upgrade_between_distros(package_files, packages):
 
     if settings.end_meta:
         # load root_info and selections
-        root_info, selections = load_meta_data(settings.end_meta)
+        chroot_state, selections = load_meta_data(settings.end_meta)
         chroot.pre_install_diversions = []  # FIXME: diversion info needs to be restored
     else:
         if not settings.basetgz:
@@ -2085,13 +2086,14 @@ def install_and_upgrade_between_distros(package_files, packages):
         chroot.check_for_no_processes()
 
         # set root_info and selections
-        root_info = chroot.save_meta_data()
+        chroot_state = {}
+        chroot_state["tree"] = chroot.save_meta_data()
         selections = chroot.get_selections()
         diversions = chroot.get_diversions()
 
         if settings.save_end_meta:
             # save root_info and selections
-            save_meta_data(settings.save_end_meta, root_info, selections)
+            save_meta_data(settings.save_end_meta, chroot_state, selections)
             # FIXME: diversion info needs to be stored
 
         chroot.remove()
@@ -2136,7 +2138,7 @@ def install_and_upgrade_between_distros(package_files, packages):
 
     # use root_info and selections
     chroot.restore_selections(selections, packages)
-    result = check_results(chroot, root_info, file_owners)
+    result = check_results(chroot, chroot_state, file_owners)
 
     chroot.check_for_no_processes()
 
@@ -2521,12 +2523,13 @@ def process_packages(package_list):
         chroot.create()
         cid = do_on_panic(chroot.remove)
 
-        root_info = chroot.save_meta_data()
+        chroot_state = {}
+        chroot_state["tree"] = chroot.save_meta_data()
         chroot.pre_install_diversions = chroot.get_diversions()
         selections = chroot.get_selections()
 
         if not settings.no_install_purge_test:
-            if not install_purge_test(chroot, root_info, selections,
+            if not install_purge_test(chroot, chroot_state, selections,
                       package_files, packages):
                 logging.error("FAIL: Installation and purging test.")
                 panic()
@@ -2541,7 +2544,7 @@ def process_packages(package_list):
                 known_packages = chroot.get_known_packages(packages_to_query)
                 if not known_packages:
                     logging.info("Can't test upgrade: packages not known by apt-get.")
-                elif install_upgrade_test(chroot, root_info, selections, package_files,
+                elif install_upgrade_test(chroot, chroot_state, selections, package_files,
                         packages, known_packages):
                     logging.info("PASS: Installation, upgrade and purging tests.")
                 else:

-- 
piuparts git repository



More information about the Piuparts-commits mailing list