cron.d/dsa-buildd: only look for .upload files
authorAurelien Jarno <aurelien@aurel32.net>
Sat, 2 Jan 2016 15:37:08 +0000 (16:37 +0100)
committerAurelien Jarno <aurelien@aurel32.net>
Sat, 2 Jan 2016 15:37:08 +0000 (16:37 +0100)
Only look for .upload files, and use their contents to determine which
files to delete. This avoid triggering reuploads when the package has
been built before midnight, but uploaded after midnight.

Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
modules/buildd/files/cron.d-dsa-buildd

index d165fdb..e44b9e3 100644 (file)
@@ -8,5 +8,4 @@
 @reboot buildd2 [ -f ~buildd2/NO-DAEMON-PLEASE ] && grep 'delete-on-boot' ~buildd2/NO-DAEMON-PLEASE > /dev/null && rm -f ~buildd2/NO-DAEMON-PLEASE && if [ -x ~buildd2/.bootscript ]; then ~buildd2/.bootscript; else buildd-watcher; fi
 
 # Clean old files in the upload queues after 60 days
-@daily buildd [ -d ~buildd/upload ] && find ~buildd/upload -type f -mtime +60 -delete
-@daily buildd [ -d ~buildd/upload-security ] && find ~buildd/upload-security -type f -mtime +60 -delete
+@daily buildd find ~buildd/upload/ ~buildd/upload-security/ -type f -mtime +60 -name '*.upload' | xargs -r awk 'BEGINFILE { DIRNAME=FILENAME ; sub("/[^/]*$", "", DIRNAME) } /^u/ { print DIRNAME"/"$2 } ENDFILE { print FILENAME }' | xargs -r rm -f