What's cooking
[git/spearce.git] / Dothem
blob1a987468d7480e79d4a6c0ba9940116f5ed06768
1 #!/bin/sh
3 NWD=contrib/workdir/git-new-workdir
5 inst_prefix=$(
6 IFS=:
7 for p in $PATH
8 do
9 probed=${p%/git-active/bin}
10 if test "$probed" != "$p"
11 then
12 echo "$probed"
13 exit
15 done
16 echo $HOME
19 force= with_dash= M= install= nodoc= notest= bootstrap= branches= jobs=
20 while case "$1" in
21 --pedantic | --locale=* | --loose) M="$M $1" ;;
22 --force) force=$1 ;;
23 --dash) with_dash=y ;;
24 --noinstall) install=noinstall ;;
25 --nodoc) nodoc=y ;;
26 --notest) notest=y ;;
27 --test=*) test="$1" ;;
28 --bootstrap) bootstrap=y ;;
29 --base=*) BUILDBASE=${1#*=} ;;
30 --branches=*) branches=${1#*=} ;;
31 -j*) jobs=$1 ;;
32 -*) echo >&2 "Unknown option: $1"; exit 1 ;;
33 *) break ;;
34 esac
36 shift
37 done
38 test -f /bin/dash || with_dash=
39 if test -z "$BUILDBASE"
40 then
41 if test -d "$inst_prefix/buildfarm"
42 then
43 BUILDBASE="$inst_prefix/buildfarm"
44 elif test -d "../buildfarm"
45 then
46 BUILDBASE=../buildfarm
47 else
48 echo >&2 "Buildbase unknown"
49 exit 1
52 test -n "$branches" || branches='next master maint pu jch'
53 test -n "$jobs" || jobs=-j2
55 for branch in $branches
57 echo "** $branch **"
58 revision=$(git show-ref -s --verify "refs/heads/$branch") || {
59 echo "** No $branch"
60 continue
63 if test ! -d "$BUILDBASE/$branch"
64 then
65 if test -z "$bootstrap"
66 then
67 echo "** No $BUILDBASE/$branch"
68 continue
70 "$NWD" . "$BUILDBASE/$branch" $branch &&
71 ln -s "$(pwd)/Meta" "$BUILDBASE/$branch/Meta" || {
72 echo "** Failed to bootstrap $BUILDBASE/$branch"
73 continue
77 private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
78 case $? in 0|1) ;; *) exit $? ;; esac
80 if test -f "$inst_prefix/git-$branch/bin/git" &&
81 installed=$($inst_prefix/git-$branch/bin/git version) &&
82 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
83 then
85 elif version=v$(expr "$installed" : \
86 'git version \(.*\)\.rc[0-9]*$')
87 then
88 version="$version"-$(expr "$installed" : \
89 'git version .*\.\(rc[0-9]*\)$')
90 else
91 version=v$(expr "$installed" : 'git version \(.*\)')
92 fi &&
93 version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
94 test "z$version" = "z$revision"
95 then
96 echo "* up-to-date version \"$installed\" is already installed from $branch"
97 test -n "$force" || continue
101 case "$branch, $branches " in
102 jch,*' next '*)
103 if git diff --quiet --exit-code jch next
104 then
105 dotest=
106 else
107 dotest=test
111 dotest=test ;;
112 esac
113 test -z "$notest" || dotest=
115 cd "$BUILDBASE/$branch"
116 git reset --hard &&
117 case "$(git symbolic-ref HEAD)" in
118 "refs/heads/$branch")
119 : ;;
121 git checkout "$branch" &&
122 git reset --hard || exit
123 esac &&
125 case "$private" in
129 git merge --squash --no-commit "$private" || {
130 echo >&2 "** Cannot apply private edition changes"
131 git reset --hard
134 esac &&
137 test "z$with_dash" != 'zy' ||
138 Meta/Make $M $test -- $jobs SHELL_PATH=/bin/dash $dotest
139 } &&
141 Meta/Make $M $test -- $jobs $dotest &&
143 test -n "$nodoc" ||
144 Meta/Make $M -- doc install-doc
145 } &&
148 test z$install = znoinstall ||
149 Meta/Make $M -- install
150 } || exit $?
152 git reset --hard
153 ) || break;
155 done