diff options
author | Bryan Drewery <bryan@shatow.net> | 2020-06-04 20:46:29 +0300 |
---|---|---|
committer | Bryan Drewery <bryan@shatow.net> | 2021-09-03 01:43:02 +0300 |
commit | d9d5ae70dd2fe5d128f3c885ad96673d7be5e0dd (patch) | |
tree | 82a51befcbae352ee02cafc9476a3ee1f134da1a /src | |
parent | e5ec11d256b09dcbf78cc36183615dfc39134468 (diff) |
html building: Assert that the proper slocks are held
Diffstat (limited to 'src')
-rw-r--r-- | src/share/poudriere/include/html.sh | 6 | ||||
-rwxr-xr-x | src/share/poudriere/logclean.sh | 10 |
2 files changed, 14 insertions, 2 deletions
diff --git a/src/share/poudriere/include/html.sh b/src/share/poudriere/include/html.sh index c3927bf9..86974640 100644 --- a/src/share/poudriere/include/html.sh +++ b/src/share/poudriere/include/html.sh @@ -110,6 +110,9 @@ build_jail_json() { [ -n "${log_path_jail}" ] || \ err 1 "build_jail_json requires log_path_jail set" local empty + + lock_have "json_jail_${MASTERNAME}" || + err 1 "build_jail_json requires slock json_jail_${MASTERNAME}" for empty in ${log_path_jail}/*/.data.mini.json; do case "${empty}" in # Empty @@ -131,6 +134,9 @@ build_top_json() { [ -n "${log_path_top}" ] || \ err 1 "build_top_json requires log_path_top set" local empty + + lock_have "json_top" || + err 1 "build_top_json requires slock json_top" ( cd "${log_path_top}" for empty in */latest/.data.mini.json; do diff --git a/src/share/poudriere/logclean.sh b/src/share/poudriere/logclean.sh index 14ee8d2a..95bc2afa 100755 --- a/src/share/poudriere/logclean.sh +++ b/src/share/poudriere/logclean.sh @@ -325,12 +325,18 @@ if [ ${logs_deleted} -eq 1 ]; then [ -d "${MASTERNAME}" ] || continue msg_n "Rebuilding HTML JSON for: ${MASTERNAME}..." _log_path_jail log_path_jail - build_jail_json || : + if slock_acquire "json_jail_${MASTERNAME}" 60 2>/dev/null; then + build_jail_json || : + slock_release "json_jail_${MASTERNAME}" + fi echo " done" done msg_n "Rebuilding HTML JSON for top-level..." log_path_top="${log_top}" - build_top_json || : + if slock_acquire "json_top" 60 2>/dev/null; then + build_top_json || : + slock_release "json_top" + fi echo " done" elif [ "${DRY_RUN}" -eq 1 ]; then msg "[Dry Run] Would fix latest symlinks..." |