[Piuparts-commits] [SCM] piuparts git repository branch, develop, updated. 0.45-102-g4c48ac2

Andreas Beckmann debian at abeckmann.de
Fri Aug 3 08:51:45 UTC 2012


The following commit has been merged in the develop branch:
commit 11e0fe82416fdf3518d1822f7fe56a9c36c958bc
Author: Andreas Beckmann <debian at abeckmann.de>
Date:   Fri Jul 20 11:40:47 2012 +0200

    lib/db: add enable_recycling() method
    
    Signed-off-by: Andreas Beckmann <debian at abeckmann.de>

diff --git a/debian/changelog b/debian/changelog
index fe64f47..abc04c3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -24,6 +24,7 @@ piuparts (0.46) UNRELEASED; urgency=low
     - Implement logfile recycling mode:
       + logfiles to be recycled should be hardlinked from pass/, fail/, ... to
         recycle/
+      + recycling can be enabled if recycle/ is not empty
       + 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
diff --git a/piupartslib/packagesdb.py b/piupartslib/packagesdb.py
index d98b0d0..ac996ff 100644
--- a/piupartslib/packagesdb.py
+++ b/piupartslib/packagesdb.py
@@ -324,6 +324,19 @@ class PackagesDB:
             if not os.path.exists(sdir):
                 os.makedirs(sdir)
 
+    def enable_recycling(self):
+        if self._recycle_mode:
+            return True
+        if self._packages is not None:
+            logging.info("too late for recycling")
+            return False
+        for basename in os.listdir(self._recycle):
+            if basename.endswith(".log"):
+                self._recycle_mode = True
+                return True
+        logging.info("nothing to recycle")
+        return False
+
     def read_packages_file(self, input):
         self._packages_files.append(PackagesFile(input))
         self._packages = None

-- 
piuparts git repository



More information about the Piuparts-commits mailing list