Meta/Doit: retire unused script
[alt-git.git] / Dothem
blob71bfc59ec3410e3bd0fbd876ea2644bddc9e398b
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 for TRASH in /dev/shm /tmp ""
43 if test -n "$TRASH" && test -d "$TRASH" && test -w "$TRASH"
44 then
45 TRASH="--root=$TRASH/testpen"
46 break
48 done
50 sh -c 'asciidoc --version >/dev/null 2>&1' || nodoc=y
51 if sh -c 'prove --version >/dev/null 2>&1' &&
52 sh -c 'prove --exec : >/dev/null 2>&1'
53 then
54 DEFAULT_TEST_TARGET=prove GIT_PROVE_OPTS="$jobs"
55 export DEFAULT_TEST_TARGET GIT_PROVE_OPTS
57 GIT_TEST_OPTS="$TRASH${GIT_TEST_OPTS+" $GIT_TEST_OPTS"}"
58 export GIT_TEST_OPTS
60 test -f /bin/dash || with_dash=
61 if test -z "$BUILDBASE"
62 then
63 if test -d "$inst_prefix/buildfarm"
64 then
65 BUILDBASE="$inst_prefix/buildfarm"
66 elif test -d "../buildfarm"
67 then
68 BUILDBASE=../buildfarm
69 else
70 echo >&2 "Buildbase unknown"
71 exit 1
74 test -n "$branches" || branches='next master maint jch pu'
75 test -n "$jobs" || jobs=-j2
77 for branch in $branches
79 echo "** $branch **"
80 revision=$(git show-ref -s --verify "refs/heads/$branch") || {
81 echo "** No $branch"
82 continue
85 if test ! -d "$BUILDBASE/$branch"
86 then
87 if test -z "$bootstrap"
88 then
89 echo "** No $BUILDBASE/$branch"
90 continue
92 "$NWD" . "$BUILDBASE/$branch" $branch &&
93 ln -s "$(pwd)/Meta" "$BUILDBASE/$branch/Meta" || {
94 echo "** Failed to bootstrap $BUILDBASE/$branch"
95 continue
99 private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
100 case $? in 0|1) ;; *) exit $? ;; esac
102 if test -f "$inst_prefix/git-$branch/bin/git" &&
103 installed=$($inst_prefix/git-$branch/bin/git version) &&
104 if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
105 then
107 elif version=v$(expr "$installed" : \
108 'git version \(.*\)\.rc[0-9]*$')
109 then
110 version="$version"-$(expr "$installed" : \
111 'git version .*\.\(rc[0-9]*\)$')
112 else
113 version=v$(expr "$installed" : 'git version \(.*\)')
114 fi &&
115 version=$(git rev-parse --verify "$version^0" 2>/dev/null) &&
116 test "z$version" = "z$revision"
117 then
118 echo "* up-to-date version \"$installed\" is already installed from $branch"
119 test -n "$force" || continue
123 skip_test=$notest
124 case ",$version,$revision," in
125 *,,*)
128 if git diff --quiet --exit-code $version $revision
129 then
130 skip_test=1
133 esac
134 case "$branch, $branches " in
135 jch,*' next '*)
136 if git diff --quiet --exit-code jch next
137 then
138 skip_test=1
141 esac
142 case "$skip_test" in
143 ?*) dotest= ;;
144 '') dotest=test ;;
145 esac
147 cd "$BUILDBASE/$branch"
148 git reset --hard &&
149 case "$(git symbolic-ref HEAD)" in
150 "refs/heads/$branch")
151 : ;;
153 git checkout "$branch" &&
154 git reset --hard || exit
155 esac &&
157 case "$scratch" in
161 Meta/Make clean
163 esac &&
165 case "$private" in
169 git merge --squash --no-commit "$private" || {
170 echo >&2 "** Cannot apply private edition changes"
171 git reset --hard
174 esac &&
176 save=$(git rev-parse HEAD) &&
178 Meta/Make $M ${test+"$test"} $jobs -- ${with_dash:+SHELL_PATH=/bin/dash} $dotest &&
181 test -n "$nodoc" ||
182 if test "$save" = "$(git rev-parse HEAD)"
183 then
184 Meta/Make $M $jobs -- doc &&
185 Meta/Make $M -- install-man install-html
186 else
187 echo >&2 "Head moved--not installing docs"
189 } &&
192 test z$install = znoinstall ||
193 if test "$save" = "$(git rev-parse HEAD)"
194 then
195 Meta/Make $M -- install
196 else
197 echo >&2 "Head moved--not installing"
199 } || exit $?
201 git reset --hard
202 ) </dev/null || exit $?
204 done