ENH: improve parsing robustness for foamInstallationTest (#3263)

This commit is contained in:
Mark Olesen 2024-12-16 12:37:07 +01:00
parent 8340317a46
commit 8a4e3526c3

View File

@ -7,7 +7,7 @@
# \\/ M anipulation | # \\/ M anipulation |
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Copyright (C) 2011-2015 OpenFOAM Foundation # Copyright (C) 2011-2015 OpenFOAM Foundation
# Copyright (C) 2019-2021 OpenCFD Ltd. # Copyright (C) 2019-2024 OpenCFD Ltd.
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# License # License
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later. # This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
@ -22,8 +22,8 @@
#------------------------------------------------------------------------------ #------------------------------------------------------------------------------
# Base settings # Base settings
MIN_VERSION_GCC=4.8.5 MIN_VERSION_GCC=7.5.0
MIN_VERSION_LLVM=3.7.1 MIN_VERSION_LLVM=7.0.1
# General # General
WIDTH=20 WIDTH=20
@ -242,11 +242,11 @@ reportExecutable()
;; ;;
flex) flex)
VERSION=$(flex --version /dev/null 2>&1 \ VERSION=$(flex --version 2>/dev/null \
| sed -ne 's/flex \([0-9][0-9.]*\).*/\1/p') | sed -ne 's/flex \([0-9][0-9.]*\).*/\1/p')
;; ;;
make) make)
VERSION=$(make --version /dev/null 2>&1 \ VERSION=$(make --version 2>/dev/null \
| sed -ne 's/^.*[Mm]ake \([0-9][0-9.]*\).*/\1/p') | sed -ne 's/^.*[Mm]ake \([0-9][0-9.]*\).*/\1/p')
;; ;;
wmake) wmake)
@ -264,15 +264,30 @@ reportExecutable()
esac esac
echo "ERROR: $SHORT_NAME version is too old for this release of OpenFOAM" echo "ERROR: $SHORT_NAME version is too old for this release of OpenFOAM"
echo " User version : $VERSION" echo " User version : $VERSION"
echo " Minimum required: $MIN_VERSION_GCC" echo " Minimum required: $MIN_VERSION_LLVM"
echo echo
fatalError="x${fatalError}" fatalError="x${fatalError}"
fi fi
;; ;;
*gcc* | *g++*) *gcc* | *g++*)
# parse things like this
# --
# ...
# gcc version 7.5.0 (SUSE Linux)
# --
VERSION=$($APP_NAME -v 2>&1 \ VERSION=$($APP_NAME -v 2>&1 \
| sed -ne 's/^gcc version \([0-9][0-9.]*\).*/\1/p') | sed -ne 's/^gcc version \([0-9][0-9.]*\).*/\1/p')
# Fallback?
# parse things like this
# --
# gcc (SUSE Linux) 7.5.0
# g++ (SUSE Linux) 7.5.0
# --
[ -n "$VERSION" ] || \
VERSION=$($APP_NAME --version 2>/dev/null \
| sed -ne '1{s/^g.*) \([0-9][.0-9]*\).*/\1/p;}')
if ! vercmp_3 "$MIN_VERSION_GCC" "$VERSION" if ! vercmp_3 "$MIN_VERSION_GCC" "$VERSION"
then then
case "$APP_NAME" in case "$APP_NAME" in