From ba7e75157e06dc5cb03683f8eb33a2a99c61b95e Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 24 Jan 2019 14:48:22 +0100 Subject: bin/cleanup: first remove database entries, then remove logfiles w/o database entries --- bin/cleanup | 46 +++++++++++++++++++++++----------------------- 1 file changed, 23 insertions(+), 23 deletions(-) (limited to 'bin/cleanup') diff --git a/bin/cleanup b/bin/cleanup index 64f0689..206b84c 100755 --- a/bin/cleanup +++ b/bin/cleanup @@ -19,29 +19,6 @@ if [ -s "${work_dir}/build-master-sanity" ]; then exit fi -# remove logs where package is not broken/locked anymore - -{ - find "${build_log_directory}/error" -maxdepth 1 -type f -printf 'file %f\n' - # shellcheck disable=SC2016 - { - printf 'SELECT "mysql",`failed_builds`.`log_file`' - printf ' FROM `failed_builds`;\n' - } | \ - mysql_run_query | \ - tr '\t' ' ' -} | \ - sort -k2,2 -k1,1 | \ - uniq -uf 1 | \ - sed -n ' - s/^file // - T - p - ' | \ - while read -r file; do - rm "${build_log_directory}/error/${file}" - done - # only keep 10 newest logs per failed package and fail_reason # shellcheck disable=SC2016 @@ -79,6 +56,29 @@ fi ' | \ mysql_run_query +# remove logs where package is not broken/locked anymore + +{ + find "${build_log_directory}/error" -maxdepth 1 -type f -printf 'file %f\n' + # shellcheck disable=SC2016 + { + printf 'SELECT "mysql",`failed_builds`.`log_file`' + printf ' FROM `failed_builds`;\n' + } | \ + mysql_run_query | \ + tr '\t' ' ' +} | \ + sort -k2,2 -k1,1 | \ + uniq -uf 1 | \ + sed -n ' + s/^file // + T + p + ' | \ + while read -r file; do + rm "${build_log_directory}/error/${file}" + done + # only keep namcap logs of last 2 weeks for succeeded packages find "${build_log_directory}/success" -maxdepth 1 -type f -mtime +14 \ -not -exec zgrep -q '^+.*ELF file .* has text relocations' '{}' \; \ -- cgit v1.2.3