Whamcloud - gitweb
Branch HEAD
[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     # this is the branch table
58     # keep this list sorted alphabetically!
59
60     b1_4*) buildtag="b1_4" ;;
61
62     b_release_1_4_6-patchless) buildtag="b1_4" ;;
63     b_release_1_4_7-test) buildtag="b_release_1_4_7" ;;
64
65     b_release*) buildtag=$lustretag ;;
66
67     # These releases did not get build tagged for them because they
68     # this build system didn't exist when they were tagged
69     v1_2_8|v1_4_0) 
70         buildtag="b1_4"
71         ;;
72     
73     v*) buildtag=$lustretag ;;
74
75     # this is the branch table
76     # keep this list sorted alphabetically!
77
78     *)
79         buildtag="HEAD"
80         ;;
81 esac
82
83 error_modules=
84 cvs_cmd ()
85 {
86     dir="$1"
87     module="$2"
88     tag="$3"
89     cotag=""
90     update=""
91
92     if [ "$tag" = "HEAD" ] ; then
93         cotag=""
94         uptag="-A"
95     elif [ "$tag" ] ; then
96         cotag="-r $tag"
97         uptag="-r $tag"
98     else
99         # silently skip if no tag was specified
100         return
101     fi
102
103     if [ -d "$dir" ] ; then
104         echo "$progname: Updating $dir to $tag"
105         ( cd "$dir" && cvs up -dP $uptag )
106     else
107         echo "$progname: Checking out $dir from $tag"
108         cvs co -P $cotag -d "$dir" "$module"
109     fi
110     if [ $? != 0 ] ; then
111         error_modules="$dir $error_modules"
112     fi
113 }
114
115 cvs_cmd build lustre-build "$buildtag"
116
117 if [ -f build/buildcvs ] ; then
118     . build/buildcvs
119 else
120     fatal 1 "build/buildcvs does not exist; not updating other modules."
121 fi
122
123 if [ "$error_modules" ] ; then
124     fatal 1 "There were errors checking out the following directories: $error_modules"
125 fi