summaryrefslogtreecommitdiffstats
path: root/bin/snapshot
blob: 9a40f6f695765c51e4d19b8ed8816f86b79f7627 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/sh
set -x
date
#
# This script should be run nightly from cron.  It checks out hdf5
# from the CVS source tree 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 CVS repository.
#

# The path isn't properly initialized on hawkwind -- /usr/local/bin is
# either missing or is after /usr/bin when it should be before.
PATH="/usr/local/bin:$PATH"

# Where are the snapshots stored?
ARCHIVES=/hdf3/ftp/pub/outgoing/hdf5/snapshots
if [ "$1" ]; then
    ARCHIVES="$1"
    shift
fi

# What compression methods to use?
METHODS="gzip bzip2"

# How to configure? We disable hdf4 because that's almost always the
# culprit for tests failing -- hawkwind seems to have a version older
# than what h5toh4 requires.
CONFIGURE="./configure"

# 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
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.
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 " \
		${COMPARE}/previous/$src ${COMPARE}/current/$src || \
		snapshot=yes
		# Don't break because we want to see all the diffs.
	done
    fi
fi

# 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

# Release snapshot, update version, and commit to cvs and tag
if [ "$snapshot" = "yes" ]; then
    (
	cd ${COMPARE}/current
	cvs -Q tag hdf5-`./bin/h5vers |tr . _`
	./bin/release -d $ARCHIVES $METHODS
	./bin/h5vers -i
	cvs -Q commit -m Snapshot
    )
fi

# Replace the previous version with the current version.
rm -rf ${COMPARE}/previous
mv ${COMPARE}/current ${COMPARE}/previous
exit 0