Whamcloud - gitweb
bcce7796d2741a18dfc8f538f33a8dea05e25e72
[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     b1_2)
43         portalstag="b1_2"
44         ;;
45
46     *)
47         buildtag="HEAD"
48         ;;
49
50 esac
51
52 cvs_cmd ()
53 {
54     local dir="$1"
55     local module="$2"
56     local tag="$3"
57     local cotag=""
58     local update=""
59
60     if [ "$tag" = "HEAD" ] ; then
61         cotag=""
62         uptag="-A"
63     else
64         cotag="-r $tag"
65         uptag="-r $tag"
66     fi
67
68     if [ -d "$dir" ] ; then
69         echo "$progname: Updating $dir to $tag"
70         ( cd "$dir" && cvs up $uptag )
71     else
72         echo "$progname: Checking out $dir from $tag"
73         cvs co $cotag -d "$dir" "$module"
74     fi
75 }
76
77 cvs_cmd build lustre-build "$buildtag"
78
79 if [ -f build/buildcvs ] ; then
80     . build/buildcvs
81 else
82     fatal 1 "build/buildcvs does not exist; not updating other modules."
83 fi