Whamcloud - gitweb
* Added temporary LNET branch b_newconfig_rdmarouting
[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 [ "$1" = "-r" ] && shift
35
36 buildtag="HEAD"
37 lustretag="$1"
38 shift
39
40 if [ "$*" ] ; then
41     usage >&2
42     exit 1
43 fi
44
45
46 case "$lustretag" in
47     '')
48         warn "a lustretag is required."
49         usage >&2
50         exit 1
51         ;;
52     --help | -h)
53         usage
54         exit 0
55         ;;
56
57     b1_4_newconfig*|b_newconfig_rdmarouting*)
58         buildtag="b_lnet"
59         ;;
60
61     v*) buildtag=$lustretag ;;
62
63     # this is the branch table
64     # keep this list sorted alphabetically!
65
66     *)
67         buildtag="HEAD"
68         ;;
69
70 esac
71
72 error_modules=
73 cvs_cmd ()
74 {
75     dir="$1"
76     module="$2"
77     tag="$3"
78     cotag=""
79     update=""
80
81     if [ "$tag" = "HEAD" ] ; then
82         cotag=""
83         uptag="-A"
84     elif [ "$tag" ] ; then
85         cotag="-r $tag"
86         uptag="-r $tag"
87     else
88         # silently skip if no tag was specified
89         return
90     fi
91
92     if [ -d "$dir" ] ; then
93         echo "$progname: Updating $dir to $tag"
94         ( cd "$dir" && cvs up -dP $uptag )
95     else
96         echo "$progname: Checking out $dir from $tag"
97         cvs co -P $cotag -d "$dir" "$module"
98     fi
99     if [ $? != 0 ] ; then
100         error_modules="$dir $error_modules"
101     fi
102 }
103
104 cvs_cmd build lustre-build "$buildtag"
105
106 if [ -f build/buildcvs ] ; then
107     . build/buildcvs
108 else
109     fatal 1 "build/buildcvs does not exist; not updating other modules."
110 fi
111
112 if [ "$error_modules" ] ; then
113     fatal 1 "There were errors checking out the following directories: $error_modules"
114 fi