[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.49-60-g87e23c3

Andreas Beckmann anbe at debian.org
Thu Feb 21 09:40:48 UTC 2013


The following commit has been merged in the develop branch:
commit bc43a0a2e993ddfe0affcb51fe73ae150d861bb8
Author: Andreas Beckmann <anbe at debian.org>
Date:   Mon Feb 11 00:51:54 2013 +0100

    lib/db: calc_rrdep_counts: count packages waiting for a package
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>

diff --git a/debian/changelog b/debian/changelog
index 0067757..680774d 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -14,6 +14,7 @@ piuparts (0.50) UNRELEASED; urgency=low
     - New global setting slave-directory.
   * piupartslib/conf.py:
   * piupartslib/packagesdb.py:
+    - Add Package.waiting_count() and friends, populated in calc_rrdep_count.
   * piuparts-master.py:
   * piuparts-slave.py:
     - Tarball recreation can be disabled by setting max-tgz-age to 0.
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index 591f7f3..b082540 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -60,6 +60,7 @@ class Package(UserDict.UserDict):
         self._parsed_alt_deps = {}
         self._rrdep_count = None
         self._block_count = None
+        self._waiting_count = None
 
     def _parse_dependencies(self, header_name):
         if header_name in self._parsed_deps:
@@ -136,6 +137,15 @@ class Package(UserDict.UserDict):
     def set_block_count(self, val):
         self._block_count = val
 
+    def waiting_count(self):
+        """Get the number of packages waiting for this package"""
+        if self._waiting_count == None:
+            raise Exception('Waiting count has not been calculated')
+        return(self._waiting_count)
+
+    def set_waiting_count(self, val):
+        self._waiting_count = val
+
     def dump(self, output_file):
         output_file.write("".join(self.headers))
 
@@ -564,6 +574,9 @@ class PackagesDB:
     def get_error_states(self):
         return [x for x in self._propagate_error_state.keys() if x in self._states]
 
+    def get_waiting_states(self):
+        return [x for x in self._propagate_waiting_state.keys() if x in self._states]
+
     def get_pkg_names_in_state(self, state):
         self._compute_package_states()
         return set(self._in_state[state])
@@ -691,6 +704,7 @@ class PackagesDB:
         self._find_all_packages()       # populate _packages
         self._compute_package_states()  # populate _package_state
         error_states = self.get_error_states()
+        waiting_states = self.get_waiting_states()
 
         # create a reverse dependency dictionary.
         # entries consist of a one-level list of reverse dependency package names,
@@ -731,5 +745,12 @@ class PackagesDB:
                 block_list = []
             self._packages[pkg_name].set_block_count( len(block_list) )
 
+            if self._package_state[pkg_name] in waiting_states:
+                waiting_list = [x for x in rrdep_list
+                              if self._package_state[x] in waiting_states]
+            else:
+                waiting_list = []
+            self._packages[pkg_name].set_waiting_count(len(waiting_list))
+
 
 # vi:set et ts=4 sw=4 :

-- 
piuparts git repository



More information about the Piuparts-commits mailing list