From a9d2ea413bc0b4ccbebd2da7a48a8c0dbaf2e676 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 30 Jan 2020 11:18:03 +0100 Subject: check intentions_left() whenever we get a package_database_lock --- bin/bootstrap-mysql | 4 ++++ bin/copy-to-build-support | 12 ++++++++++++ bin/create-build-support-package | 5 +++++ bin/db-update | 5 +++++ bin/delete-packages | 5 +++++ bin/modify-package-state | 5 +++++ bin/return-assignment | 5 +++++ 7 files changed, 41 insertions(+) (limited to 'bin') diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql index a1c23be..cf055f7 100755 --- a/bin/bootstrap-mysql +++ b/bin/bootstrap-mysql @@ -20,6 +20,10 @@ if ! verbose_flock -s -n 7; then >&2 echo 'Cannot get package-database lock.' exit 1 fi +if intentions_left; then + >&2 echo 'There are still intentions in the queue.' + exit 1 +fi #shellcheck disable=SC2016 { diff --git a/bin/copy-to-build-support b/bin/copy-to-build-support index 351a005..bb7e421 100755 --- a/bin/copy-to-build-support +++ b/bin/copy-to-build-support @@ -77,6 +77,18 @@ verbose_flock -s ${wait_for_lock} 9 exec 8> "${package_database_lock_file}" verbose_flock ${wait_for_lock} 8 +if [ -z "${wait_for_lock}" ]; then + while intentions_left; do + >&2 echo 'There are still intentions in the queue.' + sleep 1 + done +else + if intentions_left; then + >&2 echo 'come back (shortly) later - There are still intentions in the queue.' + exit 1 + fi +fi + tmp_dir=$(mktemp -d "${work_dir}/tmp.copy-to-build-support.0.XXXXXXXXXX") trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT diff --git a/bin/create-build-support-package b/bin/create-build-support-package index a133e86..dd8ddc3 100755 --- a/bin/create-build-support-package +++ b/bin/create-build-support-package @@ -256,6 +256,11 @@ elif [ -n "${shim_package}" ]; then exec 8> "${package_database_lock_file}" verbose_flock ${wait_for_lock} 8 + while intentions_left; do + >&2 echo 'There are still intentions in the queue.' + sleep 1 + done + original_pkg_id=$( # shellcheck disable=SC2016 { diff --git a/bin/db-update b/bin/db-update index 51114f0..26d2d36 100755 --- a/bin/db-update +++ b/bin/db-update @@ -175,6 +175,11 @@ if ! ${no_action}; then exit 0 fi + if intentions_left; then + >&2 echo 'come back (shortly) later - There are still intentions in the queue.' + exit 0 + fi + exec 8> "${sanity_check_lock_file}" if ! verbose_flock -s ${block_flag} 8; then >&2 echo 'come back (shortly) later - sanity-check currently running.' diff --git a/bin/delete-packages b/bin/delete-packages index 1a74bf5..2377f75 100755 --- a/bin/delete-packages +++ b/bin/delete-packages @@ -129,6 +129,11 @@ if ! ${no_action}; then exit 0 fi + if intentions_left; then + >&2 echo 'come back (shortly) later - There are still intentions in the queue.' + exit 0 + fi + exec 7> "${sanity_check_lock_file}" if ! verbose_flock -s ${block_flag} 7; then >&2 echo 'come back (shortly) later - sanity-check running.' diff --git a/bin/modify-package-state b/bin/modify-package-state index eb1558b..9373467 100755 --- a/bin/modify-package-state +++ b/bin/modify-package-state @@ -145,6 +145,11 @@ if ! verbose_flock ${wait_for_lock} 8; then exit fi +if intentions_left; then + >&2 echo 'There are still intentions in the queue.' + exit +fi + while read -r a b; do case "${action}" in 'faulty'|'tested') diff --git a/bin/return-assignment b/bin/return-assignment index ec1673a..6517be2 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -546,6 +546,11 @@ if ! verbose_flock -w 20 7; then exit 1 fi +if intentions_left; then + >&2 echo 'come back (shortly) later - There are still intentions in the queue.' + exit 1 +fi + # shellcheck disable=SC2016 build_assignment_id=$( { -- cgit v1.2.3-70-g09d2