diff options
-rwxr-xr-x | bin/cleanup | 46 | ||||
-rwxr-xr-x | bin/return-assignment | 4 |
2 files changed, 27 insertions, 23 deletions
diff --git a/bin/cleanup b/bin/cleanup index c8de490..2350702 100755 --- a/bin/cleanup +++ b/bin/cleanup @@ -40,7 +40,7 @@ fi # remove logs where package is not broken/locked anymore ( - find "${build_log_directory}" -maxdepth 1 -printf '%f\n' | \ + find "${build_log_directory}/error" -maxdepth 1 -type f -printf '%f\n' | \ sed 's|\.[^.]\+\.build-log\.gz$||' | \ sort -u find "${work_dir}/package-states" -maxdepth 1 \( -name '*.broken' -o -name '*.locked' \) -printf '%f\n' | \ @@ -53,30 +53,34 @@ fi uniq -u | \ cut -d' ' -f1 | \ while read -r s; do - rm -f "${build_log_directory}/${s}."* + rm -f "${build_log_directory}/error/${s}."* done # only keep 10 newest logs per package -find "${build_log_directory}" -maxdepth 1 -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}/${a}" - fi - count=$((count+1)) - done - ) | \ - xargs -rn1 rm +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 + +done # remove old package meta data delete_old_metadata diff --git a/bin/return-assignment b/bin/return-assignment index e1aec3a..e6ca07d 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -48,7 +48,7 @@ if [ "$5" = 'ERROR' ]; then # save sent build logs tar -x \ - -C "${build_log_directory}" \ + -C "${build_log_directory}/error" \ --wildcards \ --no-wildcards-match-slash \ --transform="s|^|$1.$2.$3.$4.|" \ @@ -182,7 +182,7 @@ if [ -n "${package_errors}" ]; then fi # move build-logs -find . -maxdepth 1 -name '*.build-log.gz' -exec mv '{}' "${build_log_directory}/$1.$2.$3.$4.{}" \; +find . -maxdepth 1 -name '*.build-log.gz' -exec mv '{}' "${build_log_directory}/success/$1.$2.$3.$4.{}" \; # move packages destination=$(official_or_community "$1.$2.$3.$4" 'staging') |