[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.45-102-g4c48ac2
Andreas Beckmann
debian at abeckmann.de
Fri Aug 3 08:51:44 UTC 2012
The following commit has been merged in the develop branch:
commit f9fa8bd6baa6549dc437e6907847bff1e58f77aa
Author: Andreas Beckmann <debian at abeckmann.de>
Date: Fri Jul 20 11:17:21 2012 +0200
lib/db: implement logfile recycling
if in recycle mode and the selected package has a log in recycle/:
delete all logs for this package
if not in recycle mode, but the selected package has a log in recycle/:
clear the recycle request as the package will be processed
(the regular log was probably deleted manually)
Signed-off-by: Andreas Beckmann <debian at abeckmann.de>
diff --git a/debian/changelog b/debian/changelog
index 9e85694..fe64f47 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -26,6 +26,7 @@ piuparts (0.46) UNRELEASED; urgency=low
recycle/
+ treat packages with logfile in recycle/ as initially "unknown" and
compute state ("waiting[-for-dependency]-to-be-tested")
+ + delete old logfile while reserving such a package
* piuparts-master.py:
- Accept and discard duplicate log submissions, preventing the slave from
retrying infinitely.
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index 4180fa7..d98b0d0 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -24,6 +24,7 @@ Lars Wirzenius <liw at iki.fi>
"""
+import logging
import os
import tempfile
import time
@@ -593,9 +594,19 @@ class PackagesDB:
return self.get_pkg_names_in_state("waiting-to-be-tested")
def reserve_package(self):
+ all_but_recycle = [x for x in self._all if x != self._recycle]
pset = self._find_packages_ready_for_testing()
while (len(pset)):
p = self.get_package(pset.pop())
+ if self._recycle_mode and self._logdb.log_exists(p, [self._recycle]):
+ for vdir in all_but_recycle:
+ if self._logdb.log_exists(p, [vdir]):
+ self._logdb.remove(vdir, p["Package"], p["Version"])
+ logging.info("Recycled %s %s %s" % (vdir, p["Package"], p["Version"]))
+ if self._logdb.log_exists(p, all_but_recycle):
+ continue
+ if self._logdb.log_exists(p, [self._recycle]):
+ self._logdb.remove(self._recycle, p["Package"], p["Version"])
if self._logdb.create(self._reserved, p["Package"], p["Version"], ""):
return p
return None
--
piuparts git repository
More information about the Piuparts-commits
mailing list