summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-03-09 11:44:02 +0100
committerErich Eckner <git@eckner.net>2018-03-09 11:44:02 +0100
commit84b99c0e495185eb423e9d8bc9418670b6ff9376 (patch)
treed251acc36d8a5ae99d35a2294e4502f441c293af
parent28099f340b36fcde5a42a13328aea6a39de44460 (diff)
downloadbuilder-84b99c0e495185eb423e9d8bc9418670b6ff9376.tar.xz
bin/db-update: keep .testing, .tested, .done (mostly) in sync
-rwxr-xr-xbin/db-update25
1 files changed, 21 insertions, 4 deletions
diff --git a/bin/db-update b/bin/db-update
index f87000a..adec0ef 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -9,10 +9,6 @@
# TODO: separate locks for staging, testing (and stable)
-# TODO: sub_pkgrel=0 may or may not be omitted for the actual package :-/
-
-# TODO: keep .testing, .tested, .done in sync
-
# shellcheck disable=SC2039
# shellcheck source=conf/default.conf
. "${0%/*}/../conf/default.conf"
@@ -274,4 +270,25 @@ for source_stability in 'testing' 'staging'; do
printf ' SET `binary_packages`.`repository`=`moved_binary_packages`.`new_repository`;\n'
} | \
mysql_run_query
+
+ # TODO: this may delete too much, but these files will be obsolete soon anyway ...
+ find "${work_dir}/package-states/" \
+ \( \
+ -name '*.done' -o \
+ -name '*.testing' -o \
+ -name '*.tested' \
+ \) \
+ -exec grep -qxF "$(cut -d' ' -f1 < "${tmp_dir}/rm")" '{}' \; \
+ -delete
+ find "${work_dir}/package-states/" \
+ -name '*.tested' \
+ -exec grep -qxF "$(cut -d' ' -f1 < "${tmp_dir}/mv")" '{}' \; \
+ -delete
+ find "${work_dir}/package-states/" \
+ -name '*.done' \
+ -exec grep -qxF "$(cut -d' ' -f1 < "${tmp_dir}/mv")" '{}' \; \
+ -prinft '%p\n' | \
+ while read -r sf; do
+ mv "${sf}" "${sf%.done}.testing"
+ done
done