diff options
author | Erich Eckner <git@eckner.net> | 2019-01-24 14:48:22 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-01-24 14:48:22 +0100 |
commit | ba7e75157e06dc5cb03683f8eb33a2a99c61b95e (patch) | |
tree | 4c77991cddd82857f57578ec65b568b07c416a87 | |
parent | 73592becbd0b902dfc7b012b5d02dcba8f58d716 (diff) | |
download | builder-ba7e75157e06dc5cb03683f8eb33a2a99c61b95e.tar.xz |
bin/cleanup: first remove database entries, then remove logfiles w/o database entries
-rwxr-xr-x | bin/cleanup | 46 |
1 files changed, 23 insertions, 23 deletions
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' '{}' \; \ |