[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.53-11-g891122c
Holger Levsen
holger at layer-acht.org
Mon Jun 17 15:55:59 UTC 2013
The following commit has been merged in the develop branch:
commit ad9bf07648e6498b4160165a205cfe0f2391b1d8
Author: David Steele <dsteele at gmail.com>
Date: Sat Mar 2 15:51:07 2013 -0500
packagesdb - Add rdep metric accessors at the PackagesDB level.
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index bee2ec4..17cc4e1 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -63,9 +63,9 @@ class Package(UserDict.UserDict):
self[name.strip()] = value.strip()
self._parsed_deps = {}
self._parsed_alt_deps = {}
- self._rrdep_count = None
- self._block_count = None
- self._waiting_count = None
+ self.rrdep_cnt = None
+ self.block_cnt = None
+ self.waiting_cnt = None
def _parse_dependencies(self, header_name):
if header_name in self._parsed_deps:
@@ -126,30 +126,30 @@ class Package(UserDict.UserDict):
def rrdep_count(self):
"""Get the recursive dependency count, if it has been calculated"""
- if self._rrdep_count == None:
+ if self.rrdep_cnt == None:
raise Exception('Reverse dependency count has not been calculated')
- return self._rrdep_count
+ return(self.rrdep_cnt)
def set_rrdep_count(self, val):
- self._rrdep_count = val
+ self.rrdep_cnt = val
def block_count(self):
"""Get the number of packages blocked by this package"""
- if self._block_count == None:
+ if self.block_cnt == None:
raise Exception('Block count has not been calculated')
- return self._block_count
+ return(self.block_cnt)
def set_block_count(self, val):
- self._block_count = val
+ self.block_cnt = val
def waiting_count(self):
"""Get the number of packages waiting for this package"""
- if self._waiting_count == None:
+ if self.waiting_cnt == None:
raise Exception('Waiting count has not been calculated')
- return self._waiting_count
+ return(self.waiting_cnt)
def set_waiting_count(self, val):
- self._waiting_count = val
+ self.waiting_cnt = val
def dump(self, output_file):
output_file.write("".join(self.headers))
@@ -818,6 +818,24 @@ class PackagesDB:
else:
pkg.set_waiting_count(0)
+ def block_count(self, pkg):
+ if pkg.block_cnt is None:
+ self._calc_rrdep_pkg_counts(pkg)
+
+ return pkg.block_cnt
+
+ def rrdep_count(self, pkg):
+ if pkg.rrdep_cnt is None:
+ self._calc_rrdep_pkg_counts(pkg)
+
+ return pkg.rrdep_cnt
+
+ def waiting_count(self, pkg):
+ if pkg.waiting_cnt is None:
+ self._calc_rrdep_pkg_counts(pkg)
+
+ return pkg.waiting_cnt
+
def calc_rrdep_counts(self):
"""Calculate recursive reverse dependency counts for Packages"""
--
piuparts git repository
More information about the Piuparts-commits
mailing list