From 9ede9a11566506384d5ce13736a9153313a14535 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 9 Mar 2018 16:09:53 +0100 Subject: bin/get-package-updates: do not remove to-be-decided packages (of other running instance!) if we cannot acquire a lock --- bin/get-package-updates | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) (limited to 'bin/get-package-updates') diff --git a/bin/get-package-updates b/bin/get-package-updates index ffcb078..5285646 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -16,9 +16,6 @@ # TODO: keep database clean in case of abort -# TODO: It seems, updating present build assignments in the database is broken -# ... they seem to get deleted - # shellcheck disable=SC2016 usage() { >&2 echo '' @@ -136,22 +133,6 @@ delete_package() { fi } -# create tmp_dir and trap -clean_up() { - rm -rf --one-file-system "${tmp_dir}" - # shellcheck disable=SC2016 - { - printf 'DELETE FROM `binary_packages`' - printf ' WHERE `binary_packages`.`repository`=(' - printf 'SELECT `repositories`.`id` FROM `repositories`' - printf ' WHERE `repositories`.`name`="to-be-decided"' - printf ');\n' - } | \ - mysql_run_query -} -tmp_dir=$(mktemp -d 'tmp.get-package-updates.XXXXXXXXXX' --tmpdir) -trap 'clean_up' EXIT - # Update git repositories (official packages, community packages and the repository of package customizations). for repo in ${repo_names}; do @@ -202,6 +183,8 @@ if ! flock -s ${block_flag} 8; then exit fi +trap mysql_cleanup EXIT + # shellcheck disable=SC2119 mysql_cleanup -- cgit v1.2.3-70-g09d2