From 45022b6b47c3046ea3e2d4033197fdd80dc63850 Mon Sep 17 00:00:00 2001 From: Alan O'Cais Date: Fri, 8 Mar 2024 17:30:55 +0100 Subject: [PATCH] Allow for open PRs when checking missing installations in build script --- EESSI-install-software.sh | 2 +- check_missing_installations.sh | 20 +++++++++++++++++--- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/EESSI-install-software.sh b/EESSI-install-software.sh index 69de9d1997..75b4f71178 100755 --- a/EESSI-install-software.sh +++ b/EESSI-install-software.sh @@ -237,7 +237,7 @@ else copy_build_log "${eb_last_log}" "${build_logs_dir}" fi - $TOPDIR/check_missing_installations.sh ${TOPDIR}/${easystack_file} + $TOPDIR/check_missing_installations.sh ${TOPDIR}/${easystack_file} ${TOPDIR}/${pr_diff} else fatal_error "Easystack file ${easystack_file} not found!" fi diff --git a/check_missing_installations.sh b/check_missing_installations.sh index c902fa8184..623c46c74f 100755 --- a/check_missing_installations.sh +++ b/check_missing_installations.sh @@ -10,8 +10,15 @@ TOPDIR=$(dirname $(realpath $0)) -if [ $# -ne 1 ]; then - echo "ERROR: Usage: $0 " >&2 +if [ "$#" -eq 1 ]; then + true +elif [ "$#" -eq 2 ]; then + echo "Using $2 to give create exceptions for PR filtering of easystack" + # Find lines that are added and use from-pr, make them unique, grab the + # PR numbers and use them to construct something we can use within awk + pr_exceptions=$(grep ^+ $2 | grep from-pr | uniq | awk '{print $3}' | xargs -i echo " || /'{}'/") +else + echo "ERROR: Usage: $0 ()" >&2 exit 1 fi easystack=$1 @@ -24,7 +31,10 @@ export EASYBUILD_ROBOT_PATHS=$LOCAL_TMPDIR/easyconfigs/easybuild/easyconfigs # All PRs used in EESSI are supposed to be merged, so we can strip out all cases of from-pr tmp_easystack=${LOCAL_TMPDIR}/$(basename ${easystack}) -grep -v from-pr ${easystack} > ${tmp_easystack} +# Let's use awk so we can allow for exceptions if we are given a PR diff file +awk_command="awk '\!/'from-pr'/ EXCEPTIONS' $easystack" +awk_command=${awk_command/\\/} # Strip out the backslash we needed for ! +eval ${awk_command/EXCEPTIONS/$pr_exceptions} > ${tmp_easystack} source $TOPDIR/scripts/utils.sh @@ -40,6 +50,10 @@ exit_code=${PIPESTATUS[0]} ok_msg="Command 'eb --missing ...' succeeded, analysing output..." fail_msg="Command 'eb --missing ...' failed, check log '${eb_missing_out}'" +if [ "$#" -eq 1 ]; then + fail_msg="$fail_msg (are you sure all PRs referenced have been merged in EasyBuild?)" +fi + check_exit_code ${exit_code} "${ok_msg}" "${fail_msg}" # the above assesses the installed software for each easyconfig provided in