#!/bin/sh
#
# Copyright by The HDF Group.
# Copyright by the Board of Trustees of the University of Illinois.
# All rights reserved.
#
# This file is part of HDF5. The full HDF5 copyright notice, including
# terms governing use, modification, and redistribution, is contained in
# the files COPYING and Copyright.html. COPYING can be found at the root
# of the source code distribution tree; Copyright.html can be found at the
# root level of an installed copy of the electronic HDF5 document set and
# is linked from the top-level documents page. It can also be found at
# 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
# 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()
{
echo "=====" "$1": "`date`" "====="
}
EXIT_BANNER()
{
TIMESTAMP "Exit $PROGNAME with status=$?"
}
# Show current total disk usage.
DISKUSAGE()
{
du -ks | \
( read x y; echo "Disk Usage=$x KB" )
}
# MAIN
# SGI /bin/sh replaces $0 as function name if used in a function.
# Set the name here to avoid that ambiguity and better style too.
PROGNAME=$0
echo "====================================="
echo "$PROGNAME $*"
echo "====================================="
TIMESTAMP MAIN
uname -a
# setup exit banner message
trap EXIT_BANNER 0
# Dump environment variables before option parsing
echo ===Dumping environment variables before option parsing ===
printenv | sort
echo ===Done Dumping environment variables before option parsing ===
# snapshots release directory. Default relative to $BASEDIR.
ReleaseDir_default=release_dir
# Where is the zlib library?
# At NCSA, half of the machines have it in /usr/lib, the other half at
# /usr/ncsa/lib. Leave it unset.
ZLIB_default=
ZLIB=$ZLIB_default
# What compression methods to use? (md5 does checksum).
METHODS="gzip bzip2 md5 doc"
# Use User's MAKE if set. Else use generic make.
MAKE=${MAKE:-make}
# Default check action.
CHECKVAL=check
#
# Command options
cmd="all"
test_opt=""
errcode=0
while [ $# -gt 0 ] ; do
case "$1" in
all)
cmd="all"
;;
checkout)
cmdcheckout="checkout"
cmd=""
;;
diff)
cmddiff="diff"
cmd=""
;;
deploy)
# deploy the built binary.
shift
if [ $# -lt 1 ]; then
echo "deploy
missing"
errcode=1
cmd="help"
break
fi
cmddeploy="deploy"
DEPLOYDIRNAME="$1"
;;
deploydir)
# default directory for deployment.
shift
if [ $# -lt 1 ]; then
echo "deploydir missing"
errcode=1
cmd="help"
break
fi
deploydir="$1"
;;
test)
cmdtest="test"
cmd=""
;;
setenv)
# set environment variable
shift
eval $1="$2"
export $1
shift
;;
setenvN)
# set environment variable with $1 values
# e.g., setenvN 3 x a b c is same as setenv x="a b c".
# a kludge now--the extra single quotes are needed
# else eval complains.
shift
envN=$1
shift
envname=$1
envalue=
while test $envN -gt 0; do
shift
envalue="$envalue $1"
envN=`expr $envN - 1`
done
eval $envname="'$envalue'"
export $envname
;;
srcdir)
#use srcdir option for test
srcdir="yes"
;;
srcdirname)
shift
if [ $# -lt 1 ]; then
echo "srcdirname missing"
errcode=1
cmd="help"
break
fi
SRCDIRNAME="$1"
;;
release)
cmdrel="release"
cmd=""
;;
clean | distclean)
cmdclean="$1"
cmd=""
;;
help)
cmd="help"
break
;;
echo)
set -x
break
;;
zlib)
shift
if [ $# -lt 1 ]; then
echo "ZLIB information missing"
errcode=1
cmd="help"
break
fi
ZLIB="$1"
;;
releasedir)
shift
if [ $# -lt 1 ]; then
echo "Release directory name missing"
errcode=1
cmd="help"
break
fi
ReleaseDir="$1"
;;
check-vfd)
CHECKVAL=check-vfd
;;
--*)
OP_CONFIGURE="$OP_CONFIGURE $1"
;;
op-configure)
shift
if [ $# -lt 1 ]; then
echo "op-configure option missing"
errcode=1
cmd="help"
break
fi
OP_CONFIGURE="$OP_CONFIGURE $1"
;;
*)
echo "Unkown option $1"
errcode=1
cmd="help"
break
;;
esac
shift
done
# Dump environment variables after option parsing
echo ===Dumping environment variables after option parsing ===
printenv | sort
echo ===Done Dumping environment variables after option parsing ===
if [ "$cmd" = help ]; then
set -
cat <] [deploydir ]
[zlib ] [releasedir ] [srcdirname ] [check-vfd]
[op-configure