From 624719c9245150e960fa5c1b8301f8cdf814fd43 Mon Sep 17 00:00:00 2001 From: Albert Cheng Date: Sun, 4 Jul 1999 00:16:03 -0500 Subject: [svn-r1421] Divide the whole script into two parts, test and release, so that the two tasks can be done selectively. This is mainly to allow doing the test without running the release part automatically. After this is tested out more to work fine, the "cvs checkout" part will be pulled out also, so that it is possible to stage the cvs checkout during the daytime when user is around to provide the AFS token. The test part can be done at night by cron, provided the latest source has been "staged". Following a successful test, the user can do the release part by hand later, again with AFS tokens. Also added options for using different locations of HDF4 library and the ARCHIVE areas. Making it useful for different machines setup. --- bin/snapshot | 192 ++++++++++++++++++++++++++++++++++++++++++----------------- 1 file changed, 139 insertions(+), 53 deletions(-) diff --git a/bin/snapshot b/bin/snapshot index ca18723..7d3ba9a 100755 --- a/bin/snapshot +++ b/bin/snapshot @@ -14,75 +14,161 @@ date PATH="/usr/local/bin:$PATH" # Where are the snapshots stored? -ARCHIVES=/afs/ncsa/ftp/HDF/pub/outgoing/hdf5/snapshots -if [ "$1" ]; then - ARCHIVES="$1" - shift -fi - -# What compression methods to use? -METHODS="gzip bzip2" +ARCHIVES_default=/afs/ncsa/ftp/HDF/pub/outgoing/hdf5/snapshots +ARCHIVES=$ARCHIVES_default +# Where are the HDF4 library? # At NCSA, the standard place to find HDF4 software is in /usr/ncsa/. -CONFIGURE="./configure --with-hdf4=/usr/ncsa/include,/usr/ncsa/lib" +HDF4LIB_default="/usr/ncsa/include,/usr/ncsa/lib" +HDF4LIB="--with-hdf4=$HDF4LIB_default" -# Create a working directory. Hopefully one is left over from last -# time that still has the contents of the previous release. But if -# not, just create one and assume that a snapshot is necessary. -COMPARE=${HOME}/hdf5-snapshots -test -d ${COMPARE} || mkdir -p ${COMPARE} || exit 1 +# What compression methods to use? +METHODS="gzip bzip2" -# Check out the current version from CVS +# Make sure cvs would work if [ -z "$CVSROOT" ]; then echo "Where is the CVS repository?" 1>&2 exit 1 fi -cvs -Q co -d ${COMPARE}/current hdf5 || exit 1 -# Compare it with the previous version. Compare only files listed in -# the MANIFEST plus the MANIFEST itself. +# +# Command options +cmd="all" +errcode=0 +echo '$#=' $# '$*="' $* '"' +while [ $# -gt 0 ] ; do + case "$1" in + all) + cmd="all" + ;; + test) + cmdtest="test" + cmd="" + ;; + release) + cmdrel="release" + cmd="" + ;; + help) + cmd="help" + break + ;; + hdf4) + shift + if [ $# -lt 1 ]; then + echo "HDF4LIB information missing" + errcode=1 + cmd="help" + break + fi + # an empty $1 resets HDF4LIB to "", disabling hdf4lib usage + HDF4LIB="$1" + HDF4LIB=${HDF4LIB:+"--with-hdf4="$HDF4LIB} + ;; + archive) + shift + if [ $# -lt 1 ]; then + echo "Archive pathname missing" + errcode=1 + cmd="help" + break + fi + ARCHIVES="$1" + ;; + *) + echo "Unkown option $1" + errcode=1 + cmd="help" + break + ;; + esac + shift +done + +if [ "$cmd" = help ]; then + set - + echo "Usage: $0 [all] [test] [release] [help] [hdf4 ] [archive ]" + echo " all: Run all commands (test & release)" + echo " [Default is all]" + echo " test: Run test" + echo " release: Run release" + echo " help: Print this message" + echo " hdf4 :" + echo " Use as the HDF4LIB locations" + echo " [Default is $HDF4LIB_default]" + echo " archive : " + echo " Use as the release ARCHIVE area" + echo " [ default as $ARCHIVES_default]" + exit $errcode +fi + +# Execute the requests snapshot=yes -if [ -d ${COMPARE}/previous ]; then - if (diff -c ${COMPARE}/previous/MANIFEST ${COMPARE}/current/MANIFEST); then - snapshot=no - for src in `grep '^\.' ${COMPARE}/current/MANIFEST|expand|cut -f1 -d' '`; do - diff -I H5_VERS_RELEASE -I " released on " \ - -I " currently under development" \ - ${COMPARE}/previous/$src ${COMPARE}/current/$src || \ - snapshot=yes - # Don't break because we want to see all the diffs. - done + +# +# Test the HDF5 library +if [ -n "$cmd" -o -n "$cmdtest" ]; then + CONFIGURE="./configure $HDF4LIB" + + # Create a working directory. Hopefully one is left over from last + # time that still has the contents of the previous release. But if + # not, just create one and assume that a snapshot is necessary. + COMPARE=${HOME}/hdf5-snapshots + test -d ${COMPARE} || mkdir -p ${COMPARE} || exit 1 + + # Check out the current version from CVS + cvs -Q co -d ${COMPARE}/current hdf5 || exit 1 + + # Compare it with the previous version. Compare only files listed in + # the MANIFEST plus the MANIFEST itself. + if [ -d ${COMPARE}/previous ]; then + if (diff -c ${COMPARE}/previous/MANIFEST ${COMPARE}/current/MANIFEST); then + snapshot=no + for src in `grep '^\.' ${COMPARE}/current/MANIFEST|expand|cut -f1 -d' '`; do + diff -I H5_VERS_RELEASE -I " released on " \ + -I " currently under development" \ + ${COMPARE}/previous/$src ${COMPARE}/current/$src || \ + snapshot=yes + # Don't break because we want to see all the diffs. + done + fi fi -fi -# Make sure all the serial tests work. -if [ "$snapshot" = "yes" ]; then - if (cd ${COMPARE}/current; \ - ${CONFIGURE}; \ - make _test); then - : - else - snapshot=no + # Make sure all the serial tests work. + if [ "$snapshot" = "yes" ]; then + if (cd ${COMPARE}/current; \ + ${CONFIGURE}; \ + make _test); then + : + else + snapshot=no + fi + (cd ${COMPARE}/current; make distclean) fi - (cd ${COMPARE}/current; make distclean) -fi +fi # Test the HDF5 library + +# # Release snapshot, update version, and commit to cvs and tag # Turn on exit on error in the sub-shell so that it does not # cvs commit if errors encounter here. -if [ "$snapshot" = "yes" ]; then - ( - set -e - cd ${COMPARE}/current - cvs -Q tag hdf5-`perl -w bin/h5vers |tr . _` - bin/release -d $ARCHIVES $METHODS - RELEASE_VERSION="`perl -w bin/h5vers -v`" - perl -w bin/h5vers -i - cvs -Q commit -m "Snapshot $RELEASE_VERSION" - ) -fi +if [ -n "$cmd" -o -n "$cmdrel" ]; then + if [ "$snapshot" = "yes" ]; then + ( + set -e + cd ${COMPARE}/current + cvs -Q tag hdf5-`perl -w bin/h5vers |tr . _` + bin/release -d $ARCHIVES $METHODS + RELEASE_VERSION="`perl -w bin/h5vers -v`" + perl -w bin/h5vers -i + cvs -Q commit -m "Snapshot $RELEASE_VERSION" + ) + fi + + # Replace the previous version with the current version. + rm -rf ${COMPARE}/previous + mv ${COMPARE}/current ${COMPARE}/previous + +fi #Release snapshot -# Replace the previous version with the current version. -rm -rf ${COMPARE}/previous -mv ${COMPARE}/current ${COMPARE}/previous exit 0 -- cgit v0.12