mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: support bzip2 compression for foamPack*
This commit is contained in:
@ -59,6 +59,7 @@ cat <<USAGE 1>&2
|
|||||||
Usage: ${0##*/} [OPTION] <archOptions>
|
Usage: ${0##*/} [OPTION] <archOptions>
|
||||||
${0##*/} [OPTION] -current
|
${0##*/} [OPTION] -current
|
||||||
options:
|
options:
|
||||||
|
-b, -bzip2 use bzip2 instead of gzip compression
|
||||||
-c, -current use current value of \$WM_OPTIONS
|
-c, -current use current value of \$WM_OPTIONS
|
||||||
-o, -output <dir> specify alternative output directory
|
-o, -output <dir> specify alternative output directory
|
||||||
|
|
||||||
@ -73,6 +74,7 @@ USAGE
|
|||||||
|
|
||||||
|
|
||||||
unset archOptions outputDir
|
unset archOptions outputDir
|
||||||
|
packExt=tgz
|
||||||
|
|
||||||
# parse options
|
# parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
@ -81,6 +83,10 @@ do
|
|||||||
-h | -help)
|
-h | -help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
-b | -bzip2)
|
||||||
|
packExt=tbz
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt'
|
-c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt'
|
||||||
archOptions="$WM_OPTIONS"
|
archOptions="$WM_OPTIONS"
|
||||||
shift
|
shift
|
||||||
@ -110,7 +116,6 @@ fi
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
timeStamp=$(date +%Y-%m-%d)
|
timeStamp=$(date +%Y-%m-%d)
|
||||||
packExt=tgz
|
|
||||||
packBase=${packDir}.${archOptions}_${timeStamp}
|
packBase=${packDir}.${archOptions}_${timeStamp}
|
||||||
|
|
||||||
# add optional output directory
|
# add optional output directory
|
||||||
@ -137,11 +142,20 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# bzip2 or gzip compression
|
||||||
|
case "$packFile" in
|
||||||
|
*tbz)
|
||||||
|
tarOpt=cpjf
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
tarOpt=cpzf
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Clean up on Ctrl-C
|
# Clean up on Ctrl-C
|
||||||
trap 'rm -f $packFile 2>/dev/null' INT
|
trap 'rm -f $packFile 2>/dev/null' INT
|
||||||
|
|
||||||
tar cpzf $packFile $dirList
|
tar $tarOpt $packFile $dirList
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "Finished packing file $packFile" 1>&2
|
echo "Finished packing file $packFile" 1>&2
|
||||||
|
|||||||
@ -56,6 +56,7 @@ usage() {
|
|||||||
cat <<USAGE 1>&2
|
cat <<USAGE 1>&2
|
||||||
Usage: ${0##*/} [OPTION]
|
Usage: ${0##*/} [OPTION]
|
||||||
options:
|
options:
|
||||||
|
-b, -bzip2 use bzip2 instead of gzip compression
|
||||||
-o, -output <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
|
||||||
@ -66,6 +67,8 @@ USAGE
|
|||||||
|
|
||||||
|
|
||||||
unset outputDir
|
unset outputDir
|
||||||
|
packExt=tgz
|
||||||
|
|
||||||
# parse options
|
# parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
@ -73,6 +76,10 @@ do
|
|||||||
-h | -help)
|
-h | -help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
-b | -bzip2)
|
||||||
|
packExt=tbz
|
||||||
|
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%%/}
|
||||||
@ -96,7 +103,6 @@ done
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
timeStamp=$(date +%Y-%m-%d)
|
timeStamp=$(date +%Y-%m-%d)
|
||||||
packExt=tgz
|
|
||||||
packBase=${packDir}.deps_${timeStamp}
|
packBase=${packDir}.deps_${timeStamp}
|
||||||
|
|
||||||
# add optional output directory
|
# add optional output directory
|
||||||
@ -116,10 +122,22 @@ Packing *.dep files into $packFile
|
|||||||
|
|
||||||
INFO
|
INFO
|
||||||
|
|
||||||
|
|
||||||
|
# bzip2 or gzip compression
|
||||||
|
case "$packFile" in
|
||||||
|
*tbz)
|
||||||
|
tarOpt=cpjf
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
tarOpt=cpzf
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
# Clean up on Ctrl-C
|
# Clean up on Ctrl-C
|
||||||
trap 'rm -f $packFile 2>/dev/null' INT
|
trap 'rm -f $packFile 2>/dev/null' INT
|
||||||
|
|
||||||
find -H $packDir -name '*.dep' -type f -print | tar cpzf $packFile -T -
|
find -H $packDir -name '*.dep' -type f -print | tar $tarOpt $packFile -T -
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
|
|||||||
@ -37,6 +37,7 @@ usage() {
|
|||||||
cat <<USAGE 1>&2
|
cat <<USAGE 1>&2
|
||||||
Usage: ${0##*/} [OPTION]
|
Usage: ${0##*/} [OPTION]
|
||||||
options:
|
options:
|
||||||
|
-b, -bzip2 use bzip2 instead of gzip compression
|
||||||
-o, -output <dir> specify alternative output directory
|
-o, -output <dir> specify alternative output directory
|
||||||
-prefix <dir> use alternative prefix
|
-prefix <dir> use alternative prefix
|
||||||
|
|
||||||
@ -46,7 +47,10 @@ USAGE
|
|||||||
exit 1
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
unset prefix outputDir
|
unset prefix outputDir
|
||||||
|
packExt=tgz
|
||||||
|
|
||||||
# parse options
|
# parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
do
|
do
|
||||||
@ -54,6 +58,10 @@ do
|
|||||||
-h | -help)
|
-h | -help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
-b | -bzip2)
|
||||||
|
packExt=tbz
|
||||||
|
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%%/}
|
||||||
@ -87,7 +95,6 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
packExt=tgz
|
|
||||||
packName=${packDir}_Doxygen
|
packName=${packDir}_Doxygen
|
||||||
|
|
||||||
# add optional output directory
|
# add optional output directory
|
||||||
@ -107,15 +114,25 @@ Packing doxygen html into $packFile
|
|||||||
|
|
||||||
INFO
|
INFO
|
||||||
|
|
||||||
|
# bzip2 or gzip compression
|
||||||
|
case "$packFile" in
|
||||||
|
*tbz)
|
||||||
|
tarOpt=cpjf
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
tarOpt=cpzf
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Clean up on Ctrl-C
|
# Clean up on Ctrl-C
|
||||||
trap 'rm -f $packFile 2>/dev/null' INT
|
trap 'rm -f $packFile 2>/dev/null' INT
|
||||||
|
|
||||||
if [ -n "$prefix" ]
|
if [ -n "$prefix" ]
|
||||||
then
|
then
|
||||||
# requires GNU tar
|
# requires GNU tar
|
||||||
tar cpzf $packFile --transform="s@^@$prefix/@" $htmlDir
|
tar $tarOpt $packFile --transform="s@^@$prefix/@" $htmlDir
|
||||||
else
|
else
|
||||||
tar cpzf $packFile $packDir/$htmlDir
|
tar $tarOpt $packFile $packDir/$htmlDir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
|
|||||||
@ -57,6 +57,7 @@ cat <<USAGE 1>&2
|
|||||||
Usage: ${0##*/} [OPTION] <archOptions>
|
Usage: ${0##*/} [OPTION] <archOptions>
|
||||||
${0##*/} [OPTION] -current
|
${0##*/} [OPTION] -current
|
||||||
options:
|
options:
|
||||||
|
-b, -bzip2 use bzip2 instead of gzip compression
|
||||||
-c, -current use current value of \$WM_OPTIONS
|
-c, -current use current value of \$WM_OPTIONS
|
||||||
-o, -output <dir> specify alternative output directory
|
-o, -output <dir> specify alternative output directory
|
||||||
|
|
||||||
@ -71,6 +72,7 @@ USAGE
|
|||||||
|
|
||||||
|
|
||||||
unset archOptions outputDir
|
unset archOptions outputDir
|
||||||
|
packExt=tgz
|
||||||
|
|
||||||
# parse options
|
# parse options
|
||||||
while [ "$#" -gt 0 ]
|
while [ "$#" -gt 0 ]
|
||||||
@ -79,6 +81,10 @@ do
|
|||||||
-h | -help)
|
-h | -help)
|
||||||
usage
|
usage
|
||||||
;;
|
;;
|
||||||
|
-b | -bzip2)
|
||||||
|
packExt=tbz
|
||||||
|
shift
|
||||||
|
;;
|
||||||
-c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt'
|
-c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt'
|
||||||
archOptions="$WM_OPTIONS"
|
archOptions="$WM_OPTIONS"
|
||||||
shift
|
shift
|
||||||
@ -108,7 +114,6 @@ fi
|
|||||||
|
|
||||||
#------------------------------------------------------------------------------
|
#------------------------------------------------------------------------------
|
||||||
timeStamp=$(date +%Y-%m-%d)
|
timeStamp=$(date +%Y-%m-%d)
|
||||||
packExt=tgz
|
|
||||||
packBase=${packDir}.Make-${archOptions}_${timeStamp}
|
packBase=${packDir}.Make-${archOptions}_${timeStamp}
|
||||||
|
|
||||||
# add optional output directory
|
# add optional output directory
|
||||||
@ -128,12 +133,24 @@ Pack and compress Make/$archOptions* directories into $packFile
|
|||||||
|
|
||||||
INFO
|
INFO
|
||||||
|
|
||||||
|
|
||||||
|
# bzip2 or gzip compression
|
||||||
|
case "$packFile" in
|
||||||
|
*tbz)
|
||||||
|
tarOpt=cpjf
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
tarOpt=cpzf
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
# Clean up on Ctrl-C
|
# Clean up on Ctrl-C
|
||||||
trap 'rm -f $packFile 2>/dev/null' INT
|
trap 'rm -f $packFile 2>/dev/null' INT
|
||||||
|
|
||||||
find -H $packDir -depth -name Make -type d -print | \
|
find -H $packDir -depth -name Make -type d -print | \
|
||||||
xargs -i find '{}' -depth -name "$archOptions*" -type d -print | \
|
xargs -i find '{}' -depth -name "$archOptions*" -type d -print | \
|
||||||
tar cpzf $packFile -T -
|
tar $tarOpt $packFile -T -
|
||||||
|
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
|
|||||||
@ -71,6 +71,8 @@ find -H $packDir \
|
|||||||
-a ! -name "*.tar" \
|
-a ! -name "*.tar" \
|
||||||
-a ! -name "*.tar.gz" \
|
-a ! -name "*.tar.gz" \
|
||||||
-a ! -name "*.tgz" \
|
-a ! -name "*.tgz" \
|
||||||
|
-a ! -name "*.tar.bz2" \
|
||||||
|
-a ! -name "*.tbz" \
|
||||||
-a ! -name "core" \
|
-a ! -name "core" \
|
||||||
-a ! -name "core.[1-9]*" \
|
-a ! -name "core.[1-9]*" \
|
||||||
-a ! -name "libccmio*" \
|
-a ! -name "libccmio*" \
|
||||||
|
|||||||
@ -78,10 +78,20 @@ INFO
|
|||||||
wc $tmpFile | awk '{print "Packing",$1,"files - this could take some time ..."}' 1>&2
|
wc $tmpFile | awk '{print "Packing",$1,"files - this could take some time ..."}' 1>&2
|
||||||
|
|
||||||
|
|
||||||
|
# bzip2 or gzip compression
|
||||||
|
case "$packFile" in
|
||||||
|
*tbz)
|
||||||
|
tarOpt=cpjf
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
tarOpt=cpzf
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Clean up on Ctrl-C
|
# Clean up on Ctrl-C
|
||||||
trap 'rm -f $packFile $tmpFile 2>/dev/null' INT
|
trap 'rm -f $packFile $tmpFile 2>/dev/null' INT
|
||||||
|
|
||||||
tar cpzf $packFile --files-from $tmpFile
|
tar $tarOpt $packFile --files-from $tmpFile
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "Finished packing $packDir into $packFile" 1>&2
|
echo "Finished packing $packDir into $packFile" 1>&2
|
||||||
|
|||||||
Reference in New Issue
Block a user