[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.53-14-g068fb54

Holger Levsen holger at layer-acht.org
Tue Jun 18 09:54:02 UTC 2013


The following commit has been merged in the develop branch:
commit f83395bb45a1b3381494cbf5c1380e7959b0d135
Author: David Steele <dsteele at gmail.com>
Date:   Sat Jun 15 13:24:48 2013 -0400

    piupartslib/packagesdb.py - Add rdep chain length metric calc.
    
    Provide a means for detecting packages which support a long chain
    of reverse dependencies, so that testing priorities can concentrate
    on whittling them down.
    
    -------------------------------

diff --git a/debian/changelog b/debian/changelog
index d5d6c00..73db490 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -12,6 +12,7 @@ piuparts (0.54) UNRELEASED; urgency=low
     - Reworked rdep metrics (block_count, rrdep_count, waiting_count) to
       calculate on-demand. Access methods are moved from Package to
       PackagesDB.
+    - Add a metric for the worst-case reverse-dependency chain length.
 
  -- Holger Levsen <holger at debian.org>  Tue, 11 Jun 2013 15:05:03 +0200
 
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index 613dd89..ab47ab7 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -66,6 +66,7 @@ class Package(UserDict.UserDict):
         self.rrdep_cnt = None
         self.block_cnt = None
         self.waiting_cnt = None
+        self.rdep_chain_len = None
 
     def _parse_dependencies(self, header_name):
         if header_name in self._parsed_deps:
@@ -762,8 +763,10 @@ class PackagesDB:
         rrdep_set = set()
         rdeps = self._get_rdep_dict()
         next_level = set([pkg_name])
+        chain_len = 0
 
         while next_level:
+            chain_len += 1
             rrdep_set |= next_level
             new_pkgs = next_level
             next_level = set([y for x in new_pkgs if x in rdeps for y in rdeps[x]])
@@ -790,6 +793,8 @@ class PackagesDB:
         else:
             pkg.waiting_cnt = 0
 
+        pkg.rdep_chain_len = chain_len
+
     def block_count(self, pkg):
         if pkg.block_cnt is None:
             self._calc_rrdep_pkg_counts(pkg)
@@ -808,5 +813,11 @@ class PackagesDB:
 
         return pkg.waiting_cnt
 
+    def rdep_chain_len(self, pkg):
+        if pkg.rdep_chain_len is None:
+            self.calc_rrdep_pkg_counts(pkg)
+
+        return pkg.rdep_chain_len
+
 
 # vi:set et ts=4 sw=4 :

-- 
piuparts git repository



More information about the Piuparts-commits mailing list