add a perl script to convert MaintNotes to wiki format
[git/dscho.git] / Dothem
blob3106a30b288f763c67fd80e9f37c4b17d0df0320
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 scratch=
21 while case "$1" in
22 --pedantic | --locale=* | --loose) M="$M $1" ;;
23 --force) force=$1 ;;
24 --dash) with_dash=y ;;
25 --noinstall) install=noinstall ;;
26 --nodoc) nodoc=y ;;
27 --notest) notest=y ;;
28 --test=*) test="$1" ;;
29 --scratch) scratch=y ;;
30 --bootstrap) bootstrap=y ;;
31 --base=*) BUILDBASE=${1#*=} ;;
32 --branches=*) branches=${1#*=} ;;
33 -j*) jobs=$1 ;;
34 -*) echo >&2 "Unknown option: $1"; exit 1 ;;
35 *) break ;;
36 esac
38 shift
39 done
41 sh -c 'asciidoc --version >/dev/null 2>&1' || nodoc=y
43 test -f /bin/dash || with_dash=
44 if test -z "$BUILDBASE"
45 then
46 if test -d "$inst_prefix/buildfarm"
47 then
48 BUILDBASE="$inst_prefix/buildfarm"
49 elif test -d "../buildfarm"
50 then
51 BUILDBASE=../buildfarm
52 else
53 echo >&2 "Buildbase unknown"
54 exit 1
57 test -n "$branches" || branches='next master maint jch pu'
58 test -n "$jobs" || jobs=-j2
60 for branch in $branches
62 echo "** $branch **"
63 revision=$(git show-ref -s --verify "refs/heads/$branch") || {
64 echo "** No $branch"
65 continue
68 if test ! -d "$BUILDBASE/$branch"
69 then
70 if test -z "$bootstrap"
71 then
72 echo "** No $BUILDBASE/$branch"
73 continue
75 "$NWD" . "$BUILDBASE/$branch" $branch &&
76 ln -s "$(pwd)/Meta" "$BUILDBASE/$branch/Meta" || {
77 echo "** Failed to bootstrap $BUILDBASE/$branch"
78 continue
82 private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
83 case $? in 0|1) ;; *) exit $? ;; esac
85 if test -f "$inst_prefix/git-$branch/bin/git" &&
86 installed=$($inst_prefix/git-$branch/bin/git version) &&
87 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
88 then
90 elif version=v$(expr "$installed" : \
91 'git version \(.*\)\.rc[0-9]*$')
92 then
93 version="$version"-$(expr "$installed" : \
94 'git version .*\.\(rc[0-9]*\)$')
95 else
96 version=v$(expr "$installed" : 'git version \(.*\)')
97 fi &&
98 version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
99 test "z$version" = "z$revision"
100 then
101 echo "* up-to-date version \"$installed\" is already installed from $branch"
102 test -n "$force" || continue
106 case "$branch, $branches " in
107 jch,*' next '*)
108 if git diff --quiet --exit-code jch next
109 then
110 dotest=
111 else
112 dotest=test
116 dotest=test ;;
117 esac
118 test -z "$notest" || dotest=
120 cd "$BUILDBASE/$branch"
121 git reset --hard &&
122 case "$(git symbolic-ref HEAD)" in
123 "refs/heads/$branch")
124 : ;;
126 git checkout "$branch" &&
127 git reset --hard || exit
128 esac &&
130 case "$scratch" in
134 Meta/Make clean
136 esac &&
138 case "$private" in
142 git merge --squash --no-commit "$private" || {
143 echo >&2 "** Cannot apply private edition changes"
144 git reset --hard
147 esac &&
149 save=$(git rev-parse HEAD) &&
152 test "z$with_dash" != 'zy' ||
153 Meta/Make $M ${test+"$test"} -- $jobs SHELL_PATH=/bin/dash $dotest
154 } &&
156 Meta/Make $M ${test+"$test"} -- $jobs $dotest &&
159 test -n "$nodoc" ||
160 if test "$save" = "$(git rev-parse HEAD)"
161 then
162 Meta/Make $M -- $jobs doc &&
163 Meta/Make $M -- install-man install-html
164 else
165 echo >&2 "Head moved--not installing docs"
167 } &&
170 test z$install = znoinstall ||
171 if test "$save" = "$(git rev-parse HEAD)"
172 then
173 Meta/Make $M -- install
174 else
175 echo >&2 "Head moved--not installing"
177 } || exit $?
179 git reset --hard
180 ) || break;
182 done