[Piuparts-commits] [piuparts] 04/12: p: factor out Chroot.get_state_meta_data()

Holger Levsen holger at layer-acht.org
Mon Mar 13 12:39:52 UTC 2017


This is an automated email from the git hooks/post-receive script.

holger pushed a commit to branch develop
in repository piuparts.

commit d5e9a4e6d0949223c7aab3f02365181546502eca
Author: Andreas Beckmann <anbe at debian.org>
Date:   Tue Mar 7 01:03:01 2017 +0100

    p: factor out Chroot.get_state_meta_data()
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
    Signed-off-by: Holger Levsen <holger at layer-acht.org>
---
 piuparts.py | 24 +++++++++++-------------
 1 file changed, 11 insertions(+), 13 deletions(-)

diff --git a/piuparts.py b/piuparts.py
index 8873313..28b551a 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -1546,6 +1546,13 @@ class Chroot:
                 vdict[name[len(root):]] = FileInfo(st, target, user, group)
         return vdict
 
+    def get_state_meta_data(self):
+        chroot_state = {}
+        chroot_state["tree"] = self.save_meta_data()
+        chroot_state["selections"] = self.get_selections()
+        chroot_state["diversions"] = self.get_diversions()
+        return chroot_state
+
     def relative(self, pathname):
         if pathname.startswith('/'):
             return os.path.join(self.name, pathname[1:])
@@ -2498,10 +2505,7 @@ def install_purge_test(chroot, chroot_state, package_files, packages, extra_pack
 
         if settings.install_purge_install:
             # save chroot state with all deps installed
-            chroot_state_with_deps = {}
-            chroot_state_with_deps["tree"] = deps_info
-            chroot_state_with_deps["selections"] = chroot.get_selections()
-            chroot_state_with_deps["diversions"] = chroot.get_diversions()
+            chroot_state_with_deps = chroot.get_state_meta_data()
 
     chroot.check_for_no_processes()
     chroot.check_for_broken_symlinks()
@@ -2653,11 +2657,8 @@ def install_and_upgrade_between_distros(package_files, packages_qualified):
 
         chroot.check_for_no_processes(fail=True)
 
-        # set root_info and selections
-        chroot_state = {}
-        chroot_state["tree"] = chroot.save_meta_data()
-        chroot_state["selections"] = chroot.get_selections()
-        chroot_state["diversions"] = chroot.get_diversions()
+        # get root_info and selections
+        chroot_state = chroot.get_state_meta_data()
 
         if settings.save_end_meta:
             # save root_info and selections
@@ -3247,10 +3248,7 @@ def process_packages(package_list):
         if settings.shell_on_error:
             panic_handler_id = do_on_panic(lambda: chroot.interactive_shell())
 
-        chroot_state = {}
-        chroot_state["tree"] = chroot.save_meta_data()
-        chroot_state["selections"] = chroot.get_selections()
-        chroot_state["diversions"] = chroot.get_diversions()
+        chroot_state = chroot.get_state_meta_data()
 
         testable = True
         if chroot.run_scripts("is_testable", ignore_errors=True) != 0:

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/piuparts/piuparts.git



More information about the Piuparts-commits mailing list