Dothem: make it easier to bootstrap

Junio C Hamano committed Apr 19, 2009 at 05:12 UTC 7e8dadd50f02f591c39d5a5e61c37cbdb909ca4f
1 file changed +45 -27
Dothem
+45 -27
@@ -1,22 +1,27 @@
1 #!/bin/sh
2
3 -: ${J=-j2}
4 -: ${BUILDBASE=../buildfarm}
5 -: ${branches='next master maint pu jch'}
3 +NWD=contrib/workdir/git-new-workdir
4
7 -force= with_dash= M= install= nodoc=
5 +force= with_dash= M= install= nodoc= bootstrap= branches= jobs=
6 while case "$1" in
9 - -pedantic) M=$1 ;;
10 - -force) force=$1 ;;
11 - -dash) with_dash=y ;;
12 - -noinstall) install=noinstall ;;
13 - -nodoc) nodoc=y ;;
7 + --pedantic) M="$M $1" ;;
8 + --force) force=$1 ;;
9 + --dash) with_dash=y ;;
10 + --noinstall) install=noinstall ;;
11 + --nodoc) nodoc=y ;;
12 + --bootstrap) bootstrap=y ;;
13 + --base=*) BUILDBASE=${1#*=} ;;
14 + --branches=*) branches=${1#*=} ;;
15 + -j*) jobs=$1 ;;
16 *) break ;;
17 esac
18 do
19 shift
20 done
21 test -f /bin/dash || with_dash=
22 +test -n "$BUILDBASE" || BUILDBASE=../buildfarm
23 +test -n "$branches" || branches='next master maint pu jch'
24 +test -n "$jobs" || jobs=-j2
25
26 for branch in $branches
27 do
@@ -25,15 +30,26 @@ do
30 echo "** No $branch"
31 continue
32 }
28 - test -d "$BUILDBASE/$branch" || {
29 - echo "** No $BUILDBASE/$branch"
30 - continue
31 - }
33 +
34 + if test ! -d "$BUILDBASE/$branch"
35 + then
36 + if test -z "$bootstrap"
37 + then
38 + echo "** No $BUILDBASE/$branch"
39 + continue
40 + fi
41 + "$NWD" . "$BUILDBASE/$branch" $branch &&
42 + "$NWD" Meta "$BUILDBASE/$branch/Meta" || {
43 + echo "** Failed to bootstrap $BUILDBASE/$branch"
44 + continue
45 + }
46 + fi
47
48 private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
49 case $? in 0|1) ;; *) exit $? ;; esac
50
36 - if installed=$($HOME/git-$branch/bin/git version) &&
51 + if test -f "$HOME/git-$branch/bin/git" &&
52 + installed=$($HOME/git-$branch/bin/git version) &&
53 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
54 then
55 :
@@ -68,34 +84,36 @@ do
84
85 cd "$BUILDBASE/$branch"
86 git reset --hard &&
71 - git checkout "$branch" &&
72 - git reset --hard || exit
87 + case "$(git symbolic-ref HEAD)" in
88 + "refs/heads/$branch")
89 + : ;;
90 + *)
91 + git checkout "$branch" &&
92 + git reset --hard || exit
93 + esac &&
94 +
95 case "$private" in
96 '')
97 ;;
98 ?*)
99 git merge --squash --no-commit "$private" || {
78 - echo >&2 "Cannot apply private edition changes"
100 + echo >&2 "** Cannot apply private edition changes"
101 git reset --hard
102 }
103 ;;
104 esac &&
105
84 - case "$with_dash" in
85 - y)
86 - case "$branch" in
87 - master | maint | next | jch)
88 - Meta/Make $M -- $J SHELL_PATH=/bin/dash $dotest
89 - ;;
90 - esac
91 - ;;
92 - esac &&
106 + {
107 + test "z$with_dash" != 'zy' ||
108 + Meta/Make $M -- $jobs SHELL_PATH=/bin/dash $dotest
109 + } &&
110
94 - Meta/Make $M -- $J $dotest &&
111 + Meta/Make $M -- $jobs $dotest &&
112 {
113 test -n "$nodoc" ||
114 Meta/Make $M -- doc install-doc
115 } &&
116 +
117 {
118 test z$install = znoinstall ||
119 Meta/Make $M -- install