From d83426ad72fe5a0b62539c81519e2224ea7264e4 Mon Sep 17 00:00:00 2001 From: obreshko <Emil.Obreshkov@cern.ch> Date: Fri, 19 May 2017 15:34:51 +0200 Subject: [PATCH] Extend the build log files produced. Picking the changes from !1377 and !1693 Former-commit-id: a094951727e84d2dbc4157d1f035f95ec27cf9ad --- Build/AtlasBuildScripts/build_Gaudi.sh | 60 +++++++++++++---- .../AtlasBuildScripts/build_atlasexternals.sh | 66 +++++++++++++++---- Projects/Athena/build_externals.sh | 6 +- 3 files changed, 106 insertions(+), 26 deletions(-) diff --git a/Build/AtlasBuildScripts/build_Gaudi.sh b/Build/AtlasBuildScripts/build_Gaudi.sh index b07758d86280..9b27a23fa632 100755 --- a/Build/AtlasBuildScripts/build_Gaudi.sh +++ b/Build/AtlasBuildScripts/build_Gaudi.sh @@ -3,8 +3,12 @@ # Script used for building Gaudi. # -# Don't stop on errors: +# Don't stop on errors but count them set +e +ERROR_COUNT=0 + +# consider a pipe failed if ANY of the commands fails +set -o pipefail # Function printing the usage information for the script usage() { @@ -75,30 +79,64 @@ if [ "$SOURCEDIR" = "" ] || [ "$BUILDDIR" = "" ] || [ "$INSTALLDIR" = "" ] \ fi # Create the build directory if it doesn't exist, and move to it: -mkdir -p ${BUILDDIR} -cd ${BUILDDIR} +mkdir -p ${BUILDDIR} || ((ERROR_COUNT++)) +cd ${BUILDDIR} || ((ERROR_COUNT++)) # Set up the externals project: -source ${EXTDIR}/setup.sh +source ${EXTDIR}/setup.sh || ((ERROR_COUNT++)) + +#FIXME: simplify error counting below while keeping '| tee ...' # Configure the build: +error_stamp=`mktemp .tmp.error.XXXXX` ; rm -f $error_stamp +{ cmake -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} -DCTEST_USE_LAUNCHERS:BOOL=TRUE \ -DGAUDI_ATLAS:BOOL=TRUE -DGAUDI_ATLAS_BASE_PROJECT:STRING=${EXTPROJECT} \ -DCMAKE_INSTALL_PREFIX:PATH=/InstallArea/${PLATFORM} \ - ${SOURCEDIR} 2>&1 | tee cmake_config.log + ${SOURCEDIR} || touch $error_stamp +} 2>&1 | tee cmake_config.log +test -f $error_stamp && ((ERROR_COUNT++)) +rm -f $error_stamp # Build it: -make -k +error_stamp=`mktemp .tmp.error.XXXXX` ; rm -f $error_stamp +{ +make -k || touch $error_stamp +} 2>&1 | tee cmake_build.log +test -f $error_stamp && ((ERROR_COUNT++)) +rm -f $error_stamp + # Install it: -make -k install/fast DESTDIR=${INSTALLDIR} +error_stamp=`mktemp .tmp.error.XXXXX` ; rm -f $error_stamp +{ +make -k install/fast DESTDIR=${INSTALLDIR} || touch $error_stamp +} 2>&1 | tee cmake_install.log +test -f $error_stamp && ((ERROR_COUNT++)) +rm -f $error_stamp # If no RPM directory was specified, stop here: if [ "$RPMDIR" = "" ]; then - exit 0 + exit ${ERROR_COUNT} fi # Build the RPM for the project: -cpack -mkdir -p ${RPMDIR} -cp GAUDI*.rpm ${RPMDIR} +error_stamp=`mktemp .tmp.error.XXXXX` ; rm -f $error_stamp +{ +cpack || touch $error_stamp +} 2>&1 | tee cmake_cpack.log +test -f $error_stamp && ((ERROR_COUNT++)) +rm -f $error_stamp + +error_stamp=`mktemp .tmp.error.XXXXX` ; rm -f $error_stamp +{ +mkdir -p ${RPMDIR} && cp GAUDI*.rpm ${RPMDIR} || touch $error_stamp +} 2>&1 | tee cp_rpm.log +test -f $error_stamp && ((ERROR_COUNT++)) +rm -f $error_stamp + +if [ $ERROR_COUNT -ne 0 ]; then + echo "Gaudi build script counted $ERROR_COUNT errors" +fi + +exit ${ERROR_COUNT} diff --git a/Build/AtlasBuildScripts/build_atlasexternals.sh b/Build/AtlasBuildScripts/build_atlasexternals.sh index 20f6dfbcfd4e..1b0256cdda62 100755 --- a/Build/AtlasBuildScripts/build_atlasexternals.sh +++ b/Build/AtlasBuildScripts/build_atlasexternals.sh @@ -4,8 +4,12 @@ # repository. # -# Don't stop on errors: +# Don't stop on errors but count them set +e +ERROR_COUNT=0 + +# consider a pipe failed if ANY of the commands fails +set -o pipefail # Function printing the usage information for the script usage() { @@ -65,8 +69,8 @@ if [ "$SOURCEDIR" = "" ] || [ "$BUILDDIR" = "" ] || [ "$INSTALLDIR" = "" ]; then fi # Create the build directory if it doesn't exist, and move to it: -mkdir -p ${BUILDDIR} -cd ${BUILDDIR} +mkdir -p ${BUILDDIR} || ((ERROR_COUNT++)) +cd ${BUILDDIR} || ((ERROR_COUNT++)) # Extra settings for providing a project version for the build if necessary: EXTRACONF= @@ -75,23 +79,61 @@ if [ "$PROJECTVERSION" != "" ]; then EXTRACONF=-D${PNAME}_PROJECT_VERSION:STRING=${PROJECTVERSION} fi +#FIXME: simplify error counting: + + # Configure the build: -cmake -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} -DCTEST_USE_LAUNCHERS:BOOL=TRUE \ +error_stamp=`mktemp .tmp.error.XXXXX` ; rm -f $error_stamp +{ + cmake -DCMAKE_BUILD_TYPE:STRING=${BUILDTYPE} -DCTEST_USE_LAUNCHERS:BOOL=TRUE \ ${EXTRACONF} \ - ${SOURCEDIR}/Projects/${PROJECT}/ 2>&1 | tee cmake_config.log + ${SOURCEDIR}/Projects/${PROJECT}/ || touch $error_stamp +} 2>&1 | tee cmake_config.log +test -f $error_stamp && ((ERROR_COUNT++)) +rm -f $error_stamp #FIXME: w/o $error_stamp one can't pass the status outside { ... } | tee ... shell # Build it: -make -k +error_stamp=`mktemp .tmp.error.XXXXX` ; rm -f $error_stamp +{ + make -k || touch $error_stamp +} 2>&1 | tee cmake_build.log +test -f $error_stamp && ((ERROR_COUNT++)) +rm -f $error_stamp # Install it: -make -k install/fast DESTDIR=${INSTALLDIR} +error_stamp=`mktemp .tmp.error.XXXXX` ; rm -f $error_stamp +{ + make -k install/fast DESTDIR=${INSTALLDIR} || touch $error_stamp +} 2>&1 | tee cmake_install.log +test -f $error_stamp && ((ERROR_COUNT++)) +rm -f $error_stamp + # If no RPM directory was specified, stop here: if [ "$RPMDIR" = "" ]; then - exit 0 + exit ${ERROR_COUNT} +fi + +# Build the RPM or other package for the project: +error_stamp=`mktemp .tmp.error.XXXXX` ; rm -f $error_stamp +{ +cpack || touch $error_stamp +} 2>&1 | tee cmake_cpack.log +test -f $error_stamp && ((ERROR_COUNT++)) +rm -f $error_stamp + +error_stamp=`mktemp .tmp.error.XXXXX` ; rm -f $error_stamp +{ + mkdir -p ${RPMDIR} && \ + FILES=`ls ${PROJECT}*.rpm ${PROJECT}*.tar.gz ${PROJECT}*.dmg 2>/dev/null ; true ;` && \ + test "X$FILES" != "X" && \ + cp ${FILES} ${RPMDIR} || touch $error_stamp +} 2>&1 | tee cp_rpm.log +test -f $error_stamp && ((ERROR_COUNT++)) +rm -f $error_stamp + +if [ $ERROR_COUNT -ne 0 ]; then + echo "AtlasExternals build script counted $ERROR_COUNT errors" fi -# Build the RPM for the project: -cpack -mkdir -p ${RPMDIR} -cp ${PROJECT}*.rpm ${RPMDIR} +exit ${ERROR_COUNT} diff --git a/Projects/Athena/build_externals.sh b/Projects/Athena/build_externals.sh index 793e56e07f6d..46392165be7a 100755 --- a/Projects/Athena/build_externals.sh +++ b/Projects/Athena/build_externals.sh @@ -95,7 +95,7 @@ if [ "$FORCE" = "1" ]; then fi # Create some directories: -mkdir -p ${BUILDDIR}/install +mkdir -p ${BUILDDIR}/{src,install} # Set some environment variables that the builds use internally: export NICOS_PROJECT_VERSION=`cat ${thisdir}/version.txt` @@ -121,7 +121,7 @@ AthenaExternalsVersion=$(awk '/^AthenaExternalsVersion/{print $3}' ${thisdir}/ex # Check out AthenaExternals from the right branch/tag: ${scriptsdir}/checkout_atlasexternals.sh \ -t ${AthenaExternalsVersion} \ - -s ${BUILDDIR}/src/AthenaExternals + -s ${BUILDDIR}/src/AthenaExternals 2>&1 | tee ${BUILDDIR}/src/checkout.AthenaExternals.log # Build AthenaExternals: export NICOS_PROJECT_HOME=$(cd ${BUILDDIR}/install;pwd)/AthenaExternals @@ -142,7 +142,7 @@ GaudiVersion=$(awk '/^GaudiVersion/{print $3}' ${thisdir}/externals.txt) # Check out Gaudi from the right branch/tag: ${scriptsdir}/checkout_Gaudi.sh \ -t ${GaudiVersion} \ - -s ${BUILDDIR}/src/GAUDI + -s ${BUILDDIR}/src/GAUDI 2>&1 | tee ${BUILDDIR}/src/checkout.GAUDI.log # Build Gaudi: export NICOS_PROJECT_HOME=$(cd ${BUILDDIR}/install;pwd)/GAUDI -- GitLab