Whamcloud - gitweb
b=5568
[fs/lustre-release.git] / lustrecvs
1 #!/bin/sh
2
3 LC_COLLATE="C"
4 progname="${0##*/}"
5
6 warn ()
7 {
8     [ "$1" ] && echo >&2
9     [ "$1" ] && echo "$progname: $1" >&2
10     [ "$1" ] && echo >&2
11 }
12
13 fatal ()
14 {
15     warn "$2"
16     exit "$1"
17 }
18
19 usage ()
20 {
21     cat <<EOF
22 Usage: $progname lustretag
23   where lustretag is a tag of the lustre-core module
24 EOF
25 }
26
27 if [ -z "$LUSTRECVS_UPDATED" ] ; then
28     echo "$progname: updating lustrecvs"
29     cvs up -l || fatal 1 "Error updating lustrecvs"
30     export LUSTRECVS_UPDATED=yes
31     exec "$0" "$@"
32 fi
33
34 buildtag="HEAD"
35 lustretag="$1"
36
37 case "$lustretag" in
38     '')
39         warn "a lustretag is required."
40         usage >&2
41         exit 1
42         ;;
43     --help | -h)
44         usage
45         exit 0
46         ;;
47
48     # this is the branch table
49     # keep this list sorted alphabetically!
50
51     *)
52         buildtag="HEAD"
53         ;;
54
55 esac
56
57 cvs_cmd ()
58 {
59     dir="$1"
60     module="$2"
61     tag="$3"
62     cotag=""
63     update=""
64
65     if [ "$tag" = "HEAD" ] ; then
66         cotag=""
67         uptag="-A"
68     else
69         cotag="-r $tag"
70         uptag="-r $tag"
71     fi
72
73     if [ -d "$dir" ] ; then
74         echo "$progname: Updating $dir to $tag"
75         ( cd "$dir" && cvs up -dP $uptag )
76     else
77         echo "$progname: Checking out $dir from $tag"
78         cvs co -P $cotag -d "$dir" "$module"
79     fi
80 }
81
82 cvs_cmd build lustre-build "$buildtag"
83
84 if [ -f build/buildcvs ] ; then
85     . build/buildcvs
86 else
87     fatal 1 "build/buildcvs does not exist; not updating other modules."
88 fi