summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorAlbert Cheng <acheng@hdfgroup.org>2014-04-24 21:38:54 (GMT)
committerAlbert Cheng <acheng@hdfgroup.org>2014-04-24 21:38:54 (GMT)
commitead005cc27f05e2b1497c3651524b7151c9fc48a (patch)
tree9121d5b4e3fbfaeb8c35e420cdb75b7c9a2b8541 /bin
parent3bdb11694298551dd1124d36497ac3955c91ba98 (diff)
downloadhdf5-ead005cc27f05e2b1497c3651524b7151c9fc48a.zip
hdf5-ead005cc27f05e2b1497c3651524b7151c9fc48a.tar.gz
hdf5-ead005cc27f05e2b1497c3651524b7151c9fc48a.tar.bz2
[svn-r25096] Bug: HDFFV-8433
Need to unify Windows release process (zip file) and Unix release process (bin/release-> tarfile) Solution: Added a new option (zip) to generate Windows zip file from the release tarball. Tested: by hand running "bin/release ... gzip zip" to verify zip file looks right. Allen and Dana then confirmed the zip file can be used to build and test HDF5 library without error.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/release72
-rwxr-xr-xbin/snapshot2
2 files changed, 73 insertions, 1 deletions
diff --git a/bin/release b/bin/release
index be8eb14..e8e54bd 100755
--- a/bin/release
+++ b/bin/release
@@ -56,6 +56,7 @@ for compressing the resulting tar archive (if none are given then
compress -- use compress and append ".Z" to the output name.
gzip -- use gzip with "-9" and append ".gz" to the output name.
bzip2 -- use bzip2 with "-9" and append ".bz2" to the output name.
+ zip -- convert all text files to DOS style and form a zip file for Windows use.
md5 -- produce a md5 checksum in addition to the archive.
doc -- produce the latest doc tree in addition to the archive.
@@ -79,6 +80,73 @@ EOF
}
+# Function name: tar2zip
+# Convert the release tarball to a Windows zipball.
+#
+# Programmer: Albert Cheng
+# Creation date: 2014-04-23
+#
+# Modifications
+#
+# Steps:
+# 1. untar the tarball in a temporay directory;
+# Note: do this in a temporary directory to avoid changing
+# the original source directory which maybe around.
+# 2. convert all its text files to DOS (LF-CR) style;
+# 3. form a zip file which is usable by Windows users.
+#
+# Parameters:
+# $1 version
+# $2 release tarball
+# $3 output zipball file name
+#
+# Returns 0 if successful; 1 otherwise
+#
+tar2zip()
+{
+ if [ $# -ne 3 ]; then
+ echo "usage: tar2zip <tarfilename> <zipfilename>"
+ return 1
+ fi
+ tmpdir=/tmp/tmpdir$$
+ mkdir -p $tmpdir
+ version=$1
+ tarfile=$2
+ zipfile=$3
+
+ # step 1: untar tarball in tmpdir
+ (cd $tmpdir; tar xf -) < $tarfile
+ # sanity check
+ if [ ! -d $tmpdir/$version ]; then
+ echo "untar did not create $tmp/$version source dir"
+ # cleanup
+ rm -rf $tmpdir
+ return 1
+ fi
+ # step 2: convert text files
+ # There maybe a simpler way to do this.
+ # options used in unix2dos:
+ # -k Keep the date stamp
+ # -q quiet mode
+ # grep redirect output to /dev/null because -q or -s are not portable.
+ find $tmpdir/$version | \
+ while read inf; do \
+ if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \
+ unix2dos -q -k $inf; \
+ fi\
+ done
+ # step 3: make zipball
+ # -9 maximum compression
+ # -y Store symbolic links as such in the zip archive
+ # -r recursive
+ # -q quiet
+ (cd $tmpdir; zip -9 -y -r -q $version.zip $version)
+ mv $tmpdir/$version.zip $zipfile
+
+ # cleanup
+ rm -rf $tmpdir
+}
+
# This command must be run at the top level of the hdf5 source directory.
# Verify this requirement.
if [ ! \( -f configure -a -f bin/release \) ]; then
@@ -237,6 +305,10 @@ for comp in $methods; do
test "$verbose" && echo " Running bzip2..." 1>&2
bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2
;;
+ zip)
+ test "$verbose" && echo " Creating zip ball..." 1>&2
+ tar2zip $HDF5_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2
+ ;;
md5)
test "$verbose" && echo " Creating checksum..." 1>&2
(cd $tmpdir; md5sum $HDF5_VERS.tar ) > $DEST/$HDF5_VERS.tar.md5
diff --git a/bin/snapshot b/bin/snapshot
index bb02595..b4adf5e 100755
--- a/bin/snapshot
+++ b/bin/snapshot
@@ -68,7 +68,7 @@ ZLIB_default=
ZLIB=$ZLIB_default
# What compression methods to use? (md5 does checksum).
-METHODS="gzip bzip2 md5 doc"
+METHODS="gzip zip bzip2 md5 doc"
# Use User's MAKE if set. Else use generic make.
MAKE=${MAKE:-make}