Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-10-23 15:47:11 +0200
committerErich Eckner <git@eckner.net>2017-10-23 15:47:11 +0200
commitfe98d2b1b7cb10e80ece9a280e0af9116e3ffae8 (patch)
tree61b8bf602e6c689b734997ca348c69e8fc0a8640
parentd1049641a7493e425f190083276731963b422ccd (diff)
bin/cleanup: remove successful-logs separately and only after 14 days
-rwxr-xr-xbin/cleanup44
1 files changed, 21 insertions, 23 deletions
diff --git a/bin/cleanup b/bin/cleanup
index 2350702..60e4ca6 100755
--- a/bin/cleanup
+++ b/bin/cleanup
@@ -56,31 +56,29 @@ fi
rm -f "${build_log_directory}/error/${s}."*
done
-# only keep 10 newest logs per package
+# only keep 10 newest logs per failed package
-for sub_dir in 'error' 'success'; do
-
- find "${build_log_directory}/${sub_dir}" -maxdepth 1 -type f -printf '%f\n' | \
- sed 's|^\(.*\)\(\.\([^.]\+\)\.build-log\.gz\)$|\1\2 \3 \1|' | \
- sort -k3,3 -k2r,2 | \
- uniq -f2 --group=prepend | \
- cut -d' ' -f1 | \
- (
- count=0
- while read -r a; do
- if [ -z "${a}" ]; then
- count=0
- continue
- fi
- if [ ${count} -ge 10 ]; then
- echo "${build_log_directory}/${sub_dir}/${a}"
- fi
- count=$((count+1))
- done
- ) | \
- xargs -rn1 rm
+find "${build_log_directory}/error" -maxdepth 1 -type f -printf '%f\n' | \
+ sed 's|^\(.*\)\(\.\([^.]\+\)\.build-log\.gz\)$|\1\2 \3 \1|' | \
+ sort -k3,3 -k2r,2 | \
+ uniq -f2 --group=prepend | \
+ cut -d' ' -f1 | \
+ (
+ count=0
+ while read -r a; do
+ if [ -z "${a}" ]; then
+ count=0
+ continue
+ fi
+ if [ ${count} -ge 10 ]; then
+ rm "${build_log_directory}/error/${a}"
+ fi
+ count=$((count+1))
+ done
+ )
-done
+# only keep namcap logs of last 2 weeks for succeeded packages
+find "${build_log_directory}/success" -maxdepth 1 -type f -mtime +14 -delete
# remove old package meta data
delete_old_metadata