1998-07-30 14:26:54 -05:00
|
|
|
#!/bin/sh
|
2005-10-22 10:35:28 -05:00
|
|
|
#
|
2007-02-14 17:25:02 -05:00
|
|
|
# Copyright by The HDF Group.
|
2005-10-22 10:35:28 -05:00
|
|
|
# All rights reserved.
|
|
|
|
#
|
|
|
|
# This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
# terms governing use, modification, and redistribution, is contained in
|
2024-10-18 21:13:04 -07:00
|
|
|
# the LICENSE file, which can be found at the root of the source code
|
2021-02-17 08:52:36 -06:00
|
|
|
# distribution tree, or in https://www.hdfgroup.org/licenses.
|
2017-04-14 11:54:16 -05:00
|
|
|
# If you do not have access to either file, you may request a copy from
|
|
|
|
# help@hdfgroup.org.
|
2005-10-22 10:35:28 -05:00
|
|
|
#
|
1998-01-29 11:31:24 -05:00
|
|
|
|
2009-01-06 17:58:54 -05:00
|
|
|
# Make a release of hdf5.
|
1998-01-29 11:31:24 -05:00
|
|
|
|
2004-08-14 19:18:30 -05:00
|
|
|
# Function definitions
|
|
|
|
#
|
|
|
|
# Print Usage page
|
|
|
|
USAGE()
|
|
|
|
{
|
|
|
|
cat << EOF
|
2023-07-12 15:04:26 -05:00
|
|
|
Usage: $0 -d <dir> [-h] [--private] [--revision [--branch BRANCHNAME]] <methods> ...
|
2022-03-14 20:47:32 -07:00
|
|
|
-d DIR The name of the directory where the release(s) should be
|
2014-04-29 20:24:57 -05:00
|
|
|
placed.
|
2023-07-12 15:04:26 -05:00
|
|
|
--branch BRANCHNAME This is to get the correct version of the branch name from the
|
2016-12-16 17:04:56 -06:00
|
|
|
repository. BRANCHNAME for v1.8 should be hdf5_1_8.
|
2014-12-17 05:44:35 -05:00
|
|
|
-h print the help page.
|
2020-04-22 11:48:45 -05:00
|
|
|
--private Make a private release with today's date in version information.
|
2023-07-12 15:04:26 -05:00
|
|
|
--revision Make a private release with the code revision number in version information.
|
2020-04-22 11:48:45 -05:00
|
|
|
|
2014-04-29 20:24:57 -05:00
|
|
|
This must be run at the top level of the source directory.
|
2004-08-14 19:18:30 -05:00
|
|
|
The other command-line options are the names of the programs to use
|
|
|
|
for compressing the resulting tar archive (if none are given then
|
2015-03-31 12:40:43 -05:00
|
|
|
"tar" is assumed):
|
2004-08-14 19:18:30 -05:00
|
|
|
|
2020-08-01 10:26:22 -07:00
|
|
|
tar -- use tar and don't do any compressing.
|
|
|
|
gzip -- use gzip with "-9" and append ".gz" to the output name.
|
2019-01-31 14:22:52 -06:00
|
|
|
bzip2 -- use bzip2 with "-9" and append ".bz2" to the output name.
|
2020-08-01 10:26:22 -07:00
|
|
|
zip -- convert all text files to DOS style and form a zip file for Windows use.
|
2006-02-15 15:37:00 -05:00
|
|
|
doc -- produce the latest doc tree in addition to the archive.
|
2004-08-14 19:18:30 -05:00
|
|
|
|
2023-09-22 14:25:08 -05:00
|
|
|
A sha256 checksum is produced for each archive created and stored in a corresponding sha256 file.
|
2015-03-31 12:40:43 -05:00
|
|
|
|
2004-08-14 19:18:30 -05:00
|
|
|
Examples:
|
|
|
|
|
2014-04-29 20:24:57 -05:00
|
|
|
$ bin/release -d /tmp
|
|
|
|
/tmp/hdf5-1.8.13-RELEASE.txt
|
|
|
|
/tmp/hdf5-1.8.13.tar
|
2023-09-22 14:25:08 -05:00
|
|
|
/tmp/hdf5-1.8.13.tar.sha256
|
2004-08-14 19:18:30 -05:00
|
|
|
|
2014-04-29 20:24:57 -05:00
|
|
|
$ bin/release -d /tmp gzip
|
|
|
|
/tmp/hdf5-1.8.13-RELEASE.txt
|
2023-09-22 14:25:08 -05:00
|
|
|
/tmp/hdf5-1.8.13.tar
|
|
|
|
/tmp/hdf5-1.8.13.tar.sha256
|
2014-04-29 20:24:57 -05:00
|
|
|
/tmp/hdf5-1.8.13.tar.gz
|
2023-09-22 14:25:08 -05:00
|
|
|
/tmp/hdf5-1.8.13.tar.gz.sha256
|
2004-08-14 19:18:30 -05:00
|
|
|
|
2015-03-31 12:40:43 -05:00
|
|
|
$ bin/release -d /tmp tar gzip zip
|
2014-04-29 20:24:57 -05:00
|
|
|
/tmp/hdf5-1.8.13-RELEASE.txt
|
|
|
|
/tmp/hdf5-1.8.13.tar
|
2023-09-22 14:25:08 -05:00
|
|
|
/tmp/hdf5-1.8.13.tar.sha256
|
2014-04-29 20:24:57 -05:00
|
|
|
/tmp/hdf5-1.8.13.tar.gz
|
2023-09-22 14:25:08 -05:00
|
|
|
/tmp/hdf5-1.8.13.tar.gz.sha256
|
|
|
|
/tmp/hdf5-1.8.13.zip
|
|
|
|
/tmp/hdf5-1.8.13.zip.sha256
|
|
|
|
|
|
|
|
The integrity of a downloaded file can be verified on Linux platforms by running
|
|
|
|
"sha256sum --check <filename>.sha256, which will display 'OK' if the calculated
|
|
|
|
checksum of <filename> matches the checksum in <filename>.sha256.
|
2004-08-14 19:18:30 -05:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2014-04-24 16:38:54 -05:00
|
|
|
# Function name: tar2zip
|
|
|
|
# Convert the release tarball to a Windows zipball.
|
|
|
|
#
|
|
|
|
# Steps:
|
2017-02-21 15:18:17 -06:00
|
|
|
# 1. untar the tarball in a temporary directory;
|
2014-04-24 16:38:54 -05:00
|
|
|
# Note: do this in a temporary directory to avoid changing
|
2017-02-21 15:18:17 -06:00
|
|
|
# the original source directory which may be around.
|
2014-04-24 16:38:54 -05:00
|
|
|
# 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
|
2020-08-01 10:26:22 -07:00
|
|
|
echo "usage: tar2zip <tarfilename> <zipfilename>"
|
|
|
|
return 1
|
2014-04-24 16:38:54 -05:00
|
|
|
fi
|
2017-02-21 15:18:17 -06:00
|
|
|
ztmpdir=/tmp/ztmpdir$$
|
2014-04-29 20:24:57 -05:00
|
|
|
mkdir -p $ztmpdir
|
2014-04-24 16:38:54 -05:00
|
|
|
version=$1
|
|
|
|
tarfile=$2
|
|
|
|
zipfile=$3
|
|
|
|
|
2014-04-29 20:24:57 -05:00
|
|
|
# step 1: untar tarball in ztmpdir
|
|
|
|
(cd $ztmpdir; tar xf -) < $tarfile
|
2014-04-24 16:38:54 -05:00
|
|
|
# sanity check
|
2014-04-29 20:24:57 -05:00
|
|
|
if [ ! -d $ztmpdir/$version ]; then
|
2020-08-01 10:26:22 -07:00
|
|
|
echo "untar did not create $ztmpdir/$version source dir"
|
|
|
|
# cleanup
|
|
|
|
rm -rf $ztmpdir
|
|
|
|
return 1
|
2014-04-24 16:38:54 -05:00
|
|
|
fi
|
|
|
|
# step 2: convert text files
|
|
|
|
# There maybe a simpler way to do this.
|
|
|
|
# options used in unix2dos:
|
2020-04-22 11:48:45 -05:00
|
|
|
# -k Keep the date stamp
|
2014-04-24 16:38:54 -05:00
|
|
|
# -q quiet mode
|
|
|
|
# grep redirect output to /dev/null because -q or -s are not portable.
|
2014-04-29 20:24:57 -05:00
|
|
|
find $ztmpdir/$version | \
|
2020-08-01 10:26:22 -07:00
|
|
|
while read inf; do \
|
|
|
|
if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \
|
|
|
|
unix2dos -q -k $inf; \
|
|
|
|
fi\
|
|
|
|
done
|
2014-04-24 16:38:54 -05:00
|
|
|
# step 3: make zipball
|
|
|
|
# -9 maximum compression
|
|
|
|
# -y Store symbolic links as such in the zip archive
|
|
|
|
# -r recursive
|
|
|
|
# -q quiet
|
2014-04-29 20:24:57 -05:00
|
|
|
(cd $ztmpdir; zip -9 -y -r -q $version.zip $version)
|
|
|
|
mv $ztmpdir/$version.zip $zipfile
|
2014-04-24 16:38:54 -05:00
|
|
|
|
|
|
|
# cleanup
|
2014-04-29 20:24:57 -05:00
|
|
|
rm -rf $ztmpdir
|
2014-04-24 16:38:54 -05:00
|
|
|
}
|
|
|
|
|
2006-02-06 22:49:32 -05:00
|
|
|
|
1998-07-30 14:26:54 -05:00
|
|
|
# Defaults
|
|
|
|
DEST=releases
|
1999-01-07 06:37:42 -05:00
|
|
|
VERS=`perl bin/h5vers`
|
2004-08-14 19:18:30 -05:00
|
|
|
VERS_OLD=
|
1998-07-30 14:26:54 -05:00
|
|
|
test "$VERS" || exit 1
|
|
|
|
verbose=yes
|
2011-06-15 17:58:13 -05:00
|
|
|
release_date=`date +%F`
|
2004-08-14 19:18:30 -05:00
|
|
|
today=`date +%Y%m%d`
|
|
|
|
pmode='no'
|
2023-07-12 15:04:26 -05:00
|
|
|
revmode='no'
|
2020-08-01 10:26:22 -07:00
|
|
|
tmpdir="../#release_tmp.$$" # tmp work directory
|
2004-08-14 19:18:30 -05:00
|
|
|
|
|
|
|
# Restore previous Version information
|
|
|
|
RESTORE_VERSION()
|
|
|
|
{
|
|
|
|
if [ X-${VERS_OLD} != X- ]; then
|
2020-08-01 10:26:22 -07:00
|
|
|
echo restoring version information back to $VERS_OLD
|
|
|
|
rm -f config/lt_vers.am
|
|
|
|
cp $tmpdir/lt_vers.am config/lt_vers.am
|
|
|
|
bin/h5vers -s $VERS_OLD
|
|
|
|
VERS_OLD=
|
2004-08-14 19:18:30 -05:00
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
1998-07-30 14:26:54 -05:00
|
|
|
|
|
|
|
# Command-line arguments
|
1999-06-02 08:59:35 -05:00
|
|
|
while [ -n "$1" ]; do
|
|
|
|
arg=$1
|
1998-07-30 14:26:54 -05:00
|
|
|
shift
|
1999-06-02 08:59:35 -05:00
|
|
|
case "$arg" in
|
2020-08-01 10:26:22 -07:00
|
|
|
-d)
|
|
|
|
DEST=$1
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
-h)
|
|
|
|
USAGE
|
|
|
|
exit 0
|
|
|
|
;;
|
|
|
|
--private)
|
|
|
|
pmode=yes
|
|
|
|
;;
|
2023-07-12 15:04:26 -05:00
|
|
|
--revision)
|
|
|
|
revmode=yes
|
|
|
|
;;
|
|
|
|
--branch)
|
|
|
|
BRANCHNAME=$1
|
2016-12-16 17:04:56 -06:00
|
|
|
shift
|
|
|
|
;;
|
2020-08-01 10:26:22 -07:00
|
|
|
-*)
|
|
|
|
echo "Unknown switch: $arg" 1>&2
|
|
|
|
USAGE
|
|
|
|
exit 1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
methods="$methods $arg"
|
|
|
|
;;
|
1999-06-02 08:59:35 -05:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2015-03-31 12:40:43 -05:00
|
|
|
# Default method is tar
|
1998-07-30 14:26:54 -05:00
|
|
|
if [ "X$methods" = "X" ]; then
|
2015-03-31 12:40:43 -05:00
|
|
|
methods="tar"
|
1998-07-30 14:26:54 -05:00
|
|
|
fi
|
1999-06-02 08:59:35 -05:00
|
|
|
|
2021-12-07 08:27:29 -06:00
|
|
|
# Create the temporary work directory.
|
2006-01-04 12:38:30 -05:00
|
|
|
if mkdir $tmpdir; then
|
|
|
|
echo "temporary work directory for release. "\
|
2006-02-20 11:38:05 -05:00
|
|
|
"Can be deleted after release completes." > $tmpdir/README
|
2006-01-04 12:38:30 -05:00
|
|
|
else
|
|
|
|
echo "Failed to mkdir tmpdir($tmpdir)"
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2004-08-14 19:18:30 -05:00
|
|
|
# setup restoration in case of abort.
|
|
|
|
trap RESTORE_VERSION 0
|
|
|
|
|
|
|
|
if [ X$pmode = Xyes ]; then
|
|
|
|
VERS_OLD=$VERS
|
2006-02-01 17:26:14 -05:00
|
|
|
# Copy old version of config/lt_vers.am, since it's hard to
|
|
|
|
# "undo" changes to it.
|
|
|
|
cp config/lt_vers.am $tmpdir
|
2004-08-14 19:18:30 -05:00
|
|
|
# Set version information to m.n.r-of$today.
|
|
|
|
# (h5vers does not correctly handle just m.n.r-$today.)
|
|
|
|
VERS=`echo $VERS | sed -e s/-.*//`-of$today
|
|
|
|
echo Private release of $VERS
|
|
|
|
bin/h5vers -s $VERS
|
|
|
|
fi
|
1999-06-02 08:59:35 -05:00
|
|
|
|
2023-07-12 15:04:26 -05:00
|
|
|
if [ X$revmode = Xyes ]; then
|
|
|
|
VERS_OLD=$VERS
|
|
|
|
echo "Save old version $VERS_OLD for restoration later."
|
|
|
|
# Copy old version of config/lt_vers.am, since it's hard to
|
|
|
|
# "undo" changes to it.
|
|
|
|
cp config/lt_vers.am $tmpdir
|
|
|
|
if [ "${BRANCHNAME}" = "" ]; then
|
|
|
|
BRANCHNAME=`git symbolic-ref -q --short HEAD`
|
|
|
|
fi
|
|
|
|
revision=`git rev-parse --short HEAD`
|
|
|
|
# Set version information to m.n.r-r$revision.
|
|
|
|
# (h5vers does not correctly handle just m.n.r-$today.)
|
|
|
|
VERS=`echo $VERS | sed -e s/-.*//`-$revision
|
|
|
|
echo Private release of $VERS
|
|
|
|
HDF5_VERS=hdf5-$BRANCHNAME-$revision
|
|
|
|
echo file base of $HDF5_VERS
|
|
|
|
bin/h5vers -s $VERS
|
|
|
|
# use a generic directory name for revision releases
|
|
|
|
HDF5_IN_VERS=hdfsrc
|
|
|
|
else
|
|
|
|
# Store hdf5-$VERS ("hdf5-1.7.51", e.g.) to a variable to avoid typos
|
|
|
|
HDF5_VERS=hdf5-$VERS
|
|
|
|
# directory name matches tar file name for non-revision releases
|
|
|
|
HDF5_IN_VERS=$HDF5_VERS
|
|
|
|
fi
|
2005-09-07 15:20:37 -05:00
|
|
|
|
|
|
|
test "$verbose" && echo "Releasing $HDF5_VERS to $DEST" 1>&2
|
1998-07-30 14:26:54 -05:00
|
|
|
if [ ! -d $DEST ]; then
|
|
|
|
echo " Destination directory $DEST does not exist" 1>&2
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2022-03-14 20:47:32 -07:00
|
|
|
# Create a symlink to the source so files in the tarball have the prefix
|
|
|
|
# we want (gnu's --transform isn't portable)
|
2023-07-12 15:04:26 -05:00
|
|
|
ln -s `pwd` $tmpdir/$HDF5_IN_VERS || exit 1
|
2022-03-14 20:47:32 -07:00
|
|
|
|
2022-01-14 17:28:04 -06:00
|
|
|
# Update README.md and release_docs/RELEASE.txt with release information in
|
2009-01-06 17:58:54 -05:00
|
|
|
# line 1.
|
2024-04-19 11:03:07 -05:00
|
|
|
for f in README.md release_docs/RELEASE.txt release_docs/NEWSLETTER.txt; do
|
2011-06-15 17:58:13 -05:00
|
|
|
echo "HDF5 version $VERS released on $release_date" >$f.x
|
2009-01-06 17:58:54 -05:00
|
|
|
sed -e 1d $f >>$f.x
|
2001-07-06 00:43:38 -05:00
|
|
|
mv $f.x $f
|
|
|
|
# Make sure new files are of the right access mode
|
|
|
|
chmod 644 $f
|
|
|
|
done
|
|
|
|
|
2001-05-10 10:02:00 -05:00
|
|
|
# Create the tar file
|
1998-07-30 14:26:54 -05:00
|
|
|
test "$verbose" && echo " Running tar..." 1>&2
|
2025-03-14 13:28:44 -05:00
|
|
|
(cd "$tmpdir" && exec tar -ch --exclude-vcs --exclude=.clang-format --exclude=.codespellrc --exclude=.devcontainer --exclude=.git* --exclude=.h5chkright.ini -f "$HDF5_VERS.tar" "./$HDF5_IN_VERS" || exit 1 )
|
1998-07-30 14:26:54 -05:00
|
|
|
|
|
|
|
# Compress
|
2023-09-22 14:25:08 -05:00
|
|
|
#SHA256=$HDF5_VERS.sha256
|
2022-12-14 08:58:20 -06:00
|
|
|
cp /dev/null $DEST/$SHA256
|
1998-07-30 14:26:54 -05:00
|
|
|
for comp in $methods; do
|
|
|
|
case $comp in
|
2020-08-01 10:26:22 -07:00
|
|
|
tar)
|
|
|
|
cp -p $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.tar
|
2023-09-22 14:25:08 -05:00
|
|
|
(cd $DEST; sha256sum $HDF5_VERS.tar > $HDF5_VERS.tar.sha256)
|
2020-08-01 10:26:22 -07:00
|
|
|
;;
|
|
|
|
gzip)
|
|
|
|
test "$verbose" && echo " Running gzip..." 1>&2
|
|
|
|
gzip -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.gz
|
2023-09-22 14:25:08 -05:00
|
|
|
(cd $DEST; sha256sum $HDF5_VERS.tar.gz > $HDF5_VERS.tar.gz.sha256)
|
2020-08-01 10:26:22 -07:00
|
|
|
;;
|
|
|
|
bzip2)
|
|
|
|
test "$verbose" && echo " Running bzip2..." 1>&2
|
|
|
|
bzip2 -9 <$tmpdir/$HDF5_VERS.tar >$DEST/$HDF5_VERS.tar.bz2
|
2023-09-22 14:25:08 -05:00
|
|
|
(cd $DEST; sha256sum $HDF5_VERS.tar.bz2 > $HDF5_VERS.tar.bz2.sha256)
|
2020-08-01 10:26:22 -07:00
|
|
|
;;
|
|
|
|
zip)
|
|
|
|
test "$verbose" && echo " Creating zip ball..." 1>&2
|
2023-07-13 12:17:52 -05:00
|
|
|
tar2zip $HDF5_IN_VERS $tmpdir/$HDF5_VERS.tar $DEST/$HDF5_VERS.zip 1>&2
|
2023-09-22 14:25:08 -05:00
|
|
|
(cd $DEST; sha256sum $HDF5_VERS.zip > $HDF5_VERS.zip.sha256)
|
2019-02-01 10:21:53 -06:00
|
|
|
;;
|
2020-08-01 10:26:22 -07:00
|
|
|
*)
|
|
|
|
echo "***Error*** Unknown method $comp"
|
|
|
|
exit 1
|
|
|
|
;;
|
1998-07-30 14:26:54 -05:00
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
2001-07-06 00:43:38 -05:00
|
|
|
# Copy the RELEASE.txt to the release area.
|
2005-09-07 15:20:37 -05:00
|
|
|
cp release_docs/RELEASE.txt $DEST/$HDF5_VERS-RELEASE.txt
|
2001-05-10 10:02:00 -05:00
|
|
|
|
2004-08-14 19:18:30 -05:00
|
|
|
# Restore OLD version information, then no need for trap.
|
2023-07-12 15:04:26 -05:00
|
|
|
if [ X$pmode = Xyes ] || [ X$revmode = Xyes ]; then
|
|
|
|
echo "Restore the original version $VERS_OLD"
|
2004-08-14 19:18:30 -05:00
|
|
|
RESTORE_VERSION
|
|
|
|
trap 0
|
|
|
|
fi
|
|
|
|
|
2006-02-01 17:26:14 -05:00
|
|
|
# Remove temporary things
|
2006-02-15 15:30:51 -05:00
|
|
|
rm -rf $tmpdir
|
2006-02-01 17:26:14 -05:00
|
|
|
|
2022-03-14 20:47:32 -07:00
|
|
|
echo "DONE"
|
|
|
|
|
1998-07-30 14:26:54 -05:00
|
|
|
exit 0
|