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