mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: more robust extraction of API number from wmake rules
This commit is contained in:
@ -7,27 +7,12 @@
|
|||||||
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
# \\/ M anipulation | Copyright (C) 2016-2017 OpenCFD Ltd.
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM.
|
# This file is part of OpenFOAM, licensed under GNU General Public License
|
||||||
#
|
# <http://www.gnu.org/licenses/>.
|
||||||
# OpenFOAM is free software: you can redistribute it and/or modify it
|
|
||||||
# under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation, either version 3 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
||||||
# for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
#
|
||||||
# Script
|
# Script
|
||||||
# wmakePrintBuild
|
# wmakePrintBuild
|
||||||
#
|
#
|
||||||
# Usage
|
|
||||||
# wmakePrintBuild [OPTION]
|
|
||||||
#
|
|
||||||
# Description
|
# Description
|
||||||
# Print the version used when building the project
|
# Print the version used when building the project
|
||||||
#
|
#
|
||||||
@ -48,7 +33,7 @@ options:
|
|||||||
-pkg TAG specify packager/release tag ('none' marks an empty packager)
|
-pkg TAG specify packager/release tag ('none' marks an empty packager)
|
||||||
-short report short version information (ie, without pkg tag)
|
-short report short version information (ie, without pkg tag)
|
||||||
-version VER specify an alternative version
|
-version VER specify an alternative version
|
||||||
-plus report wmake value of OPENFOAM_PLUS and exit
|
-api report wmake value of OPENFOAM/OPENFOAM_API/OPENFOAM_PLUS
|
||||||
-help
|
-help
|
||||||
|
|
||||||
Print the version used when building the project, in this order of precedence:
|
Print the version used when building the project, in this order of precedence:
|
||||||
@ -76,7 +61,7 @@ die()
|
|||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Parse arguments and options
|
# Parse arguments and options
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
unset checkOnly update package version optPlus optShort
|
unset checkOnly update package version optApi optShort
|
||||||
|
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
@ -108,8 +93,8 @@ do
|
|||||||
version="$2"
|
version="$2"
|
||||||
shift
|
shift
|
||||||
;;
|
;;
|
||||||
-plus)
|
-api | -plus)
|
||||||
optPlus=true
|
optApi=true
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
@ -156,11 +141,13 @@ printTag()
|
|||||||
# Get the version
|
# Get the version
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
if [ "$optPlus" = true ]
|
if [ -n "$optApi" ]
|
||||||
then
|
then
|
||||||
# Retrieve OPENFOAM_PLUS=<digits> from $WM_DIR/rules/General/general
|
# Extract API version from $WM_DIR/rules/General/general
|
||||||
|
# Any of OPENFOAM=<digits>, OPENFOAM_API=<digits>, OPENFOAM_COM=<digits>
|
||||||
|
# OPENFOAM_PLUS=<digits>
|
||||||
version=$(
|
version=$(
|
||||||
sed -ne 's@^.*OPENFOAM_PLUS=\([0-9][0-9]*\).*@\1@p' \
|
sed -ne 's@^.*OPENFOAM\(_API|_COM|_PLUS\)*=\([0-9][0-9]*\).*@\2@p' \
|
||||||
$WM_DIR/rules/General/general 2>/dev/null
|
$WM_DIR/rules/General/general 2>/dev/null
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -169,7 +156,7 @@ then
|
|||||||
echo "$version"
|
echo "$version"
|
||||||
exit 0
|
exit 0
|
||||||
else
|
else
|
||||||
echo "no wmake definition for OPENFOAM_PLUS" 1>&2
|
echo "no wmake definition for OPENFOAM API" 1>&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
elif [ -n "$version" ]
|
elif [ -n "$version" ]
|
||||||
@ -200,7 +187,7 @@ fi
|
|||||||
# Retrieve old values (oldPackage oldVersion)
|
# Retrieve old values (oldPackage oldVersion)
|
||||||
getOldValues
|
getOldValues
|
||||||
|
|
||||||
if [ "$optShort" = true ]
|
if [ -n "$optShort" ]
|
||||||
then
|
then
|
||||||
unset package oldPackage
|
unset package oldPackage
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user