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