summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-10-27 15:35:58 +0200
committerErich Eckner <git@eckner.net>2017-10-27 15:35:58 +0200
commit1c26d16709872f97dfce4615a31e472fa0afb3fb (patch)
treea71c15adfd6b11f7321d815a526cb00873509ffc
parent1dfef01eaa3913ae4281d40c1477a56143509f6b (diff)
downloadbuilder-1c26d16709872f97dfce4615a31e472fa0afb3fb.tar.xz
add shared lock for sanity-check
-rwxr-xr-xbin/db-update6
-rwxr-xr-xbin/delete-packages6
-rwxr-xr-xbin/get-assignment6
-rwxr-xr-xbin/get-package-updates6
-rwxr-xr-xbin/prioritize-build-list6
-rwxr-xr-xbin/return-assignment10
-rwxr-xr-xbin/sanity-check6
-rwxr-xr-xbin/seed-build-list4
-rwxr-xr-xbin/show-dependencies8
-rwxr-xr-xconf/default.conf4
10 files changed, 59 insertions, 3 deletions
diff --git a/bin/db-update b/bin/db-update
index 1b78800..420be78 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -416,6 +416,12 @@ if ! flock ${block_flag} 8; then
exit 1
fi
+exec 7> "${sanity_check_lock_file}"
+if ! flock -s ${block_flag} 7; then
+ >&2 echo 'come back (shortly) later - sanity-check currently running.'
+ exit 1
+fi
+
clean_up_lock_file() {
rm -f "${package_database_lock_file}" "${build_list_lock_file}"
rm -rf --one-file-system "${tmp_dir}"
diff --git a/bin/delete-packages b/bin/delete-packages
index f3c141b..9703804 100755
--- a/bin/delete-packages
+++ b/bin/delete-packages
@@ -86,6 +86,12 @@ if ! ${no_action}; then
exit 1
fi
+ exec 7> "${sanity_check_lock_file}"
+ if ! flock -s ${block_flag} 7; then
+ >&2 echo 'come back (shortly) later - sanity-check running.'
+ exit 1
+ fi
+
fi
clean_up_lock_file() {
diff --git a/bin/get-assignment b/bin/get-assignment
index b78ca9d..11aaf94 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -66,6 +66,12 @@ if ! flock -n 9; then
exit 1
fi
+exec 8> "${sanity_check_lock_file}"
+if ! flock -s -n 8; then
+ >&2 echo 'come back (shortly) later - sanity-check running.'
+ exit 1
+fi
+
clean_up() {
rm -f "${build_list_lock_file}"
rm -rf --one-file-system "${tmp_dir}"
diff --git a/bin/get-package-updates b/bin/get-package-updates
index c524080..83b0107 100755
--- a/bin/get-package-updates
+++ b/bin/get-package-updates
@@ -128,6 +128,12 @@ if ! flock ${block_flag} 9; then
exit
fi
+exec 8> "${sanity_check_lock_file}"
+if ! flock -s ${block_flag} 8; then
+ >&2 echo 'come back (shortly) later - sanity-check running.'
+ exit
+fi
+
echo 'Check modified packages from the last update, and put them to the build list.'
# Check modified packages from the last update, and put them to the build list.
diff --git a/bin/prioritize-build-list b/bin/prioritize-build-list
index 8e02590..793086e 100755
--- a/bin/prioritize-build-list
+++ b/bin/prioritize-build-list
@@ -17,6 +17,12 @@ if ! flock -n 9; then
exit 1
fi
+exec 8> "${sanity_check_lock_file}"
+if ! flock -s -n 8; then
+ >&2 echo 'come back (shortly) later - sanity-check running.'
+ exit 1
+fi
+
(
sed -n "/^$1/p" "${work_dir}/build-list"
sed "/^$1/d" "${work_dir}/build-list"
diff --git a/bin/return-assignment b/bin/return-assignment
index c99bc22..1a27b9f 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -32,6 +32,12 @@ if ! flock -n 9; then
exit 1
fi
+exec 8> "${sanity_check_lock_file}"
+if ! flock -s -n 8; then
+ >&2 echo 'come back (shortly) later - sanity-check running.'
+ exit 1
+fi
+
clean_up_lock_file() {
rm -f "${build_list_lock_file}"
}
@@ -106,8 +112,8 @@ fi
# so we also need a lock on the package database
-exec 8> "${package_database_lock_file}"
-if ! flock -n 8; then
+exec 7> "${package_database_lock_file}"
+if ! flock -n 7; then
>&2 echo 'come back (shortly) later - I cannot lock package database.'
exit 1
fi
diff --git a/bin/sanity-check b/bin/sanity-check
index a892e88..e51f64b 100755
--- a/bin/sanity-check
+++ b/bin/sanity-check
@@ -66,6 +66,12 @@ do
shift
done
+exec 9> "${sanity_check_lock_file}"
+if ! flock -n 9; then
+ >&2 echo 'Sanity check skipped, cannot acquire lock.'
+ exit 11
+fi
+
finish() {
if ${web}; then
{
diff --git a/bin/seed-build-list b/bin/seed-build-list
index 6b40064..6490015 100755
--- a/bin/seed-build-list
+++ b/bin/seed-build-list
@@ -225,8 +225,12 @@ cut -d' ' -f1,4 < \
# Create a lock file for build list.
if ${update}; then
+ # always block if locked
exec 9> "${build_list_lock_file}"
flock 9
+
+ exec 8> "${sanity_check_lock_file}"
+ flock -s 8
fi
{
diff --git a/bin/show-dependencies b/bin/show-dependencies
index 26f2eeb..575350c 100755
--- a/bin/show-dependencies
+++ b/bin/show-dependencies
@@ -107,7 +107,13 @@ fi
exec 9> "${work_dir}/${0##*/}.lock"
if ! flock -n 9; then
- echo 'Cannot get lock.'
+ >&2 echo 'Cannot get show-dependencies lock.'
+ exit
+fi
+
+exec 8> "${sanity_check_lock_file}"
+if ! flock -s -n 8; then
+ >&2 echo 'Cannot get sanity-check lock.'
exit
fi
diff --git a/conf/default.conf b/conf/default.conf
index c58849d..a31c41b 100755
--- a/conf/default.conf
+++ b/conf/default.conf
@@ -97,6 +97,10 @@ if [ -z "${build_list_lock_file}" ]; then
build_list_lock_file="${work_dir}/build-list.lock"
fi
+if [ -z "${sanity_check_lock_file}" ]; then
+ sanity_check_lock_file="${work_dir}/sanity-check.lock"
+fi
+
if [ -z "${package_database_lock_file}" ]; then
package_database_lock_file="${work_dir}/package-database.lock"
fi