summaryrefslogtreecommitdiff
path: root/bin/return-assignment
diff options
context:
space:
mode:
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.'