From f37f35245d10afc251aa2398b7cfe186ea927c78 Mon Sep 17 00:00:00 2001 From: lrknox Date: Mon, 13 Feb 2017 09:18:12 -0600 Subject: Check in changes to snapshot script from hdfdts repository to copy in HDF5 develop branch. Most of the changes are for the switch from subversion to it repositories. This copy is not used for THG daily tests, but is available for testing on remote machines. --- bin/snapshot | 581 +++++++++++++++++++++++++++++++++++++++++++++++------------ 1 file changed, 465 insertions(+), 116 deletions(-) diff --git a/bin/snapshot b/bin/snapshot index a496edd..081755d4 100755 --- a/bin/snapshot +++ b/bin/snapshot @@ -13,13 +13,14 @@ # http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have # access to either file, you may request a copy from help@hdfgroup.org. -# This script should be run nightly from cron. It checks out hdf5 +# This script should be run nightly from cron. It checks out the source # from the source repository and compares it against the previous # snapshot. If anything significant changed then a new snapshot is # created, the minor version number is incremented, and the change is # checked back into the source repository. # + # function definitions TIMESTAMP() { @@ -28,7 +29,7 @@ TIMESTAMP() EXIT_BANNER() { -TIMESTAMP "Exit $PROGNAME with status=$?" + TIMESTAMP "Exit $PROGNAME with status=$?" } # Show current total disk usage. @@ -38,11 +39,208 @@ DISKUSAGE() ( read x y; echo "Disk Usage=$x KB" ) } +# function provided for testing software downloaded as tar files. A version of +# this function that properly extracts the downloaded files can be provided in +# the snapshots-${sw}-overrides file. +EXTRACT() +{ + echo "Error: ${SWVERSION} is in svn repository - does not need extraction." +} + +# Standard procedure for checking out or updating source code from an hdfgroup +# git repository. Override the function for other repositories or procedures. +SOURCE_CHECKOUT() +{ + if test -n $GIT_URL; then + if [ -n "$AUTOGEN" ]; then + echo "Creating fresh clone of $GIT_URL in $BASEDIR/current_src" + # Check out the current version from source repository. + (cd $BASEDIR; rm -rf current_src + if test -z $GIT_BRANCH; then + echo "Testing empty branch $GIT_BRANCH." + git clone $GIT_URL current_src + else + echo "Testing branch $GIT_BRANCH." + git clone $GIT_URL -b $GIT_BRANCH current_src + fi + ) || exit 1 + else + echo "Creating fresh clone of $GIT_URL in $BASEDIR/current" + # Check out the current version from source repository. + (cd $BASEDIR; rm -rf current + if test -n $GIT_BRANCH; then + git clone $GIT_URL -b $GIT_BRANCH current + else + git clone $GIT_URL current + fi ) || exit 1 + fi + else + SVNROOT=https://svn.hdfgroup.org + if [ -n "$AUTOGEN" ]; then + if [ ! -d $BASEDIR/current_src ]; then + mkdir -p $BASEDIR/current_src + echo "Checking out from $SVNROOT/${SVNVERSION} into $BASEDIR/current_src" + (cd $BASEDIR; svn co ${SVNROOT}/${SVNVERSION} ./current_src ) || exit 1 + else + cd $BASEDIR/current_src; + svn -q update + echo "Updating $BASEDIR/current_src from svn." + fi + elif [ ! -d $BASEDIR/current ]; then + mkdir $BASEDIR/current + echo "Checking out from $SVNROOT/${SVNVERSION} into $BASEDIR/current" + # Check out the current version from source repository. + (cd $BASEDIR; svn co ${SVNROOT}/${SVNVERSION} current ) || exit 1 + else + cd $BASEDIR/current; svn info + # "svn info" returns 0 if $BASEDIR/current was previously checked out from an + # svn repository - i.e. it contains .svn directories and files. If so it can + # be updated to the current version. If not it can be checked out from the + # repository. + if [ "$?" = 0 ];then + # $BASEDIR/current was checked out from an svn repository, so update + # to the current version. + svn -q update + echo "Updating $BASEDIR/current from svn." + else + echo "Warning! Source directory ("current") is not checked out from svn." + fi + fi + fi +} + +# Standard procedure for running the configure command in a build (test) +# directory +RUNCONFIGURE() +{ + if [ "${CURRENT}" != "${TESTDIR}" -a "$CPSRC" = "yes" ]; then + echo "Copying source files to ${TESTDIR}." + cp -pr ${CURRENT}/* ${TESTDIR} + cd ${TESTDIR} + ./${CONFIGURE} + elif [ -n "${AUTOGEN}" ]; then + ${CURRENTSRC}/${CONFIGURE} + else + ${CURRENT}/${CONFIGURE} + fi +} + +# Sometimes "make distclean" doesn't adequately remove files from the previous +# build. If a build (test) directory was used, its contents can be entirely +# deleted to provide a clean start. If the test is building in the source +# directory, the contents can't be deleted, so run "make distclean". +DISTCLEAN() +{ + if [ "${srcdir}" = "yes" -a -n "${SRCDIRNAME}" -a -d ${BASEDIR}/TestDir/${SRCDIRNAME} ]; then + echo "Remove contents of $SRCDIRNAME.\n" + rm -rf ${BASEDIR}/TestDir/${SRCDIRNAME}/* + else + echo "$MAKE distclean" + (cd ${TESTDIR} && ${MAKE} distclean) + fi +} + +# Several of the software packages tested do not support make check-install. +# Those that support it should have a version of this function in their +# override with the following lines: +# TIMESTAMP "check-install $1" +# ${MAKE} check-install $1 +CHECKINSTALL() +{ + echo "check-install is not supported for ${SWVERSION}" +} + +# Function for hdf4 and hdf5 to override to check in changes after snapshot. +# Safety measure to avoid unintended checkins to other repositories. +COMMITSNAPSHOT() +{ + echo "original hdf5 script checked code back into svn." +} + +DISPLAYUSAGE() +{ + set - + cat < [diff] [test] [srcdir] [release] [help] + [clean] [distclean] [echo] [deploy ] [deploydir ] + [zlib ] [releasedir ] [srcdirname ] [check-vfd] + [exec ] [module-load ] [op-configure