blob: 4ca3757f8084c3b5303e1086772125f304d6d6cb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
|
#!/bin/sh
NWD=contrib/workdir/git-new-workdir
MASTER=master
section () {
printf "\033]0;%s %s\007" "$branch" "$*"
printf "\n\n\n"
printf "############ %s %s\n" "$branch" "$*"
printf "\n\n\n"
}
inst_prefix=$(
IFS=:
for p in $PATH
do
probed=${p%/git-active/bin}
if test "$probed" != "$p"
then
echo "$probed"
exit
fi
done
echo $HOME
)
force= with_dash= test_long= M= install= doc= notest= bootstrap= branches= jobs=
scratch= noprove= memtrash=--memtrash with_cocci= with_leaks= with_sha256= san=
clean= with_meson= breaking=
while case "$1" in
--pedantic | --locale=* | --loose) M="$M $1" ;;
--force) force=$1 ;;
--dash) with_dash=y ;;
--clean) clean=y ;;
--cocci) with_cocci=y ;;
--no-cocci) with_cocci= ;;
--long) test_long=--long ;;
--noinstall) install=noinstall ;;
--nodoc) doc=no ;;
--asciidoc) doc=asciidoc ;;
--asciidoctor) doc=ascidoctor ;;
--notest) notest=y ;;
--nomemtrash) memtrash= ;;
--memtrash) memtrash=--memtrash ;;
--test=*) test="$1" ;;
--scratch) scratch=y ;;
--breaking) breaking=breaking ;;
--no-breaking) breaking= ;;
--bootstrap) bootstrap=y ;;
--base=*) BUILDBASE=${1#*=} ;;
--branches=*) branches=${1#*=} ;;
--noprove) noprove=$1 ;;
--san) san=t ;;
--no-san) san= ;;
--leaks) with_leaks=t ;;
--no-leaks) with_leaks= ;;
--sha256) with_sha256=t ;;
--no-sha256) with_sha256= ;;
--meson) with_meson=t ;;
-j*) jobs=$1 ;;
--) shift; break ;;
-*) echo >&2 "Unknown option: $1"; exit 1 ;;
*) break ;;
esac
do
shift
done
if test -n "$doc"
then
: ;# happy with whatever specified
elif sh -c 'asciidoc --version >/dev/null 2>&1'
then
doc=asciidoc
elif sh -c 'asciidoctor --version >/dev/null 2>&1'
then
doc=asciidoctor
else
doc=no
fi
if test "$doc" = asciidoctor
then
USE_ASCIIDOCTOR=YesPlease
else
USE_ASCIIDOCTOR=
fi
GIT_TEST_CHAIN_LINT=1
export GIT_TEST_CHAIN_LINT
GIT_PROVE_OPTS="${GIT_PROVE_OPTS:+$GIT_PROVE_OPTS }--state=slow,save"
export GIT_PROVE_OPTS
TEST_CONTRIB_TOO=YesPlease
export TEST_CONTRIB_TOO
test -f /bin/dash || with_dash=
if test -z "$BUILDBASE"
then
if test -d "$inst_prefix/buildfarm"
then
BUILDBASE="$inst_prefix/buildfarm"
elif test -d "../buildfarm"
then
BUILDBASE=../buildfarm
else
echo >&2 "Buildbase unknown"
exit 1
fi
fi
test -n "$branches" || branches="next $MASTER maint jch seen"
test -n "$jobs" || jobs=-j32
find_installed () {
branch=$1
test -f "$inst_prefix/git-$branch/bin/git" &&
installed=$($inst_prefix/git-$branch/bin/git version) &&
if version=$(expr "$installed" : '.*\.g\([0-9a-f]*\)$')
then
:
elif version=v$(expr "$installed" : \
'git version \(.*\)\.rc[0-9]*$')
then
version="$version"-$(expr "$installed" : \
'git version .*\.\(rc[0-9]*\)$')
else
version=v$(expr "$installed" : 'git version \(.*\)')
fi &&
git rev-parse --verify "$version^0" 2>/dev/null
}
installed_source_trees=" "
for branch in $branches
do
if v=$(find_installed $branch) &&
test -n "$v" &&
v=$(git rev-parse --verify "$v^{tree}" 2>/dev/null)
then
installed_source_trees="$installed_source_trees$v "
fi
done
for branch in $branches
do
echo "** $branch **"
revision=$(git show-ref -s --verify "refs/heads/$branch") || {
echo "** No $branch"
continue
}
if test ! -d "$BUILDBASE/$branch"
then
if test -z "$bootstrap"
then
echo "** No $BUILDBASE/$branch"
continue
fi
"$NWD" . "$BUILDBASE/$branch" $branch &&
ln -s "$(pwd)/Meta" "$BUILDBASE/$branch/Meta" || {
echo "** Failed to bootstrap $BUILDBASE/$branch"
continue
}
fi
version=$(find_installed $branch)
if test "z$version" = "z$revision"
then
echo "* up-to-date version is already installed from $branch"
test -n "$force" || continue
fi
private=$(git rev-parse -q --verify private-$branch 2>/dev/null)
case $? in 0|1) ;; *) exit $? ;; esac
vtree=$(git rev-parse --verify "$version^{tree}")
rtree=$(git rev-parse --verify "$revision^{tree}")
(
skip_test=$notest
case "$doc" in no) skip_doc=1 ;; *) skip_doc= ;; esac
case "$force" in
?*)
;;
'')
for xtree in $installed_source_trees $vtree
do
if test "z$xtree" = "z$rtree" ||
git diff --quiet "$xtree" "$rtree" -- . \
':!GIT-VERSION-GEN' \
':!RelNotes' \
':!Documentation/'
then
skip_test=1
break
fi
done
dvtree=$(git rev-parse --verify "$version:Documentation/")
drtree=$(git rev-parse --verify "$revision:Documentation/")
if test "z$dvtree" = "z$drtree"
then
skip_doc=1
fi
;;
esac
case "$skip_test" in
?*) dotest= ;;
'') dotest=test ;;
esac
cd "$BUILDBASE/$branch"
git reset --hard &&
case "$scratch$clean" in
'')
;;
*y*)
saveMeta=$(readlink Meta)
Meta/Make distclean
git clean -f -x -d
ln -s "$saveMeta" Meta
;;
esac &&
case "$(git symbolic-ref HEAD)" in
"refs/heads/$branch")
: ;;
*)
git checkout "$branch" &&
git reset --hard || exit
esac &&
case "$clean" in
y) exit 0 ;;
esac &&
case "$private" in
'')
;;
?*)
git merge --squash --no-commit "$private" || {
echo >&2 "** Cannot apply private edition changes"
git reset --hard
}
;;
esac &&
save=$(git rev-parse HEAD) &&
if test -n "$with_meson" && test -f "meson.build"
then
section meson
rm -fr "../.$branch.boson" &&
meson setup "../.$branch.boson" &&
(
cd "../.$branch.boson" &&
meson compile &&
meson test
) || exit $?
fi &&
# cocci
if test -n "$with_cocci"
then
section coccicheck
Meta/Make $M $jobs -- coccicheck
fi &&
# sparse
section sparse
Meta/Make $M $jobs -- NO_REGEX=NoThanks \
SPARSE_FLAGS=-Wsparse-error sparse &&
rm -f compat/regex/regex.o &&
# hdr
section hdr-check
Meta/Make $M $jobs -- hdr-check &&
# test-lint
section test-lint
Meta/Make -- -C t test-lint &&
did_test=
if test -n "$san"
then
section SANITIZE=address,undefined
did_test=did_test
SANITIZE=address,undefined Meta/Make $M $jobs $T test &&
rm -f compat/mmap.o &&
Meta/Make >/dev/null distclean
fi &&
if test -n "$with_leaks"
then
section leaks
did_test=did_test
SANITIZE=leak \
GIT_TEST_PASSING_SANITIZE_LEAK=true \
Meta/Make $jobs $T CC=clang test &&
Meta/Make >/dev/null distclean
fi &&
if test -n "$with_sha256"
then
section sha256
did_test=did_test
GIT_TEST_DEFAULT_HASH=sha256 Meta/Make $jobs $T test
fi &&
if test -n "$breaking"
then
section breaking
did_test=did_test
Meta/Make >/dev/null distclean &&
Meta/Make $jobs WITH_BREAKING_CHANGES=YesPlease $T test &&
Meta/Make >/dev/null distclean
fi &&
if test "$did_test$dotest" = test
then
section test
Meta/Make $M $noprove ${test+"$test"} $jobs $test_long \
$memtrash \
-- ${with_dash:+SHELL_PATH=/bin/dash} "$@" $T $dotest
fi &&
# docs
{
test -n "$skip_doc" ||
if test "$save" = "$(git rev-parse HEAD)"
then
section docs
Meta/Make $M $jobs -- check-docs &&
Meta/Make $M $jobs -- $USE_ASCIIDOCTOR doc &&
Meta/Make $M -- install-man install-html
else
echo >&2 "Head moved--not installing docs"
fi
} &&
{
test z$install = znoinstall ||
if test "$save" = "$(git rev-parse HEAD)"
then
section install
Meta/Make >/dev/null distclean &&
Meta/Make $jobs $M \
-- ${with_dash:+SHELL_PATH=/bin/dash} "$@" install
else
echo >&2 "Head moved--not installing"
fi
} || exit $?
git reset --hard
) </dev/null || exit $?
installed_source_trees="$installed_source_trees$rtree "
done
|