blob: b4a845b23c84e7fe87e0412440b6897e16f7bba7 (
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
359
360
361
|
#!/bin/bash
#
# Author Andy Green <andy.green@linaro.org> 2011-10-21
#
# prcesses README.html from current directory with various
# statistics and uploads it to the remote git repo
. ./stg-push-repos.config
OUT=README.html.cooked
TOPICBG="bgcolor=\"#ddeeFF\""
ENDPOINTBG="bgcolor=\"#eeeedd\""
SUMMARYBG="bgcolor=\"#ffffff\""
UNKNOWNBG="bgcolor=\"#ffffff\""
MAX_CHILD_INDENT=5
RPC=0
REPORTS=linaro-test-status.reports
TEST_OK_BG="bgcolor=\"#ddFFdd\""
TEST_FAIL_BG="bgcolor=\"#FFcccc\""
TEST_QUALIFIED_BG="bgcolor=\"#ffffdd\""
# $1 = branch to check
# $IS_ENDPOINT ! -z if true
function is_endpoint
{
local n
IS_ENDPOINT=
for n in $PUBLIC_NAMES ; do
N1=`echo $n | cut -d'=' -f1`
N2=`echo $n | cut -d'=' -f2`
if [ "$1" == "$N2" ] ; then
IS_ENDPOINT=$N1
fi
done
}
# $1 = starting point
# $FIND_B_PARENT = resulting earliest fonud ancestor
function find_branch_parent
{
local P
P=`cat stg-uplevel-current-branch.parents | grep -v ^# | grep -v .*\ .*\ .* | grep ^$1\ `
if [ ! -z "$P" ] ; then
FIND_B_PARENT=`echo $P | cut -d' ' -f 2`
find_branch_parent $FIND_B_PARENT
fi
}
# $1 indent level
# $2 additional colspan
function do_indent
{
I=0
while [ $I -lt $1 ] ; do
echo "<td> </td>" >> $OUT
I=$(( $I + 1 ))
done
COLS=$(($MAX_CHILD_INDENT - $1 + $2))
echo "<td colspan=\"$COLS\" " >> $OUT
}
# $1 is indent level
# $2 is branch name
# $3 =1 = endpoint bg
# =2= initial parent
# =4= use git to compute distance from basis tree
# =5= as 4 but look for local stgit patches too
function print_topic
{
# echo print_topic $1 $2
echo "<tr>" >> $OUT
if [ $3 -eq 2 ] ; then
do_indent $1 1
else
do_indent $1 0
fi
is_endpoint $2
if [ "$3" -eq 1 -o ! -z "$IS_ENDPOINT" ] ; then
echo -n "$ENDPOINTBG" >> $OUT
else
echo -n "$TOPICBG" >> $OUT
fi
echo "><span style=\"font-size: .75em;\"><a href=\"$GITWEB_BRANCH/$2\">" >> $OUT
echo $2 >> $OUT
echo "</a>" >> $OUT
if [ ! -z "$IS_ENDPOINT" ] ; then
echo "(aka <a href=\"$GITWEB_BRANCH/$IS_ENDPOINT\">$IS_ENDPOINT</a>)" >>$OUT
fi
echo "</span></td>" >> $OUT
if [ $3 -ne 2 ] ; then
echo "<td $TOPICBG align=\"right\"><span style=\"font-size: .75em;\">" >> $OUT
FIND_B_PARENT=$2
find_branch_parent $2
if [ "$FIND_B_PARENT" == "$2" ] ; then
FIND_B_PARENT=$COMMON_PARENT_BASIS
fi
if [ $3 -eq 4 ] ; then
S=`git log --oneline $FIND_B_PARENT..$2 | wc -l`
echo $S >> $OUT
else
if [ $3 -eq 5 ] ; then
S=`git log --oneline $FIND_B_PARENT..$2 | wc -l`
L=`stg series -b $2 | wc -l`
S=$(( $S - $L ))
echo "$S (+ $L local)" >> $OUT
S=$(( $S + $L ))
else
S=`stg series -b $2 | wc -l`
echo $S >> $OUT
fi
fi
echo "</span></td>" >> $OUT
fi
echo "</tr>" >> $OUT
}
# $1 is indent level
# $2 is patch count
function print_summary
{
# echo print_summary $1 $2
echo "<tr>" >> $OUT
do_indent $1 2
echo "$SUMMARYBG align=\"center\"><span style=\"font-size: 1em;\">" >> $OUT
echo "$2 patches" >> $OUT
echo "</span></td></tr>" >> $OUT
}
# arg1 is entry indent level, arg2 is parent, arg3 is running patch count
function do_children
{
local L_RPC
local NEXTLEV
# echo "do_children $1 $2 $3"
L_RPC=$3
NEXTLEV=$(( $1 + 1 ))
# deal with all the children
NUMCHILDREN=`cat stg-uplevel-current-branch.parents | grep -v ^# | grep -v .*\ .*\ .* | grep \ $2\$ | cut -d' ' -f1 | wc -l`
# echo $1 / $L_RPC : children of $2 == $NUMCHILDREN
if [ $NUMCHILDREN -eq 0 ] ; then
print_summary $1 $L_RPC
return;
fi
if [ $NUMCHILDREN -eq 1 ] ; then
CHILD=`cat stg-uplevel-current-branch.parents | grep -v ^# | grep -v .*\ .*\ .* | grep \ $2\$ | cut -d' ' -f1`
print_topic $1 $CHILD 0
L_RPC=$(( $L_RPC + $S ))
do_children $1 $CHILD $L_RPC
return;
fi
# echo "*** doing multi-children of $2 -->"
print_summary $1 $L_RPC
for i in `cat stg-uplevel-current-branch.parents | grep -v ^# | grep -v .*\ .*\ .* | grep \ $2\$ | cut -d' ' -f1` ; do
if [ "$i" != "$2" ] ; then
# echo " doing child $NEXTLEV $i $L_RPC"
print_topic $NEXTLEV $i $L_RPC 0
do_children $NEXTLEV $i $(( $L_RPC + $S ))
fi
done
# echo "<-- done multi-children of $2"
}
echo "Processing README.html, might take a minute..."
rm -f $OUT
cat README.html | while read line ; do
if [ ! -z "`echo $line | grep '<!--AHEAD'`" ] ; then
FILTER="`echo $line | cut -d' ' -f2`"
LAST_TAG=`git for-each-ref --sort='*authordate' --format='%(refname:short)' refs/tags | grep ^v.\. | tail -n1`
git log --oneline $LAST_TAG..$FILTER | wc -l >> $OUT
echo " patches ahead of $LAST_TAG" >> $OUT
continue
fi
if [ ! -z "`echo $line | grep '<!--TESTSTATUS'`" ] ; then
rm -f .README-footer
echo 1 > .README-note
echo "<table margin=\"1\" border=\"1\" width=\"100%\">" >> $OUT
FILTER="`echo $line | cut -d' ' -f2`"
FILTER_HEAD=`git log --pretty=format:%H -n 1 $FILTER`
L=0
for s in `git show $FILTER:linaro-test-status` ; do
if [ $L -eq 0 ] ; then
echo "<tr>" >> $OUT
fi
rm -f .README-qualified
echo $UNKNOWNBG > .README-bg
cat $REPORTS | grep ^$s\ $FILTER | while read qq ; do
H=`echo $qq | cut -d' ' -f3`
COMMENT=`echo $qq | cut -d' ' -f5-`
if [ "$H" == "$FILTER_HEAD" ] ; then
# it'll be the last one if seen
if [ -z "$COMMENT" ] ; then
rm -f .README-qualified
echo $TEST_OK_BG > .README-bg
else
if [ ! -z "`echo $COMMENT | grep ^FAIL`" ] ; then
rm -f .README-qualified
echo $TEST_FAIL_BG > .README-bg
if [ ! -z "`echo $COMMENT | cut -d' ' -f2-`" ] ; then
touch .README-qualified
echo $COMMENT > .README-qualification
fi
else
echo $TEST_QUALIFIED_BG > .README-bg
touch .README-qualified
echo $COMMENT > .README-qualification
fi
fi
fi
done
BG=`cat .README-bg`
echo "<td $BG align=\"center\" valign=\"middle\"><span style=\"font-size: .75em;\">" >> $OUT
echo $s >> $OUT
if [ -e .README-qualified ] ; then
N=`cat .README-note`
echo " [ $N ]" >> $OUT
echo "[ $N ] " >> .README-footer
cat .README-qualification >> .README-footer
echo "<br/>" >> .README-footer
N=`cat .README-note`
N=$(( $N + 1 ))
echo $N > .README-note
fi
echo "</span></td>" >> $OUT
L=$(( $L + 1 ))
if [ $L -eq 4 ] ; then
echo "</tr>" >> $OUT
L=0
fi
done
if [ $L -ne 0 ] ; then
echo "</tr>" >> $OUT
fi
echo "</table>" >> $OUT
if [ -e .README-footer ] ; then
cat .README-footer >> $OUT
fi
continue
fi
if [ ! -z "`echo $line | grep '<!--RUNNING'`" ] ; then
echo "<table width=\"100%\" cellspacing=\"3\" cellpadding=\"3\">" >> $OUT
FILTER="`echo $line | cut -d' ' -f2`"
INITIAL=`cat stg-uplevel-current-branch.parents | grep -v ^# | grep -v .*\ .*\ .* | grep $FILTER | head -n 1`
if [ ! -z "$INITIAL" ] ; then
# treat as a topic series
FIRST=`echo $INITIAL | cut -d ' ' -f 1`
PARENT=`echo $INITIAL | cut -d ' ' -f 2`
print_topic 0 $PARENT 2
print_topic 1 $FIRST 0
do_children 1 $FIRST $S
else
INITIAL=`cat stg-uplevel-current-branch.parents | grep -v ^# | grep ^$FILTER | head -n 1`
B=`echo $INITIAL | cut -d' ' -f2`
find_branch_parent $B
if [ "$B" != "$FIND_B_PARENT" ] ; then
COMMON_PARENT_BASIS=$FIND_B_PARENT
else
B=`echo $INITIAL | cut -d' ' -f3`
find_branch_parent $B
if [ "$B" != "$FIND_B_PARENT" ] ; then
COMMON_PARENT_BASIS=$FIND_B_PARENT
else
echo "unable to deduce common branch ancestor..."
fi
fi
# it's a rebase story
echo >> $OUT
echo "<tr>" >> $OUT
echo "<td>" >> $OUT
echo "<table width=\"100%\" cellspacing=\"1\" cellpadding=\"1\">" >> $OUT
print_topic 0 `echo $INITIAL | cut -d' ' -f2` 4
echo "</table>" >> $OUT
echo "</td></tr>" >> $OUT
echo >> $OUT
echo "<tr><td align=\"center\">rebased with</td></tr>" >> $OUT
echo >> $OUT
echo "<tr><td>" >> $OUT
echo "<table width=\"100%\" cellspacing=\"1\" cellpadding=\"1\">" >> $OUT
print_topic 0 `echo $INITIAL | cut -d' ' -f3` 4
echo "</table>" >> $OUT
echo "</td></tr>" >> $OUT
echo >> $OUT
echo "<tr><td align=\"center\">produces</td></tr>" >> $OUT
echo >>$OUT
echo "<tr><td align=\"center\">" >> $OUT
echo "<table width=\"100%\" cellspacing=\"1\" cellpadding=\"1\">" >> $OUT
print_topic 0 `echo $INITIAL | cut -d' ' -f1` 5
echo "</table>" >> $OUT
echo "</td></tr>" >>$OUT
echo >> $OUT
fi
echo "</table>" >> $OUT
continue;
fi
echo $line | sed "s!\$GITWEB_BRANCH!$GITWEB_BRANCH!g" >> $OUT
done
scp $OUT $CREDS:$REPO/README.html
|