[Piuparts-commits] [piuparts] 04/09: lib/db: consider logfile age when recycling

Holger Levsen holger at moszumanska.debian.org
Tue Feb 10 12:18:07 UTC 2015


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

holger pushed a commit to branch develop
in repository piuparts.

commit 4d18e83ea37e878d247b1600a909a6723c39b337
Author: Andreas Beckmann <anbe at debian.org>
Date:   Tue Feb 10 10:49:08 2015 +0100

    lib/db: consider logfile age when recycling
    
    in addition to the time it has been waiting in recycle/
    
    Signed-off-by: Andreas Beckmann <anbe at debian.org>
---
 debian/changelog          | 2 ++
 piupartslib/packagesdb.py | 9 ++++++---
 2 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 4b48dba..9907a24 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -16,6 +16,8 @@ piuparts (0.63) UNRELEASED; urgency=medium
     - Add new suite: wheezy2jessie-rcmd (test with --install-recommends).
   * distros.conf: Reactivate 'testing' and 'stable' aliases, switch them back
     to 'jessie' and 'wheezy' for ongoing development.
+  * piupartslib/packagesdb.py:
+    - Consider logfile age in addition to the time waiting for recycling.
   * piuparts-slave.py:
     - Handle Ctrl-C while downloading Packages files and flush/unreserve, too.
     - Catch another exception that may happen while talking to the master.
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index 1153071..0fbfde9 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -717,15 +717,18 @@ class PackagesDB:
 
         try:
             statobj = self._logdb.stat(self._recycle, p["Package"], p["Version"])
-            stamp = statobj[stat.ST_CTIME]  # last inode modification = time of linking into recycle/
+            ctime = statobj[stat.ST_CTIME]  # last inode modification = time of linking into recycle/
+            mtime = statobj[stat.ST_MTIME]
         except OSError:
-            stamp = 0
+            ctime = 0
+            mtime = 0
 
         return (
                 min(rdep_chain_len, waiting_count),
                 waiting_count,
                 not self._logdb.log_exists(p, [self._ok]),  # prefer problematic logs
-                -stamp,  # prefer older
+                -ctime / 3600,  # prefer older, at 1 hour granularity to allow randomization
+                -mtime / 3600,  # prefer older, at 1 hour granularity to allow randomization
                 )
 
     def _find_packages_ready_for_testing(self):

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