Add vir-fc9
[git/spearce.git] / Dothem
blobd05aefa62c29c1e94216c2d400de05a9955f8e79
1 #!/bin/sh
3 NWD=contrib/workdir/git-new-workdir
5 force= with_dash= M= install= nodoc= bootstrap= branches= jobs=
6 while case "$1" in
7 --pedantic) M="$M $1" ;;
8 --locale=*) M="$M $1" ;;
9 --force) force=$1 ;;
10 --dash) with_dash=y ;;
11 --noinstall) install=noinstall ;;
12 --nodoc) nodoc=y ;;
13 --bootstrap) bootstrap=y ;;
14 --base=*) BUILDBASE=${1#*=} ;;
15 --branches=*) branches=${1#*=} ;;
16 -j*) jobs=$1 ;;
17 -*) echo >&2 "Unknown option: $1"; exit 1 ;;
18 *) break ;;
19 esac
21 shift
22 done
23 test -f /bin/dash || with_dash=
24 test -n "$BUILDBASE" || BUILDBASE=../buildfarm
25 test -n "$branches" || branches='next master maint pu jch'
26 test -n "$jobs" || jobs=-j2
28 for branch in $branches
30 echo "** $branch **"
31 revision=$(git show-ref -s --verify "refs/heads/$branch") || {
32 echo "** No $branch"
33 continue
36 if test ! -d "$BUILDBASE/$branch"
37 then
38 if test -z "$bootstrap"
39 then
40 echo "** No $BUILDBASE/$branch"
41 continue
43 "$NWD" . "$BUILDBASE/$branch" $branch &&
44 ln -s "$(pwd)/Meta" "$BUILDBASE/$branch/Meta" || {
45 echo "** Failed to bootstrap $BUILDBASE/$branch"
46 continue
50 private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
51 case $? in 0|1) ;; *) exit $? ;; esac
53 if test -f "$HOME/git-$branch/bin/git" &&
54 installed=$($HOME/git-$branch/bin/git version) &&
55 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
56 then
58 elif version=v$(expr "$installed" : \
59 'git version \(.*\)\.rc[0-9]*$')
60 then
61 version="$version"-$(expr "$installed" : \
62 'git version .*\.\(rc[0-9]*\)$')
63 else
64 version=v$(expr "$installed" : 'git version \(.*\)')
65 fi &&
66 version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
67 test "z$version" = "z$revision"
68 then
69 echo "* up-to-date version \"$installed\" is already installed from $branch"
70 test -n "$force" || continue
74 case "$branch, $branches " in
75 jch,*' next '*)
76 if git diff --quiet --exit-code jch next
77 then
78 dotest=
79 else
80 dotest=test
84 dotest=test ;;
85 esac
87 cd "$BUILDBASE/$branch"
88 git reset --hard &&
89 case "$(git symbolic-ref HEAD)" in
90 "refs/heads/$branch")
91 : ;;
93 git checkout "$branch" &&
94 git reset --hard || exit
95 esac &&
97 case "$private" in
98 '')
101 git merge --squash --no-commit "$private" || {
102 echo >&2 "** Cannot apply private edition changes"
103 git reset --hard
106 esac &&
109 test "z$with_dash" != 'zy' ||
110 Meta/Make $M -- $jobs SHELL_PATH=/bin/dash $dotest
111 } &&
113 Meta/Make $M -- $jobs $dotest &&
115 test -n "$nodoc" ||
116 Meta/Make $M -- doc install-doc
117 } &&
120 test z$install = znoinstall ||
121 Meta/Make $M -- install
122 } || exit $?
124 git reset --hard
125 ) || break;
127 done