Commit 45fe65f8 authored by Mark Olesen's avatar Mark Olesen
Browse files

CONFIG: backport of META-INFO information (#1367)

parent cdce0585
# Do not track build information
build-info
# Do not track time-stamp
time-stamp
# Do not track any manifest files
Manifest.txt
manifest.txt
# META-INFO
Meta-information is for OpenFOAM internal use only.
(Backport from 1812)
api=1706
patch=180618
......@@ -3,9 +3,11 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
# \\/ M anipulation | Copyright (C) 2017-2018 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2008-2011, 2017-2018 OpenCFD Ltd.
# \\/ M anipulation |
#-------------------------------------------------------------------------------
# | Copyright (C) 2011-2016 OpenFOAM Foundation
#------------------------------------------------------------------------------
# License
# This file is part of OpenFOAM, licensed under GNU General Public License
# <http://www.gnu.org/licenses/>.
......@@ -63,6 +65,8 @@ options:
-config Add config directory prefix for shell type:
with -csh* for a config.csh/ prefix
with -sh* for a config.sh/ prefix
-show-api Print api value from wmake/rules, or meta-info and exit
-show-patch Print patch value from meta-info and exit
-quiet (-q) Suppress all normal output
-silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output
-help Print the usage
......@@ -184,6 +188,62 @@ setVersion()
}
#-------------------------------------------------------------------------------
# The API locations. See wmake/wmakeBuildInfo
rulesFile="$projectDir/wmake/rules/General/general"
metaInfoDir="$projectDir/META-INFO"
# Get api from rules/General/general
#
# Failure modes:
# - No api information (can't find file etc).
# -> Fatal for building, but could be OK for a stripped down version
#
# Fallback. Get from api-info
#
getApi()
{
local value
value="$(sed -ne '/^ *#/!{ /WM_VERSION.*OPENFOAM=/{ s@^.*OPENFOAM= *\([0-9][0-9]*\).*@\1@p; q }}' $rulesFile 2>/dev/null)"
if [ -z "$value" ] && [ -f "$metaInfoDir/api-info" ]
then
# Fallback. Get from api-info
value="$(sed -ne 's@^ *api *= *\([0-9][0-9]*\).*@\1@p' $metaInfoDir/api-info 2>/dev/null)"
fi
if [ -n "$value" ]
then
echo "$value"
else
return 1
fi
}
# Get patch from meta-info / api-info
#
# Failure modes:
# - No patch information (can't find file etc).
#
getPatchLevel()
{
local value
# Fallback. Get from api-info
value="$(sed -ne 's@^ *patch *= *\([0-9][0-9]*\).*@\1@p' $metaInfoDir/api-info 2>/dev/null)"
if [ -n "$value" ]
then
echo "$value"
else
return 1
fi
}
#-------------------------------------------------------------------------------
optMode=ugo # Default mode is always 'ugo'
unset shellOutput verboseOutput
unset optAll optConfig optList optVersion
......@@ -195,6 +255,16 @@ do
-h | -help*)
printHelp
;;
-show-api)
# Show API and exit
getApi
exit $?
;;
-show-patch)
# Show patch level and exit
getPatchLevel
exit $?
;;
-a | -all)
optAll=true
unset shellOutput verboseOutput
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment