Whamcloud - gitweb
turn debugging on by default for now
[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 shift
37
38 if [ "$*" ] ; then
39     usage >&2
40     exit 1
41 fi
42
43
44 case "$lustretag" in
45     '')
46         warn "a lustretag is required."
47         usage >&2
48         exit 1
49         ;;
50     --help | -h)
51         usage
52         exit 0
53         ;;
54
55     # this is the branch table
56     # keep this list sorted alphabetically!
57
58     *)
59         buildtag="HEAD"
60         ;;
61
62 esac
63
64 cvs_cmd ()
65 {
66     dir="$1"
67     module="$2"
68     tag="$3"
69     cotag=""
70     update=""
71
72     if [ "$tag" = "HEAD" ] ; then
73         cotag=""
74         uptag="-A"
75     else
76         cotag="-r $tag"
77         uptag="-r $tag"
78     fi
79
80     if [ -d "$dir" ] ; then
81         echo "$progname: Updating $dir to $tag"
82         ( cd "$dir" && cvs up -dP $uptag )
83     else
84         echo "$progname: Checking out $dir from $tag"
85         cvs co -P $cotag -d "$dir" "$module"
86     fi
87 }
88
89 cvs_cmd build lustre-build "$buildtag"
90
91 if [ -f build/buildcvs ] ; then
92     . build/buildcvs
93 else
94     fatal 1 "build/buildcvs does not exist; not updating other modules."
95 fi