| 1 |
#!/bin/sh |
| 2 |
# |
| 3 |
# Copyright by The HDF Group. |
| 4 |
# Copyright by the Board of Trustees of the University of Illinois. |
| 5 |
# All rights reserved. |
| 6 |
# |
| 7 |
# This file is part of HDF. The full HDF copyright notice, including |
| 8 |
# terms governing use, modification, and redistribution, is contained in |
| 9 |
# the COPYING file, which can be found at the root of the source code |
| 10 |
# distribution tree, or in https://www.hdfgroup.org/licenses. |
| 11 |
# If you do not have access to either file, you may request a copy from |
| 12 |
# [email protected]. |
| 13 |
# |
| 14 |
|
| 15 |
# Make a release of hdf4. |
| 16 |
|
| 17 |
# Function definitions |
| 18 |
# |
| 19 |
# Print Usage page |
| 20 |
USAGE() |
| 21 |
{ |
| 22 |
cat << EOF |
| 23 |
Usage: $0 -d <dir> [-h] [--private] [--revision [--branch BRANCHNAME]] <methods> ... |
| 24 |
-d DIR The name of the directory where the release(s) should be |
| 25 |
placed. |
| 26 |
--branch BRANCHNAME This is to get the correct version of the branch name from the |
| 27 |
repository. BRANCHNAME for v4.2.16 should be hdf4_2_16. |
| 28 |
-h print the help page. |
| 29 |
--private Make a private release with today's date in version information. |
| 30 |
--revision Make a private release with the code revision number in version information. |
| 31 |
|
| 32 |
This must be run at the top level of the source directory. |
| 33 |
The other command-line options are the names of the programs to use |
| 34 |
for compressing the resulting tar archive (if none are given then |
| 35 |
"tar" is assumed): |
| 36 |
|
| 37 |
tar -- use tar and don't do any compressing. |
| 38 |
gzip -- use gzip with "-9" and append ".gz" to the output name. |
| 39 |
bzip2 -- use bzip2 with "-9" and append ".bz2" to the output name. |
| 40 |
zip -- convert all text files to DOS style and form a zip file for Windows use. |
| 41 |
cmake-tgz -- create a tar file using the gzip default level with a build-unix.sh |
| 42 |
command file and all other CMake files needed to build HDF4 source |
| 43 |
using CMake on unix machines. |
| 44 |
cmake-zip -- convert all text files to DOS style and create a zip file including cmake |
| 45 |
scripts and .bat files to build HDF4 source using CMake on Windows. |
| 46 |
|
| 47 |
A sha256 checksum is produced for each archive created and stored in the sha256 file. |
| 48 |
|
| 49 |
Examples: |
| 50 |
|
| 51 |
$ bin/release -d /tmp |
| 52 |
/tmp/hdf-4.2.15-RELEASE.txt |
| 53 |
/tmp/hdf-4.2.15.sha256 |
| 54 |
/tmp/hdf-4.2.15.tar |
| 55 |
|
| 56 |
$ bin/release -d /tmp gzip |
| 57 |
/tmp/hdf-4.2.15-RELEASE.txt |
| 58 |
/tmp/hdf-4.2.15.sha256 |
| 59 |
/tmp/hdf-4.2.15.tar.gz |
| 60 |
|
| 61 |
$ bin/release -d /tmp tar gzip zip |
| 62 |
/tmp/hdf-4.2.15-RELEASE.txt |
| 63 |
/tmp/hdf-4.2.15.sha256 |
| 64 |
/tmp/hdf-4.2.15.tar |
| 65 |
/tmp/hdf-4.2.15.tar.gz |
| 66 |
/tmp/hdf-4.2.15.zip |
| 67 |
|
| 68 |
EOF |
| 69 |
|
| 70 |
} |
| 71 |
|
| 72 |
# Function name: tar2zip |
| 73 |
# Convert the release tarball to a Windows zipball. |
| 74 |
# |
| 75 |
# Steps: |
| 76 |
# 1. untar the tarball in a temporary directory; |
| 77 |
# Note: do this in a temporary directory to avoid changing |
| 78 |
# the original source directory which may be around. |
| 79 |
# 2. convert all its text files to DOS (LF-CR) style; |
| 80 |
# 3. form a zip file which is usable by Windows users. |
| 81 |
# |
| 82 |
# Parameters: |
| 83 |
# $1 version |
| 84 |
# $2 release tarball |
| 85 |
# $3 output zipball file name |
| 86 |
# |
| 87 |
# Returns 0 if successful; 1 otherwise |
| 88 |
# |
| 89 |
tar2zip() |
| 90 |
{ |
| 91 |
if [ $# -ne 3 ]; then |
| 92 |
echo "usage: tar2zip <tarfilename> <zipfilename>" |
| 93 |
return 1 |
| 94 |
fi |
| 95 |
ztmpdir=/tmp/ztmpdir$$ |
| 96 |
mkdir -p $ztmpdir |
| 97 |
version=$1 |
| 98 |
tarfile=$2 |
| 99 |
zipfile=$3 |
| 100 |
|
| 101 |
# step 1: untar tarball in ztmpdir |
| 102 |
(cd $ztmpdir; tar xf -) < $tarfile |
| 103 |
# sanity check |
| 104 |
if [ ! -d $ztmpdir/$version ]; then |
| 105 |
echo "untar did not create $ztmpdir/$version source dir" |
| 106 |
# cleanup |
| 107 |
rm -rf $ztmpdir |
| 108 |
return 1 |
| 109 |
fi |
| 110 |
# step 2: convert text files |
| 111 |
# There maybe a simpler way to do this. |
| 112 |
# options used in unix2dos: |
| 113 |
# -k Keep the date stamp |
| 114 |
# -q quiet mode |
| 115 |
# grep redirect output to /dev/null because -q or -s are not portable. |
| 116 |
find $ztmpdir/$version | \ |
| 117 |
while read inf; do \ |
| 118 |
if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \ |
| 119 |
unix2dos -q -k $inf; \ |
| 120 |
fi\ |
| 121 |
done |
| 122 |
# step 3: make zipball |
| 123 |
# -9 maximum compression |
| 124 |
# -y Store symbolic links as such in the zip archive |
| 125 |
# -r recursive |
| 126 |
# -q quiet |
| 127 |
(cd $ztmpdir; zip -9 -y -r -q $version.zip $version) |
| 128 |
mv $ztmpdir/$version.zip $zipfile |
| 129 |
|
| 130 |
# cleanup |
| 131 |
rm -rf $ztmpdir |
| 132 |
} |
| 133 |
|
| 134 |
# Function name: tar2cmakezip |
| 135 |
# Convert the release tarball to a Windows zipball with files to run CMake build. |
| 136 |
# |
| 137 |
# Steps: |
| 138 |
# 1. untar the tarball in a temporary directory; |
| 139 |
# Note: do this in a temporary directory to avoid changing |
| 140 |
# the original source directory which may be around. |
| 141 |
# 2. add build-unix.sh script. |
| 142 |
# 3. add LIBAEC.tar.gz, ZLib.tar.gz and cmake files to top level directory. |
| 143 |
# 4. create gzipped tar file with these contents: |
| 144 |
# build-unix.sh script |
| 145 |
# hdf4-<version> source code directory extracted from tar file |
| 146 |
# CTestScript.cmake cmake file copied from <hdf4 source code>/config/cmake/scripts |
| 147 |
# HDF4config.cmake cmake file copied from <hdf4 source code>/config/cmake/scripts |
| 148 |
# HDF4options.cmake cmake file copied from <hdf4 source code>/config/cmake/scripts |
| 149 |
# LIBAEC.tar.gz copied from /mnt/scr1/pre-release/hdf4/CMake |
| 150 |
# ZLib.tar.gz copied from /mnt/scr1/pre-release/hdf4/CMake |
| 151 |
# JPEG9e.tar.gz copied from /mnt/scr1/pre-release/hdf4/CMake |
| 152 |
|
| 153 |
|
| 154 |
# Parameters: |
| 155 |
# $1 version |
| 156 |
# $2 release tarball |
| 157 |
# $3 output zipball file name |
| 158 |
# |
| 159 |
# Returns 0 if successful; 1 otherwise |
| 160 |
# |
| 161 |
|
| 162 |
# need function to create another temporary directory, extract the |
| 163 |
# $tmpdir/$HDF4_VERS.tar into it, create build-VS*.bat files, |
| 164 |
# add CTestScript.cmake, HDF4config.cmake, LIBAEC.tar.gz, ZLib.tar.gz, |
| 165 |
# and JPEG9e.tar.gz, HDF4 examples and then zip it. |
| 166 |
tar2cmakezip() |
| 167 |
{ |
| 168 |
if [ $# -ne 3 ]; then |
| 169 |
echo "usage: tar2cmakezip <tarfilename> <zipfilename>" |
| 170 |
return 1 |
| 171 |
fi |
| 172 |
cmziptmpdir=/tmp/cmziptmpdir$$ |
| 173 |
cmziptmpsubdir=$cmziptmpdir/CMake-$HDF4_VERS |
| 174 |
mkdir -p $cmziptmpsubdir |
| 175 |
version=$1 |
| 176 |
tarfile=$2 |
| 177 |
zipfile=$3 |
| 178 |
|
| 179 |
# step 1: untar tarball in cmgztmpdir |
| 180 |
(cd $cmziptmpsubdir; tar xf -) < $tarfile |
| 181 |
# sanity check |
| 182 |
if [ ! -d $cmziptmpsubdir/$version ]; then |
| 183 |
echo "untar did not create $cmziptmpsubdir/$version source dir" |
| 184 |
# cleanup |
| 185 |
rm -rf $cmziptmpdir |
| 186 |
return 1 |
| 187 |
fi |
| 188 |
|
| 189 |
# step 2: add batch file for building CMake on Windows |
| 190 |
(cd $cmziptmpsubdir; echo "ctest -S HDF4config.cmake,BUILD_GENERATOR=VS2015 -C Release -V -O hdf4.log" > build-VS2015-32.bat; chmod 755 build-VS2015-32.bat) |
| 191 |
(cd $cmziptmpsubdir; echo "ctest -S HDF4config.cmake,BUILD_GENERATOR=VS201564 -C Release -V -O hdf4.log" > build-VS2015-64.bat; chmod 755 build-VS2015-32.bat) |
| 192 |
(cd $cmziptmpsubdir; echo "ctest -S HDF4config.cmake,BUILD_GENERATOR=VS2017 -C Release -V -O hdf4.log" > build-VS2017-32.bat; chmod 755 build-VS2017-32.bat) |
| 193 |
(cd $cmziptmpsubdir; echo "ctest -S HDF4config.cmake,BUILD_GENERATOR=VS201764 -C Release -V -O hdf4.log" > build-VS2017-64.bat; chmod 755 build-VS2017-64.bat) |
| 194 |
(cd $cmziptmpsubdir; echo "ctest -S HDF4config.cmake,BUILD_GENERATOR=VS2019 -C Release -V -O hdf4.log" > build-VS2019-32.bat; chmod 755 build-VS2019-32.bat) |
| 195 |
(cd $cmziptmpsubdir; echo "ctest -S HDF4config.cmake,BUILD_GENERATOR=VS201964 -C Release -V -O hdf4.log" > build-VS2019-64.bat; chmod 755 build-VS2019-64.bat) |
| 196 |
(cd $cmziptmpsubdir; echo "ctest -S HDF4config.cmake,BUILD_GENERATOR=VS2022 -C Release -V -O hdf4.log" > build-VS2022-32.bat; chmod 755 build-VS2022-32.bat) |
| 197 |
(cd $cmziptmpsubdir; echo "ctest -S HDF4config.cmake,BUILD_GENERATOR=VS202264 -C Release -V -O hdf4.log" > build-VS2022-64.bat; chmod 755 build-VS2022-32.bat) |
| 198 |
|
| 199 |
# step 3: add LIBAEC.tar.gz, ZLib.tar.gz and cmake files |
| 200 |
cp /mnt/scr1/pre-release/hdf4/CMake/LIBAEC.tar.gz $cmziptmpsubdir |
| 201 |
cp /mnt/scr1/pre-release/hdf4/CMake/ZLib.tar.gz $cmziptmpsubdir |
| 202 |
cp /mnt/scr1/pre-release/hdf4/CMake/JPEG9e.tar.gz $cmziptmpsubdir |
| 203 |
cp /mnt/scr1/pre-release/hdf4/CMake/HDF4Examples-0.3.10-Source.zip $cmziptmpsubdir |
| 204 |
cp $cmziptmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmziptmpsubdir |
| 205 |
cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF4config.cmake $cmziptmpsubdir |
| 206 |
cp $cmziptmpsubdir/$version/config/cmake/scripts/HDF4options.cmake $cmziptmpsubdir |
| 207 |
|
| 208 |
# step 4: convert text files |
| 209 |
# There maybe a simpler way to do this. |
| 210 |
# options used in unix2dos: |
| 211 |
# -k Keep the date stamp |
| 212 |
# -q quiet mode |
| 213 |
# grep redirect output to /dev/null because -q or -s are not portable. |
| 214 |
find $cmziptmpsubdir/$version | \ |
| 215 |
while read inf; do \ |
| 216 |
if file $inf | grep "$inf\: .*text" > /dev/null 2>&1 ; then \ |
| 217 |
unix2dos -q -k $inf; \ |
| 218 |
fi\ |
| 219 |
done |
| 220 |
|
| 221 |
# step 3: make zipball |
| 222 |
# -9 maximum compression |
| 223 |
# -y Store symbolic links as such in the zip archive |
| 224 |
# -r recursive |
| 225 |
# -q quiet |
| 226 |
(cd $cmziptmpdir; zip -9 -y -r -q CMake-$version.zip *) |
| 227 |
mv $cmziptmpdir/CMake-$version.zip $zipfile |
| 228 |
|
| 229 |
# cleanup |
| 230 |
rm -rf $cmziptmpdir |
| 231 |
} |
| 232 |
|
| 233 |
# Function name: tar2cmaketgz |
| 234 |
# Convert the release tarball to a gzipped tar file with files to run CMake build. |
| 235 |
# |
| 236 |
# |
| 237 |
# Steps: |
| 238 |
# 1. untar the tarball in a temporary directory; |
| 239 |
# Note: do this in a temporary directory to avoid changing |
| 240 |
# the original source directory which may be around. |
| 241 |
# 2. add build-unix.sh script. |
| 242 |
# 3. add LIBAEC.tar.gz, ZLib.tar.gz and cmake files to top level directory. |
| 243 |
# 4. create gzipped tar file with these contents: |
| 244 |
# build-unix.sh script |
| 245 |
# hdf4-<version> source code directory extracted from tar file |
| 246 |
# CTestScript.cmake cmake file copied from <hdf4 source code>/config/cmake/scripts |
| 247 |
# HDF4config.cmake cmake file copied from <hdf4 source code>/config/cmake/scripts |
| 248 |
# HDF4options.cmake cmake file copied from <hdf4 source code>/config/cmake/scripts |
| 249 |
# LIBAEC.tar.gz copied from /mnt/scr1/pre-release/hdf4/CMake |
| 250 |
# ZLib.tar.gz copied from /mnt/scr1/pre-release/hdf4/CMake |
| 251 |
# JPEG8d.tar.gz copied from /mnt/scr1/pre-release/hdf4/CMake |
| 252 |
|
| 253 |
|
| 254 |
# Parameters: |
| 255 |
# $1 version |
| 256 |
# $2 release tarball |
| 257 |
# $3 output zipball file name |
| 258 |
# |
| 259 |
# Returns 0 if successful; 1 otherwise |
| 260 |
# |
| 261 |
# need function to create another temporary directory, extract the |
| 262 |
# $tmpdir/$HDF4_VERS.tar into it, create build-unix.sh, |
| 263 |
# add CTestScript.cmake, HDF4config.cmake, LIBAEC.tar.gz |
| 264 |
# ZLib.tar.gz, JPEG9e.tar.gz, HDF4 examples and then tar.gz it. |
| 265 |
tar2cmaketgz() |
| 266 |
{ |
| 267 |
if [ $# -ne 3 ]; then |
| 268 |
echo "usage: tar2cmaketgz <tarfilename> <tgzfilename>" |
| 269 |
return 1 |
| 270 |
fi |
| 271 |
cmgztmpdir=/tmp/cmgztmpdir$$ |
| 272 |
cmgztmpsubdir=$cmgztmpdir/CMake-$HDF4_VERS |
| 273 |
mkdir -p $cmgztmpsubdir |
| 274 |
version=$1 |
| 275 |
tarfile=$2 |
| 276 |
tgzfile=$3 |
| 277 |
|
| 278 |
# step 1: untar tarball in cmgztmpdir |
| 279 |
(cd $cmgztmpsubdir; tar xf -) < $tarfile |
| 280 |
# sanity check |
| 281 |
if [ ! -d $cmgztmpsubdir/$version ]; then |
| 282 |
echo "untar did not create $cmgztmpsubdir/$version source dir" |
| 283 |
# cleanup |
| 284 |
rm -rf $cmgztmpdir |
| 285 |
return 1 |
| 286 |
fi |
| 287 |
|
| 288 |
|
| 289 |
# step 2: add build-unix.sh script |
| 290 |
(cd $cmgztmpsubdir; echo "ctest -S HDF4config.cmake,BUILD_GENERATOR=Unix -C Release -V -O hdf4.log" > build-unix.sh; chmod 755 build-unix.sh) |
| 291 |
|
| 292 |
# step 3: add LIBAEC.tar.gz, ZLib.tar.gz and cmake files |
| 293 |
cp /mnt/scr1/pre-release/hdf4/CMake/LIBAEC.tar.gz $cmgztmpsubdir |
| 294 |
cp /mnt/scr1/pre-release/hdf4/CMake/ZLib.tar.gz $cmgztmpsubdir |
| 295 |
cp /mnt/scr1/pre-release/hdf4/CMake/JPEG9e.tar.gz $cmgztmpsubdir |
| 296 |
cp /mnt/scr1/pre-release/hdf4/CMake/HDF4Examples-0.3.10-Source.tar.gz $cmgztmpsubdir |
| 297 |
cp $cmgztmpsubdir/$version/config/cmake/scripts/CTestScript.cmake $cmgztmpsubdir |
| 298 |
cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF4config.cmake $cmgztmpsubdir |
| 299 |
cp $cmgztmpsubdir/$version/config/cmake/scripts/HDF4options.cmake $cmgztmpsubdir |
| 300 |
tar czf $DEST/CMake-$HDF4_VERS.tar.gz -C $cmgztmpdir . || exit 1 |
| 301 |
|
| 302 |
# cleanup |
| 303 |
rm -rf $cmgztmpdir |
| 304 |
} |
| 305 |
|
| 306 |
|
| 307 |
# This command must be run at the top level of the hdf4 source directory. |
| 308 |
# Verify this requirement. |
| 309 |
if [ ! \( -f configure.ac -a -f bin/release \) ]; then |
| 310 |
echo "$0 must be run at the top level of the hdf4 source directory" |
| 311 |
exit 1 |
| 312 |
fi |
| 313 |
|
| 314 |
# Defaults |
| 315 |
DEST=releases |
| 316 |
VERS=`perl bin/h4vers` |
| 317 |
VERS_OLD= |
| 318 |
test "$VERS" || exit 1 |
| 319 |
verbose=yes |
| 320 |
check=yes |
| 321 |
release_date=`date +%F` |
| 322 |
today=`date +%Y%m%d` |
| 323 |
pmode='no' |
| 324 |
revmode='no' |
| 325 |
tmpdir="../#release_tmp.$$" # tmp work directory |
| 326 |
MAINT_MODE_ENABLED="" |
| 327 |
|
| 328 |
# If maintainer mode is enabled in configure, it should be disabled for release, |
| 329 |
# and enabled again after release files have been created. If already disabled |
| 330 |
# there's no need to do either. |
| 331 |
MAINT_MODE_ENABLED=`grep ^AM_MAINTAINER_MODE ./configure.ac | grep enable` |
| 332 |
if [ "${MAINT_MODE_ENABLED}" != "" ]; then |
| 333 |
bin/switch_maint_mode -disable ./configure.ac |
| 334 |
fi |
| 335 |
|
| 336 |
# Restore previous Version information |
| 337 |
RESTORE_VERSION() |
| 338 |
{ |
| 339 |
if [ X-${VERS_OLD} != X- ]; then |
| 340 |
echo restoring version information back to $VERS_OLD |
| 341 |
bin/h4vers -s $VERS_OLD |
| 342 |
VERS_OLD= |
| 343 |
fi |
| 344 |
} |
| 345 |
|
| 346 |
|
| 347 |
# Command-line arguments |
| 348 |
while [ -n "$1" ]; do |
| 349 |
arg=$1 |
| 350 |
shift |
| 351 |
case "$arg" in |
| 352 |
-d) |
| 353 |
DEST=$1 |
| 354 |
shift |
| 355 |
;; |
| 356 |
-h) |
| 357 |
USAGE |
| 358 |
exit 0 |
| 359 |
;; |
| 360 |
--private) |
| 361 |
pmode=yes |
| 362 |
;; |
| 363 |
--revision) |
| 364 |
revmode=yes |
| 365 |
;; |
| 366 |
--branch) |
| 367 |
BRANCHNAME=$1 |
| 368 |
shift |
| 369 |
;; |
| 370 |
-*) |
| 371 |
echo "Unknown switch: $arg" 1>&2 |
| 372 |
USAGE |
| 373 |
exit 1 |
| 374 |
;; |
| 375 |
*) |
| 376 |
methods="$methods $arg" |
| 377 |
;; |
| 378 |
esac |
| 379 |
done |
| 380 |
|
| 381 |
# Default method is tar |
| 382 |
if [ "X$methods" = "X" ]; then |
| 383 |
methods="tar" |
| 384 |
fi |
| 385 |
|
| 386 |
# Create the temporary work directory. |
| 387 |
if mkdir $tmpdir; then |
| 388 |
echo "temporary work directory for release. "\ |
| 389 |
"Can be deleted after release completes." > $tmpdir/README |
| 390 |
else |
| 391 |
echo "Failed to mkdir tmpdir($tmpdir)" |
| 392 |
exit 1 |
| 393 |
fi |
| 394 |
|
| 395 |
# setup restoration in case of abort. |
| 396 |
trap RESTORE_VERSION 0 |
| 397 |
|
| 398 |
if [ X$pmode = Xyes ]; then |
| 399 |
VERS_OLD=$VERS |
| 400 |
# Set version information to m.n.r-of$today. |
| 401 |
# (h4vers does not correctly handle just m.n.r-$today.) |
| 402 |
VERS=`echo $VERS | sed -e s/-.*//`-of$today |
| 403 |
echo Private release of $VERS |
| 404 |
bin/h4vers -s $VERS |
| 405 |
fi |
| 406 |
|
| 407 |
if [ X$revmode = Xyes ]; then |
| 408 |
VERS_OLD=$VERS |
| 409 |
echo "Save old version $VERS_OLD for restoration later." |
| 410 |
if [ "${BRANCHNAME}" = "" ]; then |
| 411 |
BRANCHNAME=`git symbolic-ref -q --short HEAD` |
| 412 |
fi |
| 413 |
revision=`git rev-parse --short HEAD` |
| 414 |
# Set version information to m.n.r-r$revision. |
| 415 |
# (h4vers does not correctly handle just m.n.r-$today.) |
| 416 |
VERS=`echo $VERS | sed -e s/-.*//`-$revision |
| 417 |
echo Private release of $VERS |
| 418 |
HDF4_VERS=hdf4-$BRANCHNAME-$revision |
| 419 |
echo file base of $HDF4_VERS |
| 420 |
bin/h4vers -s $VERS |
| 421 |
# use a generic directory name for revision releases |
| 422 |
HDF4_IN_VERS=hdfsrc |
| 423 |
else |
| 424 |
# Store hdf4-$VERS ("hdf-4.2.15", e.g.) to a variable to avoid typos |
| 425 |
HDF4_VERS=hdf-$VERS |
| 426 |
# directory name matches tar file name for non-revision releases |
| 427 |
HDF4_IN_VERS=$HDF4_VERS |
| 428 |
fi |
| 429 |
|
| 430 |
test "$verbose" && echo "Releasing $HDF4_VERS to $DEST" 1>&2 |
| 431 |
if [ ! -d $DEST ]; then |
| 432 |
echo " Destination directory $DEST does not exist" 1>&2 |
| 433 |
exit 1 |
| 434 |
fi |
| 435 |
|
| 436 |
# Create a symlink to the source so files in the tarball have the prefix |
| 437 |
# we want (gnu's --transform isn't portable) |
| 438 |
ln -s `pwd` $tmpdir/$HDF4_IN_VERS || exit 1 |
| 439 |
|
| 440 |
# Save a backup copy of Makefile if exists. |
| 441 |
test -f Makefile && mv Makefile $tmpdir/Makefile.x |
| 442 |
cp -p Makefile.dist Makefile |
| 443 |
|
| 444 |
# Update README.md and release_notes/RELEASE.txt with release information in |
| 445 |
# line 1. |
| 446 |
for f in README.md release_notes/RELEASE.txt; do |
| 447 |
echo "HDF version $VERS released on $release_date" >$f.x |
| 448 |
sed -e 1d $f >>$f.x |
| 449 |
mv $f.x $f |
| 450 |
# Make sure new files are of the right access mode |
| 451 |
chmod 644 $f |
| 452 |
done |
| 453 |
|
| 454 |
# Create the tar file |
| 455 |
test "$verbose" && echo " Running tar..." 1>&2 |
| 456 |
(cd "$tmpdir" && exec tar -ch --exclude-vcs --exclude=.clang-format --exclude=.git* -f "$HDF4_VERS.tar" "./$HDF4_IN_VERS" || exit 1 ) |
| 457 |
|
| 458 |
# Compress |
| 459 |
SHA256=$HDF4_VERS.sha256 |
| 460 |
cp /dev/null $DEST/$SHA256 |
| 461 |
for comp in $methods; do |
| 462 |
case $comp in |
| 463 |
tar) |
| 464 |
cp -p $tmpdir/$HDF4_VERS.tar $DEST/$HDF4_VERS.tar |
| 465 |
(cd $DEST; sha256sum $HDF4_VERS.tar >> $SHA256) |
| 466 |
;; |
| 467 |
gzip) |
| 468 |
test "$verbose" && echo " Running gzip..." 1>&2 |
| 469 |
gzip -9 <$tmpdir/$HDF4_VERS.tar >$DEST/$HDF4_VERS.tar.gz |
| 470 |
(cd $DEST; sha256sum $HDF4_VERS.tar.gz >> $SHA256) |
| 471 |
;; |
| 472 |
cmake-tgz) |
| 473 |
test "$verbose" && echo " Creating CMake tar.gz file..." 1>&2 |
| 474 |
tar2cmaketgz $HDF4_IN_VERS $tmpdir/$HDF4_VERS.tar $DEST/CMake-$HDF4_VERS.tar.gz 1>&2 |
| 475 |
(cd $DEST; sha256sum CMake-$HDF4_VERS.tar.gz >> $SHA256) |
| 476 |
;; |
| 477 |
bzip2) |
| 478 |
test "$verbose" && echo " Running bzip2..." 1>&2 |
| 479 |
bzip2 -9 <$tmpdir/$HDF4_VERS.tar >$DEST/$HDF4_VERS.tar.bz2 |
| 480 |
(cd $DEST; sha256sum $HDF4_VERS.tar.bz2 >> $SHA256) |
| 481 |
;; |
| 482 |
zip) |
| 483 |
test "$verbose" && echo " Creating zip ball..." 1>&2 |
| 484 |
tar2zip $HDF4_IN_VERS $tmpdir/$HDF4_VERS.tar $DEST/$HDF4_VERS.zip 1>&2 |
| 485 |
(cd $DEST; sha256sum $HDF4_VERS.zip >> $SHA256) |
| 486 |
;; |
| 487 |
cmake-zip) |
| 488 |
test "$verbose" && echo " Creating CMake-zip ball..." 1>&2 |
| 489 |
tar2cmakezip $HDF4_IN_VERS $tmpdir/$HDF4_VERS.tar $DEST/CMake-$HDF4_VERS.zip 1>&2 |
| 490 |
(cd $DEST; sha256sum CMake-$HDF4_VERS.zip >> $SHA256) |
| 491 |
;; |
| 492 |
*) |
| 493 |
echo "***Error*** Unknown method $comp" |
| 494 |
exit 1 |
| 495 |
;; |
| 496 |
esac |
| 497 |
done |
| 498 |
|
| 499 |
# If AM_MAINTAINER_MODE was enabled before running this script |
| 500 |
# restore it to "enabled". |
| 501 |
if [ "${MAINT_MODE_ENABLED}" != "" ]; then |
| 502 |
bin/switch_maint_mode -enable ./configure.ac |
| 503 |
fi |
| 504 |
|
| 505 |
# Copy the RELEASE.txt to the release area. |
| 506 |
cp release_notes/RELEASE.txt $DEST/$HDF4_VERS-RELEASE.txt |
| 507 |
|
| 508 |
# Remove distributed Makefile and restore previous Makefile if existed. |
| 509 |
rm -f Makefile |
| 510 |
test -f $tmpdir/Makefile.x && mv $tmpdir/Makefile.x Makefile |
| 511 |
|
| 512 |
# Restore OLD version information, then no need for trap. |
| 513 |
if [ X$pmode = Xyes ] || [ X$revmode = Xyes ]; then |
| 514 |
echo "Restore the original version $VERS_OLD" |
| 515 |
RESTORE_VERSION |
| 516 |
trap 0 |
| 517 |
fi |
| 518 |
|
| 519 |
# Remove temporary things |
| 520 |
rm -rf $tmpdir |
| 521 |
|
| 522 |
echo "DONE" |
| 523 |
|
| 524 |
exit 0 |