summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-07-12 09:28:45 +0200
committerErich Eckner <git@eckner.net>2017-07-12 09:28:45 +0200
commit40fca9bb88c0604dbc1b4588d26a5c744f92953d (patch)
tree3908e864029bcb485338b10f01dcb31ded4e80d0 /bin
parent1281bf3492e7be6adfda3d345edd3afdb29c7681 (diff)
downloadbuilder-40fca9bb88c0604dbc1b4588d26a5c744f92953d.tar.xz
bin/common-functions: do not delete metadata of packages on the deletion list
Diffstat (limited to 'bin')
-rwxr-xr-xbin/common-functions41
1 files changed, 25 insertions, 16 deletions
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
}