[Piuparts-commits] [piuparts] 02/09: lib/db: use a tuple for the weight

Holger Levsen holger at moszumanska.debian.org
Mon Feb 10 13:03:03 UTC 2014


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

holger pushed a commit to branch develop
in repository piuparts.

commit 4db688cb015bd0a46e0833244d70e80a7eb401b2
Author: Andreas Beckmann <anbe at debian.org>
Date:   Sun Dec 8 22:05:48 2013 +0100

    lib/db: use a tuple for the weight
    
    and use more fine grained values
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
 piupartslib/packagesdb.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index 07731d6..bbfec62 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -692,10 +692,15 @@ class PackagesDB:
         return package_state
 
     def _get_package_weight(self, p):
+        # compute the priority of a package that needs testing
+        # result will be used as a reverse sorting key, so higher is earlier
         waiting_count = self.waiting_count(p["Package"])
         rdep_chain_len = self.rdep_chain_len(p["Package"])
 
-        return waiting_count * rdep_chain_len
+        return (
+                min(rdep_chain_len, waiting_count),
+                waiting_count,
+                )
 
     def _find_packages_ready_for_testing(self):
         if self._candidates_for_testing is None:

-- 
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