Allwmake -update: Further improvements to handle source-tree/dep file inconsistencies after git pull
Patch contributed by Bruno Santos Resolves bug-report http://bugs.openfoam.org/view.php?id=2091
This commit is contained in:
parent
0365dec03e
commit
326b646bb8
61
src/parallel/decompose/Allwclean
Executable file
61
src/parallel/decompose/Allwclean
Executable file
@ -0,0 +1,61 @@
|
||||
#!/bin/sh
|
||||
cd ${0%/*} || exit 1 # Run from this directory
|
||||
|
||||
# Parse arguments for library compilation
|
||||
targetType=libso
|
||||
. $WM_PROJECT_DIR/wmake/scripts/AllwmakeParseArguments
|
||||
|
||||
# get SCOTCH_VERSION, SCOTCH_ARCH_PATH
|
||||
if settings=`$WM_PROJECT_DIR/bin/foamEtcFile config.sh/scotch`
|
||||
then
|
||||
. $settings
|
||||
echo "using SCOTCH_ARCH_PATH=$SCOTCH_ARCH_PATH"
|
||||
else
|
||||
echo
|
||||
echo "Error: no config.sh/scotch settings"
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# define how to clean an mpi-versioned library
|
||||
#
|
||||
wcleanMpiLib()
|
||||
{
|
||||
set +x
|
||||
for libName
|
||||
do
|
||||
(
|
||||
WM_OPTIONS="$WM_OPTIONS$WM_MPLIB"
|
||||
whichmpi="$WM_PROJECT_DIR/platforms/$WM_OPTIONS/src/parallel/decompose/$libName/using:$FOAM_MPI"
|
||||
whichscotch="$WM_PROJECT_DIR/platforms/$WM_OPTIONS/src/parallel/decompose/$libName/using:$SCOTCH_VERSION"
|
||||
wclean $targetType $libName
|
||||
)
|
||||
done
|
||||
set -x
|
||||
}
|
||||
|
||||
set -x
|
||||
|
||||
if [ -n "$SCOTCH_ARCH_PATH" ]
|
||||
then
|
||||
wclean scotchDecomp
|
||||
|
||||
if [ -d "$FOAM_LIBBIN/$FOAM_MPI" ]
|
||||
then
|
||||
wcleanMpiLib ptscotchDecomp
|
||||
fi
|
||||
else
|
||||
echo
|
||||
echo "Skipping scotchDecomp (ptscotchDecomp)"
|
||||
echo
|
||||
fi
|
||||
|
||||
|
||||
wclean metisDecomp
|
||||
|
||||
wclean decompositionMethods
|
||||
|
||||
wclean decompose
|
||||
|
||||
#------------------------------------------------------------------------------
|
@ -55,7 +55,8 @@ options:
|
||||
-j Compile using all local cores/hyperthreads
|
||||
-jN or -j N Compile using N cores/hyperthreads
|
||||
-no-scheduler Compile without wmakeScheduler
|
||||
-update Update lnInclude directories and dep files
|
||||
-update Update lnInclude directories, dep files, remove deprecated
|
||||
files and directories
|
||||
USAGE
|
||||
|
||||
# Print options for building code documentation
|
||||
@ -123,10 +124,17 @@ do
|
||||
-no-scheduler)
|
||||
unset WM_SCHEDULER
|
||||
;;
|
||||
# Update lnInclude directories and dep files following a pull
|
||||
# Meant to be used following a pull, this will:
|
||||
# - remove dep files that depend on deleted files;
|
||||
# - remove stale dep files;
|
||||
# - update lnInclude directories;
|
||||
# - remove empty directories, along with deprecated object directories
|
||||
# and respective binaries.
|
||||
-update)
|
||||
wrmdep -update
|
||||
wrmdep -old
|
||||
wmakeLnIncludeAll
|
||||
wclean empty
|
||||
|
||||
# Set WM_UPDATE_DEPENDENCIES, so that wmake will pick up on it
|
||||
export WM_UPDATE_DEPENDENCIES=yes
|
||||
|
@ -3,7 +3,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2015 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2015-2016 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -101,7 +101,9 @@ findObjectDir()
|
||||
depToSource()
|
||||
{
|
||||
sourceFile=$(echo ${depFile%.dep} | \
|
||||
sed -e s%platforms/${WM_OPTIONS}/%% -e s%Make/${WM_OPTIONS}/%% )
|
||||
sed -e s%platforms/${WM_OPTIONS}/%% -e s%Make/${WM_OPTIONS}/%% \
|
||||
-e s%platforms/${WM_OPTIONS}${WM_MPLIB}/%% \
|
||||
-e s%Make/${WM_OPTIONS}${WM_MPLIB}/%% )
|
||||
}
|
||||
|
||||
#------------------------------------------------------------------------------
|
||||
|
73
wmake/wclean
73
wmake/wclean
@ -3,7 +3,7 @@
|
||||
# ========= |
|
||||
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
|
||||
# \\ / O peration |
|
||||
# \\ / A nd | Copyright (C) 2011-2015 OpenFOAM Foundation
|
||||
# \\ / A nd | Copyright (C) 2011-2016 OpenFOAM Foundation
|
||||
# \\/ M anipulation |
|
||||
#-------------------------------------------------------------------------------
|
||||
# License
|
||||
@ -36,6 +36,9 @@
|
||||
#------------------------------------------------------------------------------
|
||||
Script=${0##*/}
|
||||
|
||||
# Source the wmake functions
|
||||
. ${0%/*}/scripts/wmakeFunctions
|
||||
|
||||
usage() {
|
||||
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||
cat<<USAGE
|
||||
@ -55,7 +58,10 @@ The targets correspond to a subset of the 'wmake' special targets:
|
||||
files if they exist
|
||||
exe | lib | libo | libso
|
||||
Clean Make, any *.dep files and lnInclude directories
|
||||
empty Remove empty sub-directories for the requested dir
|
||||
empty Remove empty sub-directories for the requested dir.
|
||||
If executed in the main project directory, it will also
|
||||
remove deprecated object directories and respective binaries
|
||||
that refer to no-longer-existing source code.
|
||||
|
||||
USAGE
|
||||
exit 1
|
||||
@ -127,14 +133,75 @@ fi
|
||||
|
||||
if [ "$targetType" = empty ]
|
||||
then
|
||||
# First pass: clean up empty source code directories
|
||||
|
||||
echo "Searching for empty directories..."
|
||||
|
||||
# Get sub-directories avoiding particular directories
|
||||
for dir in $(find . -mindepth 1 -maxdepth 1 \
|
||||
-type d \( -name .git -prune -o -print \) )
|
||||
-type d \( -name .git -prune -o -print \) )
|
||||
do
|
||||
echo "check dir: $dir"
|
||||
find $dir -depth -type d -empty -exec rmdir {} \; -print
|
||||
done
|
||||
|
||||
echo "Search for empty directories complete."
|
||||
|
||||
# Second pass: clean up object directories with WM_PROJECT_DIR that don't
|
||||
# have respective source code folders, along with the respective binaries
|
||||
|
||||
expandPath $PWD
|
||||
if [ "$exPath" = "$WM_PROJECT_DIR" ]
|
||||
then
|
||||
findObjectDir $PWD
|
||||
|
||||
if [ -d $objectsDir ]
|
||||
then
|
||||
echo "Searching for deprecated object directories at: $objectsDir"
|
||||
|
||||
find $objectsDir -name 'variables' -print | \
|
||||
while read variablesFile
|
||||
do
|
||||
# Hack'ish way of getting the original source code path
|
||||
depFile=$(dirname $variablesFile)
|
||||
depToSource $depFile
|
||||
|
||||
# Check if the original source code directory exists
|
||||
if [ ! -r "$sourceFile" ]
|
||||
then
|
||||
# Delete the respective binary first
|
||||
binaryFile=$(cat $variablesFile |
|
||||
grep -e '^ *\(EXE\|LIB\) *= *' )
|
||||
|
||||
# Catch all file extension (o,a,so,?+) for libraries
|
||||
if echo $binaryFile | grep -qe '^ *LIB *= *'
|
||||
then
|
||||
binaryFile="${binaryFile}.*"
|
||||
fi
|
||||
|
||||
# Isolate path and translate environment variables
|
||||
binaryFile=$(echo $binaryFile | \
|
||||
sed -e 's/^ *\(EXE\|LIB\) *= *//' \
|
||||
-e 's/(/{/g' -e 's/)/}/g' )
|
||||
|
||||
# Expand environment variables for path
|
||||
binaryFile=$(eval echo $binaryFile)
|
||||
|
||||
# Verbosely remove binary file
|
||||
if [ -n "$binaryFile" -a -e "$binaryFile" ]
|
||||
then
|
||||
rm -vf $binaryFile 2>/dev/null
|
||||
fi
|
||||
|
||||
# Remove the deprecated object directory
|
||||
rm -rvf $depFile 2>/dev/null
|
||||
fi
|
||||
done
|
||||
|
||||
echo "Search for deprecated object directories complete."
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user