index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2017-06-26 10:01:23 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2017-06-26 10:01:23 +0200 |
commit | d225f3c81759e3cd7f31ca66634aae5581ed2e94 (patch) | |
tree | 654a207c4c97bc1eb408c1074df7f75e7e7c4ad5 /bin/cleanup | |
parent | 31fb98113f42030828f800a0867948e92975d327 (diff) |
-rwxr-xr-x | bin/cleanup | 27 |
diff --git a/bin/cleanup b/bin/cleanup index e58fe9d..4d827ee 100755 --- a/bin/cleanup +++ b/bin/cleanup @@ -9,8 +9,10 @@ if ! "${base_dir}/bin/sanity-check" -r; then exit 1 fi +# remove logs where package is not broken/locked anymore + ( - ls '/srv/http/build-logs' | \ + ls "${build_log_directory}" | \ sed 's|\.[^.]\+\.build-log\.gz$||' | \ sort -u ls "${work_dir}/package-states" | \ @@ -23,5 +25,26 @@ fi sort | \ uniq -u | \ while read -r s t; do - rm -f "/srv/http/build-logs/${s}."* + rm -f "${build_log_directory}/${s}."* done + +# only keep 10 newest logs per package + +ls "${build_log_directory}" | \ + sed 's|^\(.*\)\(\.\([^.]\+\)\.build-log\.gz\)$|\1\2 \3 \1|' | \ + sort -k3,3 -k2r,2 | \ + uniq -f2 --group=prepend | \ + ( + count=0 + while read -r a b c; do + if [ -z "${a}" ]; then + count=0 + continue + fi + if [ ${count} -ge 10 ]; then + echo "${build_log_directory}/${a}" + fi + count=$[${count}+1] + done + ) | \ + xargs -rn1 rm |