]> err.no Git - dak/commitdiff
dak/process_commands.py: remove all processed files to done
authorAnsgar Burchardt <ansgar@debian.org>
Thu, 20 Sep 2012 10:15:01 +0000 (12:15 +0200)
committerAnsgar Burchardt <ansgar@debian.org>
Thu, 20 Sep 2012 10:15:01 +0000 (12:15 +0200)
We want all files that were processed to be moved to done. It would be
confusing to have files in reject when we did evaluate some of the
commands from there and only encountered an error later.

Files that do not pass the GPG check are still moved to the reject
directory.

dak/process_commands.py

index a4ae1f505dab130d65ef53adfb6f0c09c16d377d..d3c794c254c7b8ba6497952b501c6634a38807a4 100644 (file)
@@ -20,11 +20,13 @@ import apt_pkg
 import datetime
 import os
 import sys
+import time
 
 from daklib.config import Config
 from daklib.command import CommandError, CommandFile
 from daklib.daklog import Logger
 from daklib.fstransactions import FilesystemTransaction
+from daklib.gpg import GpgException
 from daklib.utils import find_next_free
 
 def usage():
@@ -64,13 +66,21 @@ def main(argv=None):
             log.log(['unexpected filename', basename])
             continue
 
-        command = CommandFile(fn, log)
-        if command.evaluate():
-            log.log(['moving to done', basename])
-            dst = find_next_free(os.path.join(donedir, basename))
-        else:
-            log.log(['moving to reject', basename])
+        try:
+            command = CommandFile(fn, log)
+            command.evaluate()
+        except:
+            created = os.stat(fn).st_mtime
+            now = time.time()
+            too_new = (now - created < int(cnf.get('Dinstall::SkipTime', '60')))
+            if too_new:
+                log.log(['skipped (too new)'])
+                continue
+            log.log(['reject', basename])
             dst = find_next_free(os.path.join(rejectdir, basename))
+        else:
+            log.log(['done', basename])
+            dst = find_next_free(os.path.join(donedir, basename))
 
         with FilesystemTransaction() as fs:
             fs.move(fn, dst, mode=0o644)