mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
bin/foamCheckSourceDeps works again
- added -rm | -remove option - added -rmdir option
This commit is contained in:
@ -31,19 +31,49 @@
|
|||||||
#
|
#
|
||||||
# Search for *.dep files that are without a corresponding .C or .L file.
|
# Search for *.dep files that are without a corresponding .C or .L file.
|
||||||
# These could indicate a directory that has been moved.
|
# These could indicate a directory that has been moved.
|
||||||
# - print questionable directory and dep file
|
# - print questionable directory and the *.dep file
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
if [ "$1" = "-h" -o "$1" = "-help" ]
|
usage() {
|
||||||
then
|
while [ "$#" -ge 1 ]; do echo "$1"; shift; done
|
||||||
cat <<USAGE 1>&2
|
cat<<USAGE 1>&2
|
||||||
Usage: ${0##*/} [dir1 .. dirN]
|
Usage: ${0##*/} [OPTION] [dir1 .. dirN]
|
||||||
|
options:
|
||||||
|
-rm | -remove remove the offending .dep file
|
||||||
|
-rmdir find and remove empty directories (recursively)
|
||||||
|
|
||||||
Search for .dep files that are without a corresponding .C or .L file.
|
* Search for .dep files that are without a corresponding .C or .L file.
|
||||||
This could indicate a directory that has been moved.
|
This could indicate a directory that has been moved.
|
||||||
- print questionable directory and file
|
- print questionable directory and file
|
||||||
|
|
||||||
USAGE
|
USAGE
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
}
|
||||||
|
|
||||||
|
unset optRemove optrmDir
|
||||||
|
|
||||||
|
# parse options
|
||||||
|
while [ "$#" -gt 0 ]
|
||||||
|
do
|
||||||
|
case "$1" in
|
||||||
|
-h | -help)
|
||||||
|
usage
|
||||||
|
;;
|
||||||
|
-rm | -remove)
|
||||||
|
optRemove=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-rmdir)
|
||||||
|
optrmDir=true
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-*)
|
||||||
|
usage "unknown option: '$*'"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
break
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
if [ "$#" -eq 0 ]
|
if [ "$#" -eq 0 ]
|
||||||
then
|
then
|
||||||
@ -54,17 +84,27 @@ for checkDir
|
|||||||
do
|
do
|
||||||
if [ -d $checkDir ]
|
if [ -d $checkDir ]
|
||||||
then
|
then
|
||||||
find $checkDir -name '*.dep' -print | while read depFile;
|
find $checkDir -name '*.dep' -print | while read depFile
|
||||||
do
|
do
|
||||||
Cfile=$(echo $depFile | sed -e 's/\.dep$/.C/')
|
# check C++ and Flex files
|
||||||
# also check flex files
|
if [ ! -r "${depFile%dep}C" -a ! -r "${depFile%dep}L" ];
|
||||||
Lfile=$(echo $depFile | sed -e 's/\.C$/.L/')
|
|
||||||
if [ ! -f $Cfile -a ! -f $Lfile ]
|
|
||||||
then
|
then
|
||||||
echo "$(dirname $Cfile) ${depFile##*/}"
|
echo "${depFile%/[^/]*} ${depFile##*/}"
|
||||||
|
[ "$optRemove" ] && rm -f $depFile
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$optrmDir" ]
|
||||||
|
then
|
||||||
|
for checkDir
|
||||||
|
do
|
||||||
|
if [ -d $checkDir ]
|
||||||
|
then
|
||||||
|
echo "scan directory: $checkDir"
|
||||||
|
find $checkDir -depth -type d -empty -print -exec rmdir \{\} \;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user