What's in before 1.6.4 final
[git/spearce.git] / Dothem
blob8c59d404f8733b8f5afb031151922690ed8ebd1b
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
39 sh -c 'asciidoc --version >/dev/null 2>&1' || nodoc=y
41 test -f /bin/dash || with_dash=
42 if test -z "$BUILDBASE"
43 then
44 if test -d "$inst_prefix/buildfarm"
45 then
46 BUILDBASE="$inst_prefix/buildfarm"
47 elif test -d "../buildfarm"
48 then
49 BUILDBASE=../buildfarm
50 else
51 echo >&2 "Buildbase unknown"
52 exit 1
55 test -n "$branches" || branches='next master maint pu jch'
56 test -n "$jobs" || jobs=-j2
58 for branch in $branches
60 echo "** $branch **"
61 revision=$(git show-ref -s --verify "refs/heads/$branch") || {
62 echo "** No $branch"
63 continue
66 if test ! -d "$BUILDBASE/$branch"
67 then
68 if test -z "$bootstrap"
69 then
70 echo "** No $BUILDBASE/$branch"
71 continue
73 "$NWD" . "$BUILDBASE/$branch" $branch &&
74 ln -s "$(pwd)/Meta" "$BUILDBASE/$branch/Meta" || {
75 echo "** Failed to bootstrap $BUILDBASE/$branch"
76 continue
80 private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
81 case $? in 0|1) ;; *) exit $? ;; esac
83 if test -f "$inst_prefix/git-$branch/bin/git" &&
84 installed=$($inst_prefix/git-$branch/bin/git version) &&
85 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
86 then
88 elif version=v$(expr "$installed" : \
89 'git version \(.*\)\.rc[0-9]*$')
90 then
91 version="$version"-$(expr "$installed" : \
92 'git version .*\.\(rc[0-9]*\)$')
93 else
94 version=v$(expr "$installed" : 'git version \(.*\)')
95 fi &&
96 version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
97 test "z$version" = "z$revision"
98 then
99 echo "* up-to-date version \"$installed\" is already installed from $branch"
100 test -n "$force" || continue
104 case "$branch, $branches " in
105 jch,*' next '*)
106 if git diff --quiet --exit-code jch next
107 then
108 dotest=
109 else
110 dotest=test
114 dotest=test ;;
115 esac
116 test -z "$notest" || dotest=
118 cd "$BUILDBASE/$branch"
119 git reset --hard &&
120 case "$(git symbolic-ref HEAD)" in
121 "refs/heads/$branch")
122 : ;;
124 git checkout "$branch" &&
125 git reset --hard || exit
126 esac &&
128 case "$private" in
132 git merge --squash --no-commit "$private" || {
133 echo >&2 "** Cannot apply private edition changes"
134 git reset --hard
137 esac &&
140 test "z$with_dash" != 'zy' ||
141 Meta/Make $M $test -- $jobs SHELL_PATH=/bin/dash $dotest
142 } &&
144 Meta/Make $M $test -- $jobs $dotest &&
146 test -n "$nodoc" ||
147 Meta/Make $M -- doc install-doc
148 } &&
151 test z$install = znoinstall ||
152 Meta/Make $M -- install
153 } || exit $?
155 git reset --hard
156 ) || break;
158 done