From 40fca9bb88c0604dbc1b4588d26a5c744f92953d Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 12 Jul 2017 09:28:45 +0200 Subject: bin/common-functions: do not delete metadata of packages on the deletion list --- bin/common-functions | 41 +++++++++++++++++++++++++---------------- 1 file changed, 25 insertions(+), 16 deletions(-) (limited to 'bin/common-functions') diff --git a/bin/common-functions b/bin/common-functions index 39690ee..3c1bd1a 100755 --- a/bin/common-functions +++ b/bin/common-functions @@ -194,23 +194,32 @@ generate_package_metadata() { delete_old_metadata() { ( - ls -1 "${work_dir}/package-infos" | \ - sed ' - s|\.\([^.]\+\)\.\([^.]\+\)\.[^.]\+$| \1 \2| - ' | \ - sort -u - ls -1 "${work_dir}/package-states" | \ - sed ' - s|\.\([^.]\+\)\.\([^.]\+\)\(\.[^.]\+\)\{2\}$| \1 \2| - ' | \ - sort -u | \ - sed 'p' - cut -d' ' -f1,2,3 "${work_dir}/build-list" | \ - sed 'p' + ( + ls -1 "${work_dir}/package-infos" | \ + sed ' + s|\.\([^.]\+\)\.\([^.]\+\)\.[^.]\+$| \1 \2| + ' | \ + sort -u + ls -1 "${work_dir}/package-states" | \ + sed ' + s|\.\([^.]\+\)\.\([^.]\+\)\(\.[^.]\+\)\{2\}$| \1 \2| + ' | \ + sort -u | \ + sed 'p' + cut -d' ' -f1,2,3 "${work_dir}/build-list" | \ + sed 'p' + ) | \ + sort | \ + uniq -u | \ + awk '{print $2 " " $3 " " $1}' + sed ' + s|^|whatever whatever | + p + ' "${work_dir}/deletion-list" ) | \ - sort | \ - uniq -u | \ - while read -r pkg rev mod_rev; do + sort -k3,3 | \ + uniq -uf2 | \ + while read -r rev mod_rev pkg; do rm -f "${work_dir}/package-infos/${pkg}.${rev}.${mod_rev}".* done } -- cgit v1.2.3-70-g09d2