From 449a0e253dfb72f33e444fff19f141ccbf49c689 Mon Sep 17 00:00:00 2001 From: Mark Olesen <Mark.Olesen@Germany> Date: Tue, 15 Feb 2011 10:08:46 +0100 Subject: [PATCH] ENH: add -current option to foamPackBin, foamPackMake - reduces typing --- bin/foamPack | 6 +++--- bin/foamPackBin | 21 ++++++++++++++++----- bin/foamPackDeps | 4 ++-- bin/foamPackDoxygen | 16 ++++++++-------- bin/foamPackMake | 21 ++++++++++++++++----- bin/tools/foamPackSource | 4 ++-- 6 files changed, 47 insertions(+), 25 deletions(-) diff --git a/bin/foamPack b/bin/foamPack index 3faa48cfdf3..5c22d5849a5 100755 --- a/bin/foamPack +++ b/bin/foamPack @@ -37,8 +37,8 @@ usage() { cat <<USAGE 1>&2 Usage: ${0##*/} [OPTION] options: - -o <dir> specify alternative output directory - -nogit bypass using 'git archive' + -o, -output <dir> specify alternative output directory + -nogit bypass using 'git archive' * Pack and compress OpenFOAM directory for release @@ -46,7 +46,7 @@ USAGE exit 1 } -unset prefix outputDir nogit +unset outputDir nogit # parse options while [ "$#" -gt 0 ] do diff --git a/bin/foamPackBin b/bin/foamPackBin index 2cd739b8182..67738d1ea82 100755 --- a/bin/foamPackBin +++ b/bin/foamPackBin @@ -57,8 +57,10 @@ usage() { while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done cat <<USAGE 1>&2 Usage: ${0##*/} [OPTION] <archOptions> + ${0##*/} [OPTION] -current 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 @@ -70,7 +72,8 @@ USAGE } -unset prefix outputDir +unset archOptions outputDir + # parse options while [ "$#" -gt 0 ] do @@ -78,6 +81,10 @@ do -h | -help) usage ;; + -c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt' + archOptions="$WM_OPTIONS" + shift + ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} @@ -92,10 +99,14 @@ do esac 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) diff --git a/bin/foamPackDeps b/bin/foamPackDeps index 198c3a3b191..67a885b9002 100755 --- a/bin/foamPackDeps +++ b/bin/foamPackDeps @@ -56,7 +56,7 @@ usage() { cat <<USAGE 1>&2 Usage: ${0##*/} [OPTION] options: - -o <dir> specify alternative output directory + -o, -output <dir> specify alternative output directory * 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 ] then - echo "Finished packing *.dep files into file $packFile" 1>&2 + echo "Finished packing *.dep files into $packFile" 1>&2 else echo "Error: failure packing *.dep files into $packFile" 1>&2 rm -f $packFile 2>/dev/null diff --git a/bin/foamPackDoxygen b/bin/foamPackDoxygen index 464a5d523f3..6f1b17ca27a 100755 --- a/bin/foamPackDoxygen +++ b/bin/foamPackDoxygen @@ -37,8 +37,8 @@ usage() { cat <<USAGE 1>&2 Usage: ${0##*/} [OPTION] options: - -prefix <dir> use alternative prefix - -o <dir> specify alternative output directory + -o, -output <dir> specify alternative output directory + -prefix <dir> use alternative prefix * Pack and compress the OpenFOAM doxygen html for release @@ -54,14 +54,14 @@ do -h | -help) usage ;; - -prefix | --prefix) + -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" - prefix=${2%%/} + outputDir=${2%%/} shift 2 ;; - -o | -output) + -prefix | --prefix) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" - outputDir=${2%%/} + prefix=${2%%/} shift 2 ;; -*) @@ -120,9 +120,9 @@ fi if [ $? -eq 0 ] then - echo "Finished packing doxygen html into file $packFile" 1>&2 + echo "Finished packing doxygen html into $packFile" 1>&2 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 fi diff --git a/bin/foamPackMake b/bin/foamPackMake index a3370867d06..c4325723e34 100755 --- a/bin/foamPackMake +++ b/bin/foamPackMake @@ -55,8 +55,10 @@ usage() { while [ $# -gt 0 ]; do echo "$1" 1>&2; shift; done cat <<USAGE 1>&2 Usage: ${0##*/} [OPTION] <archOptions> + ${0##*/} [OPTION] -current 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 @@ -68,7 +70,8 @@ USAGE } -unset outputDir +unset archOptions outputDir + # parse options while [ "$#" -gt 0 ] do @@ -76,6 +79,10 @@ do -h | -help) usage ;; + -c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt' + archOptions="$WM_OPTIONS" + shift + ;; -o | -output) [ "$#" -ge 2 ] || usage "'$1' option requires an argument" outputDir=${2%%/} @@ -90,10 +97,14 @@ do esac 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) diff --git a/bin/tools/foamPackSource b/bin/tools/foamPackSource index 55a7b3bbee0..a4d014cfcf0 100755 --- a/bin/tools/foamPackSource +++ b/bin/tools/foamPackSource @@ -84,9 +84,9 @@ trap 'rm -f $packFile $tmpFile 2>/dev/null' INT tar cpzf $packFile --files-from $tmpFile if [ $? -eq 0 ] then - echo "Finished packing $packDir into file $packFile" 1>&2 + echo "Finished packing $packDir into $packFile" 1>&2 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 fi -- GitLab