summaryrefslogtreecommitdiff
path: root/bin/return-assignment
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-06-20 09:13:49 +0200
committerErich Eckner <git@eckner.net>2017-06-20 09:13:49 +0200
commitb8f9e2c10e7b475e61cd00f3042f5446117cdae6 (patch)
tree798d892999bd7298fcaf321a5c191a28cb1b5eb0 /bin/return-assignment
parent05e3561b3df4078a33865913d8135dbfe4ad5809 (diff)
downloadbuilder-b8f9e2c10e7b475e61cd00f3042f5446117cdae6.tar.xz
bin/return-assignment: only lock database if package build was sucessful
Diffstat (limited to 'bin/return-assignment')
-rwxr-xr-xbin/return-assignment19
1 files changed, 13 insertions, 6 deletions
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.'