From b8f9e2c10e7b475e61cd00f3042f5446117cdae6 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 20 Jun 2017 09:13:49 +0200 Subject: bin/return-assignment: only lock database if package build was sucessful --- bin/return-assignment | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'bin') diff --git a/bin/return-assignment b/bin/return-assignment index 213d4f0..fb4c6b3 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -23,19 +23,13 @@ # Create a lock file and a trap. exec 9> "${build_list_lock_file}" -exec 8> "${package_database_lock_file}" if ! flock -n 9; then >&2 echo 'come back (shortly) later - I cannot lock build list.' exit 1 fi -if ! flock -n 8; then - >&2 echo 'come back (shortly) later - I cannot lock package database.' - exit 1 -fi clean_up_lock_file() { rm -f "${build_list_lock_file}" - rm -f "${package_database_lock_file}" } trap clean_up_lock_file EXIT @@ -90,6 +84,19 @@ fi # the build was successful on the build slave +# so we also need a lock on the package database + +exec 8> "${package_database_lock_file}" +if ! flock -n 8; then + >&2 echo 'come back (shortly) later - I cannot lock package database.' + exit 1 +fi + +clean_up_lock_file() { + rm -f "${build_list_lock_file}" + rm -f "${package_database_lock_file}" +} + if ! grep -qxF "$1 $2 $3 $4" "${work_dir}/build-list" || ! [ -f "${work_dir}/package-states/$1.$2.$3.$4.locked" ]; then >&2 echo 'Sorry, the sent package is outdated.' -- cgit v1.2.3-70-g09d2