From cd2540e6a7bcae913be1034d93c7dd2b9a9a704a Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 17 May 2017 14:51:38 +0200 Subject: use a single lock file for the build list --- bin/get-assignment | 6 +++--- bin/get-package-updates | 9 ++++++--- bin/return-assignment | 8 +++++--- conf/default.conf | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/bin/get-assignment b/bin/get-assignment index db9e2f4..091c634 100755 --- a/bin/get-assignment +++ b/bin/get-assignment @@ -45,14 +45,14 @@ hand_out_assignment() { # Create a lock file and a trap. -exec 9> "${lock_file}" +exec 9> "${build_list_lock_file}" if ! flock -n 9; then - >&2 echo 'come back (shortly) later - I was running already' + >&2 echo 'come back (shortly) later - I cannot lock build list.' exit 1 fi function clean_up { - rm -f "${lock_file}" + rm -f "${build_list_lock_file}" } trap clean_up EXIT diff --git a/bin/get-package-updates b/bin/get-package-updates index 2e666ac..80e9527 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -13,8 +13,11 @@ # Create a lock file for build list. -exec 9> "${lock_file}" -flock -n 9 || exit +exec 9> "${build_list_lock_file}" +if ! flock -n 9; then + >&2 echo 'come back (shortly) later - I cannot lock build list.' + exit +fi # Update git repositories (official packages, community packages and the repository of package customizations). @@ -244,4 +247,4 @@ fi # Remove the lock file -rm -f "${lock_file}" +rm -f "${build_list_lock_file}" diff --git a/bin/return-assignment b/bin/return-assignment index b8d1bb4..951eb8c 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -22,14 +22,16 @@ # Create a lock file and a trap. -exec 9> "${lock_file}" +exec 9> "${build_list_lock_file}" if ! flock -n 9; then - >&2 echo 'come back (shortly) later - I was running already' + >&2 echo 'come back (shortly) later - I cannot lock build list.' + exit +fi exit 1 fi function clean_up { - rm -f "${lock_file}" + rm -f "${build_list_lock_file}" } trap clean_up EXIT diff --git a/conf/default.conf b/conf/default.conf index dfc9905..8dac45a 100755 --- a/conf/default.conf +++ b/conf/default.conf @@ -20,7 +20,7 @@ repo_paths["packages"]="${work_dir}/repos/packages" repo_paths["community"]="${work_dir}/repos/community" repo_paths["archlinux32"]="${work_dir}/repos/packages32" -lock_file="/tmp/${0##*/}.lock" +build_list_lock_file="/tmp/build-list.lock" master_build_server="master.build.server" master_build_server_port="22" -- cgit v1.2.3