commit 6ef06575a43cb4269968b98dada6b645ec5c76bb parent a7fc7f651310d60ab5fbc770ecd9cade417eeeea Author: Vincent Forest <vincent.forest@meso-star.com> Date: Wed, 27 Aug 2025 15:30:16 +0200 Update hook priority management Ensure that all hooks with the same priority are prerequisites for hooks with the next priority, instead of making the next hook dependent on the previous one regardless of its priority. This way, hooks with the same priority can be executed independently of each other and therefore in parallel if multiple jobs are used to execute make. More importantly, the specific priority "xx" becomes unnecessary, as it always should have been if priorities had been managed correctly. Scripts with this priority simply become scripts with a priority of "00" and therefore still do not depend on the execution of other hooks. Diffstat:
8 files changed, 25 insertions(+), 11 deletions(-)
diff --git a/art/hooks/xx-sign-archives.sh b/art/hooks/00-sign-archives.sh diff --git a/htrdr/hooks/xx-sign-archives.sh b/htrdr/hooks/00-sign-archives.sh diff --git a/schiff/hooks/xx-sign-archives.sh b/schiff/hooks/00-sign-archives.sh diff --git a/scripts/hooks.sh b/scripts/hooks.sh @@ -60,8 +60,14 @@ printf '%s\n' "${hook}" | while read -r i; do # priority and therefore has no prerequisites. if [ "${section}" != "${prev_section}" ]; then dep="" + tgt_list="" + prev_priority="" fi + # Retrieve the hook priority + priority="$(basename "${i}")" + priority="${priority%%-*}" + # Define a name for the hook used as a prefix for Makefile targets in # order to automate its execution and the management of the file it # generates. To ensure that this name is unique, and thus avoid @@ -70,17 +76,26 @@ printf '%s\n' "${hook}" | while read -r i; do file="$(basename "${hook}")" prefix="${section}-${file%%.*}" - # The hook name begins with 'xx-', meaning that it does not depend on - # any other hook in the section. - if echo "${file}" | grep -qe '^xx-.*'; then - dep="" - fi - # Set the file in which the names of the files generated by the hook # are stored as resources for the website, i.e., the files that must # be deployed with the website. tgt="${i%%.*}.hook" + if [ "${priority}" = "${prev_priority}" ]; then + # The hook's priority is the same as the previous one. Add its + # target to the list of prerequisites for hooks with lower priority + tgt_list="${tgt_list} ${tgt}" + else + # The priority of the current hook is lower than those processed + # previously. Define as a prerequisite the execution of hooks whose + # priority precedes the priority of the current hook. + dep="${tgt_list}" + + # The execution of the current hook becomes a prerequisite for hooks + # with lower priority. + tgt_list="${tgt}" + fi + # Define the Makefile target that automate the hook executation. Its # pre-requisites are the hook script and the output of the # previous # hook in the section, i.e. with an higher priority. So that @@ -109,9 +124,8 @@ printf '%s\n' "${hook}" | while read -r i; do "${tgt}" printf 'install__: %s-install\n' "${prefix}" - # Ensure that the target of the hook is a prerequisite for the next - # hook in the section, so that the execution order follows their - # priority as defined by their file name. - dep="${tgt}" + # Save the current section and priority of the hook that has just been + # processed prev_section="${section}" + prev_priority="${priority}" done diff --git a/scripts/list.sh b/scripts/list.sh @@ -67,7 +67,7 @@ hook() | sed 's/ -o $//')" eval "find ${search_dirs} \ - \( \( ${_find_args} \) -type f -name \"*.sh\" \) \ + \( \( ${_find_args} \) -type f -name \"[0-9][0-9]-*.sh\" \) \ | sort" } diff --git a/solstice/hooks/xx-setup-redirections.sh b/solstice/hooks/00-setup-redirections.sh diff --git a/solstice/hooks/xx-sign-archives.sh b/solstice/hooks/00-sign-archives.sh diff --git a/stardis/hooks/xx-sign-archives.sh b/stardis/hooks/00-sign-archives.sh