mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
STYLE: limit foamEtcFile -show-api to querying the META-INFO/api-info
- simplifies code, covers most cases. Can use wmake -show-api or wmakeBuildInfo to query the make rules. STYLE: Allwmake script adjustments - use bin/foamEtcFile instead of relying on PATH. The make environment may not have the OpenFOAM bin/ in it. - simpler shell syntax
This commit is contained in:
25
Allwmake
25
Allwmake
@ -6,13 +6,14 @@ wmakeCheckPwd "$WM_PROJECT_DIR" 2>/dev/null || {
|
|||||||
echo " Check your OpenFOAM environment and installation"
|
echo " Check your OpenFOAM environment and installation"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
[ -d "$WM_PROJECT_DIR" -a -f "$WM_PROJECT_DIR/etc/bashrc" ] || {
|
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
|
||||||
|
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments || \
|
||||||
|
echo "Argument parse error";
|
||||||
|
else
|
||||||
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
||||||
echo " Check your OpenFOAM environment and installation"
|
echo " Check your OpenFOAM environment and installation"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
. "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Preamble. Report tools or at least the mpirun location
|
# Preamble. Report tools or at least the mpirun location
|
||||||
@ -45,11 +46,11 @@ echo
|
|||||||
"${WM_DIR:-wmake}"/src/Allmake
|
"${WM_DIR:-wmake}"/src/Allmake
|
||||||
|
|
||||||
# Compile ThirdParty libraries and applications
|
# Compile ThirdParty libraries and applications
|
||||||
if [ -d "$WM_THIRD_PARTY_DIR" ]
|
if [ -d "$WM_THIRD_PARTY_DIR" ] && [ -x "$WM_THIRD_PARTY_DIR/Allwmake" ]
|
||||||
then
|
then
|
||||||
"$WM_THIRD_PARTY_DIR/Allwmake"
|
"$WM_THIRD_PARTY_DIR"/Allwmake
|
||||||
else
|
else
|
||||||
echo "No ThirdParty directory found - skipping"
|
echo "No ThirdParty directory, or missing Allwmake - skipping"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "========================================"
|
echo "========================================"
|
||||||
@ -74,7 +75,7 @@ fi
|
|||||||
# Count files in given directory. Ignore "Test-*" binaries.
|
# Count files in given directory. Ignore "Test-*" binaries.
|
||||||
_foamCountDirEntries()
|
_foamCountDirEntries()
|
||||||
{
|
{
|
||||||
(cd "$1" 2>/dev/null && find -mindepth 1 -maxdepth 1 -type f 2>/dev/null) |\
|
(cd "$1" 2>/dev/null && find . -mindepth 1 -maxdepth 1 -type f 2>/dev/null) |\
|
||||||
sed -e '\@/Test-@d' | wc -l
|
sed -e '\@/Test-@d' | wc -l
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -86,10 +87,10 @@ echo " ${WM_PROJECT_DIR##*/}"
|
|||||||
echo " $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
|
echo " $WM_COMPILER ${WM_COMPILER_TYPE:-system} compiler"
|
||||||
echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
|
echo " ${WM_OPTIONS}, with ${WM_MPLIB} ${FOAM_MPI}"
|
||||||
echo
|
echo
|
||||||
echo " api = $(foamEtcFile -show-api 2>/dev/null)"
|
echo " api = $(bin/foamEtcFile -show-api 2>/dev/null)"
|
||||||
echo " patch = $(foamEtcFile -show-patch 2>/dev/null)"
|
echo " patch = $(bin/foamEtcFile -show-patch 2>/dev/null)"
|
||||||
echo " bin = $(_foamCountDirEntries $FOAM_APPBIN) entries"
|
echo " bin = $(_foamCountDirEntries "$FOAM_APPBIN") entries"
|
||||||
echo " lib = $(_foamCountDirEntries $FOAM_LIBBIN) entries"
|
echo " lib = $(_foamCountDirEntries "$FOAM_LIBBIN") entries"
|
||||||
echo
|
echo
|
||||||
echo "========================================"
|
echo "========================================"
|
||||||
|
|
||||||
|
|||||||
@ -6,13 +6,14 @@ wmakeCheckPwd "$WM_PROJECT_DIR/applications" 2>/dev/null || {
|
|||||||
echo " Check your OpenFOAM environment and installation"
|
echo " Check your OpenFOAM environment and installation"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
[ -d "$WM_PROJECT_DIR" -a -f "$WM_PROJECT_DIR/etc/bashrc" ] || {
|
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
|
||||||
|
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments || \
|
||||||
|
echo "Argument parse error";
|
||||||
|
else
|
||||||
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
||||||
echo " Check your OpenFOAM environment and installation"
|
echo " Check your OpenFOAM environment and installation"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
. "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -7,14 +7,13 @@
|
|||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
# Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||||
# Copyright (C) 2017-2018 OpenCFD Ltd.
|
# Copyright (C) 2017-2020 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
# <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
#
|
||||||
# Script
|
# Script
|
||||||
# foamEtcFile
|
# bin/foamEtcFile
|
||||||
#
|
#
|
||||||
# Description
|
# Description
|
||||||
# Locate user/group/other file as per '#includeEtc'.
|
# Locate user/group/other file as per '#includeEtc'.
|
||||||
@ -61,8 +60,8 @@ options:
|
|||||||
-config Add config directory prefix for shell type:
|
-config Add config directory prefix for shell type:
|
||||||
with -csh* for a config.csh/ prefix
|
with -csh* for a config.csh/ prefix
|
||||||
with -sh* for a config.sh/ prefix
|
with -sh* for a config.sh/ prefix
|
||||||
-show-api Print api value from wmake/rules, or meta-info and exit
|
-show-api Print META-INFO api value and exit
|
||||||
-show-patch Print patch value from meta-info and exit
|
-show-patch Print META-INFO patch value and exit
|
||||||
-with-api=NUM Specify alternative api value to search with
|
-with-api=NUM Specify alternative api value to search with
|
||||||
-quiet (-q) Suppress all normal output
|
-quiet (-q) Suppress all normal output
|
||||||
-silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output
|
-silent (-s) Suppress stderr, except -csh-verbose, -sh-verbose output
|
||||||
@ -109,54 +108,17 @@ groupDir="${WM_PROJECT_SITE:-$projectDir/site}" # As per foamVersion.H
|
|||||||
|
|
||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
# The API locations. See wmake/wmakeBuildInfo
|
# Get a value from META-INFO/api-info
|
||||||
rulesFile="$projectDir/wmake/rules/General/general"
|
# $1 : keyword
|
||||||
metaInfoDir="$projectDir/META-INFO"
|
getApiInfo()
|
||||||
|
|
||||||
# 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 's@^'"$1"' *= *\([0-9][0-9]*\).*@\1@p' "$projectDir"/META-INFO/api-info 2>/dev/null)"
|
||||||
|
|
||||||
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" ]
|
if [ -n "$value" ]
|
||||||
then
|
then
|
||||||
echo "$value"
|
echo "$value"
|
||||||
else
|
else
|
||||||
|
echo "Could not determine OPENFOAM '$1' value" 1>&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
@ -174,14 +136,12 @@ do
|
|||||||
-h | -help*)
|
-h | -help*)
|
||||||
printHelp
|
printHelp
|
||||||
;;
|
;;
|
||||||
-show-api)
|
-show-api) # Show API and exit
|
||||||
# Show API and exit
|
getApiInfo api
|
||||||
getApi
|
|
||||||
exit $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
-show-patch)
|
-show-patch) # Show patch level and exit
|
||||||
# Show patch level and exit
|
getApiInfo patch
|
||||||
getPatchLevel
|
|
||||||
exit $?
|
exit $?
|
||||||
;;
|
;;
|
||||||
-with-api=*)
|
-with-api=*)
|
||||||
@ -257,7 +217,7 @@ done
|
|||||||
#-------------------------------------------------------------------------------
|
#-------------------------------------------------------------------------------
|
||||||
|
|
||||||
# Establish the API value
|
# Establish the API value
|
||||||
[ -n "$projectApi" ] || projectApi=$(getApi)
|
[ -n "$projectApi" ] || projectApi=$(getApiInfo api)
|
||||||
|
|
||||||
|
|
||||||
# Split arguments into filename (for searching) and trailing bits for shell eval
|
# Split arguments into filename (for searching) and trailing bits for shell eval
|
||||||
|
|||||||
@ -7,7 +7,7 @@
|
|||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2018 OpenFOAM Foundation
|
# Copyright (C) 2018 OpenFOAM Foundation
|
||||||
# Copyright (C) 2019 OpenCFD Ltd.
|
# Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM.
|
# This file is part of OpenFOAM.
|
||||||
@ -166,7 +166,7 @@ fi
|
|||||||
# No api specified -with-api= or from environment (FOAM_API)
|
# No api specified -with-api= or from environment (FOAM_API)
|
||||||
if [ -z "$projectApi" ]
|
if [ -z "$projectApi" ]
|
||||||
then
|
then
|
||||||
projectApi="$(foamEtcFile -show-api 2>/dev/null)"
|
projectApi="$("$projectDir"/bin/foamEtcFile -show-api 2>/dev/null)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -6,13 +6,14 @@ wmakeCheckPwd "$WM_PROJECT_DIR/src" 2>/dev/null || {
|
|||||||
echo " Check your OpenFOAM environment and installation"
|
echo " Check your OpenFOAM environment and installation"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
[ -d "$WM_PROJECT_DIR" -a -f "$WM_PROJECT_DIR/etc/bashrc" ] || {
|
if [ -f "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments ]
|
||||||
|
then . "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments || \
|
||||||
|
echo "Argument parse error";
|
||||||
|
else
|
||||||
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
echo "Error (${0##*/}) : WM_PROJECT_DIR appears to be incorrect"
|
||||||
echo " Check your OpenFOAM environment and installation"
|
echo " Check your OpenFOAM environment and installation"
|
||||||
exit 1
|
exit 1
|
||||||
}
|
fi
|
||||||
|
|
||||||
. "$WM_PROJECT_DIR"/wmake/scripts/AllwmakeParseArguments
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|||||||
@ -1,18 +1,8 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
# Allwmake with scan-build (clang)
|
# Allwmake with scan-build (clang)
|
||||||
|
|
||||||
command -v scan-build > /dev/null || {
|
scan-build \
|
||||||
exec 1>&2
|
--use-cc="$(wmake -show-path-c)" \
|
||||||
echo "No scan-build found, stopping"
|
--use-c++="$(wmake -show-path-cxx)" \
|
||||||
echo
|
|
||||||
exit 2
|
|
||||||
}
|
|
||||||
|
|
||||||
comp_cc="$(command -v "$(wmake -show-c)")"
|
|
||||||
comp_cxx="$(command -v "$(wmake -show-cxx)")"
|
|
||||||
|
|
||||||
set -x
|
|
||||||
scan-build --use-cc="$comp_cc" --use-c++="$comp_cxx" \
|
|
||||||
./Allwmake "$@"
|
./Allwmake "$@"
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
cd "${0%/*}" || exit # Run from this directory
|
cd "${0%/*}" || exit # Run from this directory
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------------
|
||||||
|
|
||||||
wmakeLnInclude -u decompositionMethods
|
wmakeLnInclude -u decompositionMethods
|
||||||
wmakeLnInclude -u kahipDecomp
|
wmakeLnInclude -u kahipDecomp
|
||||||
|
|||||||
@ -6,11 +6,10 @@
|
|||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2014-2017 OpenFOAM Foundation
|
# Copyright (C) 2014-2017 OpenFOAM Foundation
|
||||||
# Copyright (C) 2019 OpenCFD Ltd.
|
# Copyright (C) 2019-2020 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM, licensed under GNU General Public License
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
# <http://www.gnu.org/licenses/>.
|
|
||||||
#
|
#
|
||||||
# File
|
# File
|
||||||
# wmake/scripts/AllwmakeParseArguments
|
# wmake/scripts/AllwmakeParseArguments
|
||||||
@ -22,14 +21,26 @@
|
|||||||
# # Parse the arguments by sourcing this script
|
# # Parse the arguments by sourcing this script
|
||||||
# . ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
|
# . ${WM_PROJECT_DIR:?}/wmake/scripts/AllwmakeParseArguments
|
||||||
#
|
#
|
||||||
|
# Parsed options (make)
|
||||||
|
# -k | -keep-going | -non-stop
|
||||||
|
# -j | -jN | -j N
|
||||||
|
#
|
||||||
|
# Parsed options (wmake)
|
||||||
|
# -debug
|
||||||
|
# -q | -queue
|
||||||
|
#
|
||||||
|
# Parsed options (special)
|
||||||
|
# -l | -log | -log=FILE
|
||||||
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
|
# Check environment
|
||||||
if [ -z "$WM_PROJECT_DIR" ]
|
[ -d "$WM_PROJECT_DIR" ] || {
|
||||||
then
|
exec 1>&2
|
||||||
echo "$Script error: The OpenFOAM environment is not set."
|
echo "$Script error: The OpenFOAM environment not set or incorrect."
|
||||||
echo " Check the OpenFOAM entries in your dot-files and source them."
|
echo " Check OpenFOAM entries in your dot-files and source them."
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
exec 1>&2
|
exec 1>&2
|
||||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
|
|||||||
@ -79,7 +79,7 @@ then
|
|||||||
cat<<HELP_FULL
|
cat<<HELP_FULL
|
||||||
-debug Define c++DBUG='-DFULLDEBUG -g -O0' as override
|
-debug Define c++DBUG='-DFULLDEBUG -g -O0' as override
|
||||||
-no-scheduler Disable scheduled parallel compilation
|
-no-scheduler Disable scheduled parallel compilation
|
||||||
-show-api Print api value
|
-show-api Print api value (from Make rules)
|
||||||
-show-ext-so Print shared library extension (with '.' separator)
|
-show-ext-so Print shared library extension (with '.' separator)
|
||||||
-show-c Print C compiler value
|
-show-c Print C compiler value
|
||||||
-show-cflags Print C compiler flags
|
-show-cflags Print C compiler flags
|
||||||
|
|||||||
@ -6,23 +6,10 @@
|
|||||||
# \\ / A nd | www.openfoam.com
|
# \\ / A nd | www.openfoam.com
|
||||||
# \\/ M anipulation |
|
# \\/ M anipulation |
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Copyright (C) 2018-2019 OpenCFD Ltd.
|
# Copyright (C) 2018-2020 OpenCFD Ltd.
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# License
|
# License
|
||||||
# This file is part of OpenFOAM.
|
# This file is part of OpenFOAM, distributed under GPL-3.0-or-later.
|
||||||
#
|
|
||||||
# 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
|
||||||
# wmakeBuildInfo
|
# wmakeBuildInfo
|
||||||
@ -38,12 +25,13 @@
|
|||||||
# Note
|
# Note
|
||||||
# Partial logic is also implemented in the bin/foamEtcFile
|
# Partial logic is also implemented in the bin/foamEtcFile
|
||||||
# -show-api and -show-patch options.
|
# -show-api and -show-patch options.
|
||||||
# Make sure that any changes here are also reflected there.
|
# Make sure that changes here are also reflected there.
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
# Locations
|
# Locations
|
||||||
rulesFile="${WM_DIR:-$WM_PROJECT_DIR/wmake}/rules/General/general"
|
rulesFile="${WM_DIR:-$WM_PROJECT_DIR/wmake}/rules/General/general"
|
||||||
metaInfoDir="$WM_PROJECT_DIR/META-INFO"
|
META_INFO="$WM_PROJECT_DIR/META-INFO"
|
||||||
|
FOAM_GIT_DIR="$WM_PROJECT_DIR/.git"
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
exec 1>&2
|
exec 1>&2
|
||||||
@ -58,6 +46,7 @@ options:
|
|||||||
(exit code 0 for no changes)
|
(exit code 0 for no changes)
|
||||||
-dry-run In combination with -update
|
-dry-run In combination with -update
|
||||||
-filter FILE Filter @API@, @BUILD@ tags in file with make information
|
-filter FILE Filter @API@, @BUILD@ tags in file with make information
|
||||||
|
-no-git Disable use of git for obtaining information
|
||||||
-remove Remove meta-info build information and exit
|
-remove Remove meta-info build information and exit
|
||||||
-update Update meta-info from make information
|
-update Update meta-info from make information
|
||||||
-query Report make-info and meta-info
|
-query Report make-info and meta-info
|
||||||
@ -131,6 +120,9 @@ do
|
|||||||
shift # Stop here, a file name follows
|
shift # Stop here, a file name follows
|
||||||
break
|
break
|
||||||
;;
|
;;
|
||||||
|
-no-git)
|
||||||
|
unset FOAM_GIT_DIR
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
die "unknown option/argument: '$1'"
|
die "unknown option/argument: '$1'"
|
||||||
;;
|
;;
|
||||||
@ -142,8 +134,8 @@ done
|
|||||||
[ -d "$WM_PROJECT_DIR" ] || \
|
[ -d "$WM_PROJECT_DIR" ] || \
|
||||||
die "Bad or unset environment variable: \$WM_PROJECT_DIR"
|
die "Bad or unset environment variable: \$WM_PROJECT_DIR"
|
||||||
|
|
||||||
[ -d "$WM_PROJECT_DIR/META-INFO" ] || \
|
[ -d "$META_INFO" ] || \
|
||||||
die "No META-INFO/ directory for project"
|
die "No ${META_INFO##*/}/ directory for project"
|
||||||
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
@ -151,12 +143,12 @@ done
|
|||||||
if [ "$optUpdate" = remove ]
|
if [ "$optUpdate" = remove ]
|
||||||
then
|
then
|
||||||
|
|
||||||
if [ -f "$metaInfoDir/build-info" ]
|
if [ -f "$META_INFO/build-info" ]
|
||||||
then
|
then
|
||||||
echo "Removing project META-INFO/build-info" 1>&2
|
echo "Removing project ${META_INFO##*/}/build-info" 1>&2
|
||||||
rm -f "$metaInfoDir/build-info" 2>/dev/null
|
rm -f "$META_INFO/build-info" 2>/dev/null
|
||||||
else
|
else
|
||||||
echo "Already removed project META-INFO/build-info" 1>&2
|
echo "Already removed project ${META_INFO##*/}/build-info" 1>&2
|
||||||
fi
|
fi
|
||||||
exit 0
|
exit 0
|
||||||
|
|
||||||
@ -173,7 +165,7 @@ then
|
|||||||
|
|
||||||
else
|
else
|
||||||
|
|
||||||
[ "$#" -eq 0 ] || die "Unexpected option/arguments $@"
|
[ "$#" -eq 0 ] || die "Unexpected option/arguments $*"
|
||||||
|
|
||||||
# Nothing specified? Default to -query-make
|
# Nothing specified? Default to -query-make
|
||||||
if [ -z "$optCheck$optUpdate$optQuery" ]
|
if [ -z "$optCheck$optUpdate$optQuery" ]
|
||||||
@ -221,22 +213,25 @@ getMakeInfo()
|
|||||||
# (api) from WM_DIR/rules/General/general
|
# (api) from WM_DIR/rules/General/general
|
||||||
# - extract WM_VERSION = OPENFOAM=<digits>
|
# - extract WM_VERSION = OPENFOAM=<digits>
|
||||||
|
|
||||||
api="$(sed -ne '/^ *#/!{ /WM_VERSION.*OPENFOAM=/{ s@^.*OPENFOAM= *\([0-9][0-9]*\).*@\1@p; q }}' $rulesFile 2>/dev/null)"
|
api="$(sed -ne '/^ *#/!{ /WM_VERSION.*OPENFOAM=/{ s@^.*OPENFOAM= *\([0-9][0-9]*\).*@\1@p; q }}' "$rulesFile" 2>/dev/null)"
|
||||||
|
|
||||||
if [ -d "$metaInfoDir" ]
|
if [ -d "$META_INFO" ]
|
||||||
then
|
then
|
||||||
# (patch) from build-info - not from api-info
|
# (patch) from build-info - not from api-info
|
||||||
patch="$(sed -ne 's@^patch *= *\([0-9][0-9]*\).*@\1@p' $metaInfoDir/build-info 2>/dev/null)"
|
patch="$(sed -ne 's@^patch *= *\([0-9][0-9]*\).*@\1@p' "$META_INFO/build-info" 2>/dev/null)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Build info from git. Use short date format (YYYY-MM-DD) and sed instead
|
# Build info from git. Use short date format (YYYY-MM-DD) and sed instead
|
||||||
# of the newer --date='format:%y%m%d'
|
# of the newer --date='format:%y%m%d'
|
||||||
build="$(git --git-dir=$WM_PROJECT_DIR/.git log -1 --date=short --format='%h=%ad' 2>/dev/null|sed 's/-//g;s/=/-/')"
|
if [ -d "$FOAM_GIT_DIR" ]
|
||||||
|
|
||||||
# Branch info from git
|
|
||||||
if [ -n "$build" ]
|
|
||||||
then
|
then
|
||||||
branch="$(git --git-dir=$WM_PROJECT_DIR/.git rev-parse --abbrev-ref HEAD 2>/dev/null)"
|
build="$(git --git-dir="$FOAM_GIT_DIR" log -1 --date=short --format='%h=%ad' 2>/dev/null|sed 's/-//g;s/=/-/')"
|
||||||
|
|
||||||
|
# Branch info from git
|
||||||
|
if [ -n "$build" ]
|
||||||
|
then
|
||||||
|
branch="$(git --git-dir="$FOAM_GIT_DIR" rev-parse --abbrev-ref HEAD 2>/dev/null)"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
make_api="$api"
|
make_api="$api"
|
||||||
@ -269,15 +264,15 @@ getMetaInfo()
|
|||||||
local api patch build branch
|
local api patch build branch
|
||||||
unset meta_api meta_patch meta_branch meta_build
|
unset meta_api meta_patch meta_branch meta_build
|
||||||
|
|
||||||
if [ -d "$metaInfoDir" ]
|
if [ -d "$META_INFO" ]
|
||||||
then
|
then
|
||||||
# (api, patch) from api-info
|
# (api, patch) from api-info
|
||||||
# (branch, build) from build-info
|
# (branch, build) from build-info
|
||||||
|
|
||||||
api="$(sed -ne 's@^api *= *\([0-9][0-9]*\).*@\1@p' $metaInfoDir/api-info 2>/dev/null)"
|
api="$(sed -ne 's@^api *= *\([0-9][0-9]*\).*@\1@p' "$META_INFO/api-info" 2>/dev/null)"
|
||||||
patch="$(sed -ne 's@^patch *= *\([0-9][0-9]*\).*@\1@p' $metaInfoDir/api-info 2>/dev/null)"
|
patch="$(sed -ne 's@^patch *= *\([0-9][0-9]*\).*@\1@p' "$META_INFO/api-info" 2>/dev/null)"
|
||||||
branch="$(sed -ne 's@^branch *= *\([^ ]*\).*@\1@p' $metaInfoDir/build-info 2>/dev/null)"
|
branch="$(sed -ne 's@^branch *= *\([^ ]*\).*@\1@p' "$META_INFO/build-info" 2>/dev/null)"
|
||||||
build="$(sed -ne 's@^build *= *\([^ ]*\).*@\1@p' $metaInfoDir/build-info 2>/dev/null)"
|
build="$(sed -ne 's@^build *= *\([^ ]*\).*@\1@p' "$META_INFO/build-info" 2>/dev/null)"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
meta_api="$api"
|
meta_api="$api"
|
||||||
@ -478,7 +473,7 @@ performUpdate()
|
|||||||
local outputFile
|
local outputFile
|
||||||
|
|
||||||
# build-info
|
# build-info
|
||||||
outputFile="$metaInfoDir/build-info"
|
outputFile="$META_INFO/build-info"
|
||||||
if [ "$branch" != "${meta_branch}" ] || \
|
if [ "$branch" != "${meta_branch}" ] || \
|
||||||
[ "$build" != "${meta_build}" ] || \
|
[ "$build" != "${meta_build}" ] || \
|
||||||
[ "$patch" != "${meta_patch}" ]
|
[ "$patch" != "${meta_patch}" ]
|
||||||
@ -499,7 +494,7 @@ performUpdate()
|
|||||||
|
|
||||||
|
|
||||||
# api-info
|
# api-info
|
||||||
outputFile="$metaInfoDir/api-info"
|
outputFile="$META_INFO/api-info"
|
||||||
if [ "$api" != "${meta_api}" ]
|
if [ "$api" != "${meta_api}" ]
|
||||||
then
|
then
|
||||||
patch="${meta_patch:-0}" # <- From meta-info only
|
patch="${meta_patch:-0}" # <- From meta-info only
|
||||||
|
|||||||
Reference in New Issue
Block a user