[Piuparts-devel] [PATCH] compute the changes in restore_selections()

Andreas Beckmann debian at abeckmann.de
Sun Nov 6 09:39:05 UTC 2011


pass the selections to restore_selections() and compute the changes there

Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

---
 piuparts.py |   15 ++++++---------
 1 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/piuparts.py b/piuparts.py
index 42ea1dd..bc5eaa1 100644
--- a/piuparts.py
+++ b/piuparts.py
@@ -871,10 +871,11 @@ class Chroot:
         self.run(["dpkg", "--remove", "--pending"], ignore_errors=True)
 
  
-    def restore_selections(self, changes, packages):
+    def restore_selections(self, selections, packages):
         """Restore package selections in a chroot by applying 'changes'.
            'changes' is a return value from diff_selections."""
  
+        changes = diff_selections(self, selections)
         deps = {}
         nondeps = {}
         for name, state in changes.iteritems():
@@ -1741,8 +1742,7 @@ def install_purge_test(chroot, root_info, selections, package_files, packages):
     file_owners = chroot.get_files_owned_by_packages()
 
     # Remove all packages from the chroot that weren't there initially.    
-    changes = diff_selections(chroot, selections)
-    chroot.restore_selections(changes, packages)
+    chroot.restore_selections(selections, packages)
     
     chroot.check_for_broken_symlinks()
 
@@ -1766,10 +1766,8 @@ def install_upgrade_test(chroot, root_info, selections, package_files, packages)
     
     file_owners = chroot.get_files_owned_by_packages()
 
-    # Remove all packages from the chroot that weren't there
-    # initially.
-    changes = diff_selections(chroot, selections)
-    chroot.restore_selections(changes, packages)
+    # Remove all packages from the chroot that weren't there initially.
+    chroot.restore_selections(selections, packages)
     
     chroot.check_for_no_processes()
     chroot.check_for_broken_symlinks()
@@ -1876,8 +1874,7 @@ def install_and_upgrade_between_distros(package_files, packages):
     file_owners = chroot.get_files_owned_by_packages()
 
     # use root_info and selections
-    changes = diff_selections(chroot, selections)
-    chroot.restore_selections(changes, packages)
+    chroot.restore_selections(selections, packages)
     result = check_results(chroot, root_info, file_owners)
 
     chroot.check_for_no_processes()
-- 
tg: (741b7b7..) t/style/compute-changes (depends on: t/style/consistent-variable-names)



More information about the Piuparts-devel mailing list