mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: add -current option to foamPackBin, foamPackMake
- reduces typing
This commit is contained in:
@ -37,8 +37,8 @@ usage() {
|
|||||||
cat <<USAGE 1>&2
|
cat <<USAGE 1>&2
|
||||||
Usage: ${0##*/} [OPTION]
|
Usage: ${0##*/} [OPTION]
|
||||||
options:
|
options:
|
||||||
-o <dir> specify alternative output directory
|
-o, -output <dir> specify alternative output directory
|
||||||
-nogit bypass using 'git archive'
|
-nogit bypass using 'git archive'
|
||||||
|
|
||||||
* Pack and compress OpenFOAM directory for release
|
* Pack and compress OpenFOAM directory for release
|
||||||
|
|
||||||
@ -46,7 +46,7 @@ USAGE
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
unset prefix outputDir nogit
|
unset outputDir nogit
|
||||||
# parse options
|
# parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
|
|||||||
@ -57,8 +57,10 @@ usage() {
|
|||||||
while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done
|
while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done
|
||||||
cat <<USAGE 1>&2
|
cat <<USAGE 1>&2
|
||||||
Usage: ${0##*/} [OPTION] <archOptions>
|
Usage: ${0##*/} [OPTION] <archOptions>
|
||||||
|
${0##*/} [OPTION] -current
|
||||||
options:
|
options:
|
||||||
-o <dir> specify alternative output directory
|
-c, -current use current value of \$WM_OPTIONS
|
||||||
|
-o, -output <dir> specify alternative output directory
|
||||||
|
|
||||||
* Pack and compress binary version of $codeBase for release
|
* Pack and compress binary version of $codeBase for release
|
||||||
|
|
||||||
@ -70,7 +72,8 @@ USAGE
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unset prefix outputDir
|
unset archOptions outputDir
|
||||||
|
|
||||||
# parse options
|
# parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
@ -78,6 +81,10 @@ do
|
|||||||
-h | -help)
|
-h | -help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
-c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt'
|
||||||
|
archOptions="$WM_OPTIONS"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-o | -output)
|
-o | -output)
|
||||||
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
||||||
outputDir=${2%%/}
|
outputDir=${2%%/}
|
||||||
@ -92,10 +99,14 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
[ $# -eq 1 ] || usage "Error: specify architecture"
|
if [ -n "$archOptions" ]
|
||||||
|
then
|
||||||
|
[ $# -eq 0 ] || usage "Error: cannot specify both -current and architecture"
|
||||||
|
else
|
||||||
|
archOptions="$1"
|
||||||
|
[ $# -eq 1 ] || usage "Error: specify architecture"
|
||||||
|
fi
|
||||||
|
|
||||||
# same as $WM_OPTIONS - eg, 'linux64GccDPOpt'
|
|
||||||
archOptions="$1"
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
timeStamp=$(date +%Y-%m-%d)
|
timeStamp=$(date +%Y-%m-%d)
|
||||||
|
|||||||
@ -56,7 +56,7 @@ usage() {
|
|||||||
cat <<USAGE 1>&2
|
cat <<USAGE 1>&2
|
||||||
Usage: ${0##*/} [OPTION]
|
Usage: ${0##*/} [OPTION]
|
||||||
options:
|
options:
|
||||||
-o <dir> specify alternative output directory
|
-o, -output <dir> specify alternative output directory
|
||||||
|
|
||||||
* Pack and compress *.dep files from $codeBase
|
* Pack and compress *.dep files from $codeBase
|
||||||
|
|
||||||
@ -123,7 +123,7 @@ find -H $packDir -name '*.dep' -type f -print | tar cpzf $packFile -T -
|
|||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "Finished packing *.dep files into file $packFile" 1>&2
|
echo "Finished packing *.dep files into $packFile" 1>&2
|
||||||
else
|
else
|
||||||
echo "Error: failure packing *.dep files into $packFile" 1>&2
|
echo "Error: failure packing *.dep files into $packFile" 1>&2
|
||||||
rm -f $packFile 2>/dev/null
|
rm -f $packFile 2>/dev/null
|
||||||
|
|||||||
@ -37,8 +37,8 @@ usage() {
|
|||||||
cat <<USAGE 1>&2
|
cat <<USAGE 1>&2
|
||||||
Usage: ${0##*/} [OPTION]
|
Usage: ${0##*/} [OPTION]
|
||||||
options:
|
options:
|
||||||
-prefix <dir> use alternative prefix
|
-o, -output <dir> specify alternative output directory
|
||||||
-o <dir> specify alternative output directory
|
-prefix <dir> use alternative prefix
|
||||||
|
|
||||||
* Pack and compress the OpenFOAM doxygen html for release
|
* Pack and compress the OpenFOAM doxygen html for release
|
||||||
|
|
||||||
@ -54,16 +54,16 @@ do
|
|||||||
-h | -help)
|
-h | -help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
-prefix | --prefix)
|
|
||||||
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
|
||||||
prefix=${2%%/}
|
|
||||||
shift 2
|
|
||||||
;;
|
|
||||||
-o | -output)
|
-o | -output)
|
||||||
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
||||||
outputDir=${2%%/}
|
outputDir=${2%%/}
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
-prefix | --prefix)
|
||||||
|
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
||||||
|
prefix=${2%%/}
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
-*)
|
-*)
|
||||||
usage "unknown option: '$*'"
|
usage "unknown option: '$*'"
|
||||||
;;
|
;;
|
||||||
@ -120,9 +120,9 @@ fi
|
|||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "Finished packing doxygen html into file $packFile" 1>&2
|
echo "Finished packing doxygen html into $packFile" 1>&2
|
||||||
else
|
else
|
||||||
echo "Error: failure packing doxygen html into file $packFile" 1>&2
|
echo "Error: failure packing doxygen html into $packFile" 1>&2
|
||||||
rm -f $packFile 2>/dev/null
|
rm -f $packFile 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@ -55,8 +55,10 @@ usage() {
|
|||||||
while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done
|
while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done
|
||||||
cat <<USAGE 1>&2
|
cat <<USAGE 1>&2
|
||||||
Usage: ${0##*/} [OPTION] <archOptions>
|
Usage: ${0##*/} [OPTION] <archOptions>
|
||||||
|
${0##*/} [OPTION] -current
|
||||||
options:
|
options:
|
||||||
-o <dir> specify alternative output directory
|
-c, -current use current value of \$WM_OPTIONS
|
||||||
|
-o, -output <dir> specify alternative output directory
|
||||||
|
|
||||||
* Pack and compress $codeBase Make/<archOptions> directories
|
* Pack and compress $codeBase Make/<archOptions> directories
|
||||||
|
|
||||||
@ -68,7 +70,8 @@ USAGE
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unset outputDir
|
unset archOptions outputDir
|
||||||
|
|
||||||
# parse options
|
# parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
@ -76,6 +79,10 @@ do
|
|||||||
-h | -help)
|
-h | -help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
-c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt'
|
||||||
|
archOptions="$WM_OPTIONS"
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-o | -output)
|
-o | -output)
|
||||||
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
|
||||||
outputDir=${2%%/}
|
outputDir=${2%%/}
|
||||||
@ -90,10 +97,14 @@ do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
[ $# -eq 1 ] || usage "Error: specify architecture"
|
if [ -n "$archOptions" ]
|
||||||
|
then
|
||||||
|
[ $# -eq 0 ] || usage "Error: cannot specify both -current and architecture"
|
||||||
|
else
|
||||||
|
archOptions="$1"
|
||||||
|
[ $# -eq 1 ] || usage "Error: specify architecture"
|
||||||
|
fi
|
||||||
|
|
||||||
# same as $WM_OPTIONS - eg, 'linux64GccDPOpt'
|
|
||||||
archOptions="$1"
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
timeStamp=$(date +%Y-%m-%d)
|
timeStamp=$(date +%Y-%m-%d)
|
||||||
|
|||||||
@ -84,9 +84,9 @@ trap 'rm -f $packFile $tmpFile 2>/dev/null' INT
|
|||||||
tar cpzf $packFile --files-from $tmpFile
|
tar cpzf $packFile --files-from $tmpFile
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "Finished packing $packDir into file $packFile" 1>&2
|
echo "Finished packing $packDir into $packFile" 1>&2
|
||||||
else
|
else
|
||||||
echo "Error: failure packing $packDir into file $packFile" 1>&2
|
echo "Error: failure packing $packDir into $packFile" 1>&2
|
||||||
rm -f $packFile 2>/dev/null
|
rm -f $packFile 2>/dev/null
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user