Skip to content
Snippets Groups Projects
Commit dd22de68 authored by Mark Olesen's avatar Mark Olesen
Browse files

ENH: support bzip2 compression for foamPack*

parent 449a0e25
Branches
Tags
No related merge requests found
......@@ -59,6 +59,7 @@ cat <<USAGE 1>&2
Usage: ${0##*/} [OPTION] <archOptions>
${0##*/} [OPTION] -current
options:
-b, -bzip2 use bzip2 instead of gzip compression
-c, -current use current value of \$WM_OPTIONS
-o, -output <dir> specify alternative output directory
......@@ -73,6 +74,7 @@ USAGE
unset archOptions outputDir
packExt=tgz
# parse options
while [ "$#" -gt 0 ]
......@@ -81,6 +83,10 @@ do
-h | -help)
usage
;;
-b | -bzip2)
packExt=tbz
shift
;;
-c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt'
archOptions="$WM_OPTIONS"
shift
......@@ -110,7 +116,6 @@ fi
#------------------------------------------------------------------------------
timeStamp=$(date +%Y-%m-%d)
packExt=tgz
packBase=${packDir}.${archOptions}_${timeStamp}
# add optional output directory
......@@ -137,11 +142,20 @@ else
exit 1
fi
# bzip2 or gzip compression
case "$packFile" in
*tbz)
tarOpt=cpjf
;;
*)
tarOpt=cpzf
;;
esac
# Clean up on Ctrl-C
trap 'rm -f $packFile 2>/dev/null' INT
tar cpzf $packFile $dirList
tar $tarOpt $packFile $dirList
if [ $? -eq 0 ]
then
echo "Finished packing file $packFile" 1>&2
......
......@@ -56,6 +56,7 @@ usage() {
cat <<USAGE 1>&2
Usage: ${0##*/} [OPTION]
options:
-b, -bzip2 use bzip2 instead of gzip compression
-o, -output <dir> specify alternative output directory
* Pack and compress *.dep files from $codeBase
......@@ -66,6 +67,8 @@ USAGE
unset outputDir
packExt=tgz
# parse options
while [ "$#" -gt 0 ]
do
......@@ -73,6 +76,10 @@ do
-h | -help)
usage
;;
-b | -bzip2)
packExt=tbz
shift
;;
-o | -output)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
outputDir=${2%%/}
......@@ -96,7 +103,6 @@ done
#------------------------------------------------------------------------------
timeStamp=$(date +%Y-%m-%d)
packExt=tgz
packBase=${packDir}.deps_${timeStamp}
# add optional output directory
......@@ -116,10 +122,22 @@ Packing *.dep files into $packFile
INFO
# bzip2 or gzip compression
case "$packFile" in
*tbz)
tarOpt=cpjf
;;
*)
tarOpt=cpzf
;;
esac
# Clean up on Ctrl-C
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 ]
then
......
......@@ -37,6 +37,7 @@ usage() {
cat <<USAGE 1>&2
Usage: ${0##*/} [OPTION]
options:
-b, -bzip2 use bzip2 instead of gzip compression
-o, -output <dir> specify alternative output directory
-prefix <dir> use alternative prefix
......@@ -46,7 +47,10 @@ USAGE
exit 1
}
unset prefix outputDir
packExt=tgz
# parse options
while [ "$#" -gt 0 ]
do
......@@ -54,6 +58,10 @@ do
-h | -help)
usage
;;
-b | -bzip2)
packExt=tbz
shift
;;
-o | -output)
[ "$#" -ge 2 ] || usage "'$1' option requires an argument"
outputDir=${2%%/}
......@@ -87,7 +95,6 @@ then
fi
#------------------------------------------------------------------------------
packExt=tgz
packName=${packDir}_Doxygen
# add optional output directory
......@@ -107,15 +114,25 @@ Packing doxygen html into $packFile
INFO
# bzip2 or gzip compression
case "$packFile" in
*tbz)
tarOpt=cpjf
;;
*)
tarOpt=cpzf
;;
esac
# Clean up on Ctrl-C
trap 'rm -f $packFile 2>/dev/null' INT
if [ -n "$prefix" ]
then
# requires GNU tar
tar cpzf $packFile --transform="s@^@$prefix/@" $htmlDir
tar $tarOpt $packFile --transform="s@^@$prefix/@" $htmlDir
else
tar cpzf $packFile $packDir/$htmlDir
tar $tarOpt $packFile $packDir/$htmlDir
fi
if [ $? -eq 0 ]
......
......@@ -57,6 +57,7 @@ cat <<USAGE 1>&2
Usage: ${0##*/} [OPTION] <archOptions>
${0##*/} [OPTION] -current
options:
-b, -bzip2 use bzip2 instead of gzip compression
-c, -current use current value of \$WM_OPTIONS
-o, -output <dir> specify alternative output directory
......@@ -71,6 +72,7 @@ USAGE
unset archOptions outputDir
packExt=tgz
# parse options
while [ "$#" -gt 0 ]
......@@ -79,6 +81,10 @@ do
-h | -help)
usage
;;
-b | -bzip2)
packExt=tbz
shift
;;
-c | -current) # use $WM_OPTIONS - eg, 'linux64GccDPOpt'
archOptions="$WM_OPTIONS"
shift
......@@ -108,7 +114,6 @@ fi
#------------------------------------------------------------------------------
timeStamp=$(date +%Y-%m-%d)
packExt=tgz
packBase=${packDir}.Make-${archOptions}_${timeStamp}
# add optional output directory
......@@ -128,12 +133,24 @@ Pack and compress Make/$archOptions* directories into $packFile
INFO
# bzip2 or gzip compression
case "$packFile" in
*tbz)
tarOpt=cpjf
;;
*)
tarOpt=cpzf
;;
esac
# Clean up on Ctrl-C
trap 'rm -f $packFile 2>/dev/null' INT
find -H $packDir -depth -name Make -type d -print | \
xargs -i find '{}' -depth -name "$archOptions*" -type d -print | \
tar cpzf $packFile -T -
tar $tarOpt $packFile -T -
if [ $? -eq 0 ]
then
......
......@@ -71,6 +71,8 @@ find -H $packDir \
-a ! -name "*.tar" \
-a ! -name "*.tar.gz" \
-a ! -name "*.tgz" \
-a ! -name "*.tar.bz2" \
-a ! -name "*.tbz" \
-a ! -name "core" \
-a ! -name "core.[1-9]*" \
-a ! -name "libccmio*" \
......
......@@ -78,10 +78,20 @@ INFO
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
trap 'rm -f $packFile $tmpFile 2>/dev/null' INT
tar cpzf $packFile --files-from $tmpFile
tar $tarOpt $packFile --files-from $tmpFile
if [ $? -eq 0 ]
then
echo "Finished packing $packDir into $packFile" 1>&2
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment