Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/cleanup
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2023-02-03 23:57:47 +0100
committerErich Eckner <git@eckner.net>2023-02-03 23:57:47 +0100
commit6828b5cff3f20875d51871ef91ffe0508fd5354e (patch)
tree3aa5151d24411653372aae1caae512662f0e68f2 /bin/cleanup
parent623c16779af136bfcd99305d9b558c94b3641d89 (diff)
bin/cleanup: lock the database - this should not run in parallel to db-update
Diffstat (limited to 'bin/cleanup')
-rwxr-xr-xbin/cleanup11
1 files changed, 11 insertions, 0 deletions
diff --git a/bin/cleanup b/bin/cleanup
index 57c4e07..14d08ac 100755
--- a/bin/cleanup
+++ b/bin/cleanup
@@ -19,6 +19,14 @@ if [ -s "${work_dir}/build-master-sanity" ]; then
exit
fi
+# Lock the database - we should not run in parallel with db-update.
+exec 9> "${package_database_lock_file}"
+# shellcheck disable=SC2086
+if ! verbose_flock -n 9; then
+ >&2 echo 'come back (shortly) later - I cannot lock package database.'
+ exit 0
+fi
+
# only keep newest logs per failed package and fail_reason
# shellcheck disable=SC2016
@@ -68,6 +76,9 @@ fi
rm "${build_log_directory}/error/${file}"
done
+# Release database lock.
+flock -u 9 || true
+
# only keep namcap logs of last 2 weeks for succeeded packages
find "${build_log_directory}/success" -maxdepth 1 -type f -mtime +14 \
-not -exec zgrep -q '^+.*ELF file .* has text relocations' '{}' \; \