]> git.decadent.org.uk Git - dak.git/commitdiff
Make split-done only run on files older than 30 days and run it via cron.weekly
authorJoerg Jaspert <joerg@debian.org>
Fri, 25 Apr 2008 19:06:38 +0000 (21:06 +0200)
committerJoerg Jaspert <joerg@debian.org>
Fri, 25 Apr 2008 19:06:38 +0000 (21:06 +0200)
ChangeLog
config/debian/cron.weekly
dak/split_done.py

index ce36677eccae40482678770469460fb1d5faa620..7666bdba6c0ede14d149e6b10c201145f03ca806 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-04-25  Joerg Jaspert  <joerg@debian.org>
+
+       * dak/split_done.py (main): Only move files into their subdirs if
+       they are older than 30 days. That enables us to run this script as
+       part of a cronjob.
+
+       * config/debian/cron.weekly: Run dak split-done
+
 2008-04-23  Thomas Viehmann  <tviehmann@debian.org>
 
        * dak/process_unchecked.py: add changes["sponsoremail"]
index 53c866f2a24c63f3971e040b82e78dbca932ec67..1124afa81f1970aaa0e1b96879bb2cad96b35218 100755 (executable)
@@ -17,8 +17,12 @@ fi
 
 # Clean up apt-ftparchive's databases
 
+# Split queue/done
+dak split-done
+
 cd $configdir
 apt-ftparchive -q clean apt.conf
 apt-ftparchive -q clean apt.conf.buildd
 
+
 ################################################################################
index 3c50bd1b20d37288c642559b93d6f2f12dc91c06..2fd6f222133bd98d0a429d1b202832d9f7df39f1 100755 (executable)
@@ -26,11 +26,15 @@ import daklib.utils
 def main():
     Cnf = daklib.utils.get_conf()
     count = 0
+    move_date = int(time.time())-(30*84600)
     os.chdir(Cnf["Dir::Queue::Done"])
     files = glob.glob("%s/*" % (Cnf["Dir::Queue::Done"]))
     for filename in files:
         if os.path.isfile(filename):
-            mtime = time.gmtime(os.stat(filename)[stat.ST_MTIME])
+            filemtime = os.stat(filename)[stat.ST_MTIME]
+            if filemtime < move_date:
+                continue
+            mtime = time.gmtime(filemtime)
             dirname = time.strftime("%Y/%m/%d", mtime)
             if not os.path.exists(dirname):
                 print "Creating: %s" % (dirname)