blob: 51f086479d2017bfe16a4fff1350308b4bf46c81 (
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
|
#!/bin/bash
set -euf -o pipefail
set -x
old="$HOME/interesting-commits"
git="git -C $old"
new="$HOME/interesting"
component_repo ()
{
local c="$1"
case "$c" in
llvm) c="llvm-project" ;;
binutils|gdb) c="binutils-gdb" ;;
esac
echo "$HOME/interesting-repos/$c.git"
}
prepare_git_repos ()
{
local -A interesting_url
interesting_url[binutils]=git://sourceware.org/git/binutils-gdb.git
interesting_url[gdb]=git://sourceware.org/git/binutils-gdb.git
interesting_url[gcc]=https://github.com/gcc-mirror/gcc.git
interesting_url[linux]=https://git.linaro.org/kernel-org/linux.git
interesting_url[glibc]=git://sourceware.org/git/glibc.git
interesting_url[newlib]=git://sourceware.org/git/newlib-cygwin.git
interesting_url[llvm]=https://github.com/llvm/llvm-project.git
interesting_url[qemu]=https://gitlab.com/qemu-project/qemu.git
for c in binutils gdb gcc linux glibc newlib llvm qemu; do
url="${interesting_url[$c]}"
repo=$(component_repo $c)
if [ -d $repo ]; then
git -C $repo remote update -p
else
reference_opt=""
reference_dir=$(basename "$(component_repo $c)")
reference_dir="/home/tcwg-buildslave/snapshots-ref/$reference_dir"
if [ -d $reference_dir ]; then
reference_opt="--reference $reference_dir"
fi
git clone --bare $reference_opt $url $repo
case "$c" in
linux)
git -C $repo remote add stable https://git.linaro.org/kernel-org/linux-stable.git
git -C $repo remote update -p
;;
esac
fi
done
$git remote update -p
$git reset -q --hard
$git clean -fd
}
prepare_git_repos
declare -A describe_cache
describe_sha1 ()
{
local component="$1"
local sha1="$2"
if [ x"${describe_cache[$component#$sha1]-unset}" = x"unset" ]; then
echo "$component#$sha1" >> $HOME/tmp/miss
local -a match=()
case "$component" in
gcc) match=(--match "basepoints/*" --match "releases/*") ;;
binutils) match=(--exclude "users/*") ;;
newlib) match=(--match "newlib*") ;;
esac
describe_cache[$component#$sha1]=$(git -C "$(component_repo $component)" describe "${match[@]}" $sha1 || true)
fi
}
update_entry ()
{
local component="$1"
local sha1="$2"
local ci_project="$3"
local ci_config="$4"
local bisect_url="$5"
local last_good="$6"
if ! git -C "$(component_repo $component)" rev-parse --verify $sha1 2>/dev/null; then
return
fi
describe_sha1 "$component" "$sha1"
local describe="${describe_cache[$component#$sha1]}"
if ! [ -d $new/$component/sha1/$sha1 ] \
&& [ x"$describe" != x"" ]; then
local d
d=$(dirname "$describe")
mkdir -p $new/$component/$d
local symlink=""
while [ x"$d" != x"." ]; do
symlink="../$symlink"
d=$(dirname "$d")
done
symlink="${symlink}sha1/$sha1"
ln -s $symlink $new/$component/$describe
fi
mkdir -p $new/$component/sha1/$sha1/$ci_project/$ci_config
echo "$bisect_url" > $new/$component/sha1/$sha1/$ci_project/$ci_config/build_url
if [ x"$last_good" != x"" ]; then
echo "$last_good" \
> $new/$component/sha1/$sha1/$ci_project/$ci_config/last_good
fetch_summary "$bisect_url" \
$new/$component/sha1/$sha1/$ci_project/$ci_config
if [ x"$describe" = x"" ]; then
describe="$ci_project#$sha1"
fi
generate_status "$describe" $component/sha1/$sha1 $ci_project
fi
}
fetch_dir=$HOME/interesting-repos/fetch-cache
fetch_summary ()
{
local bisect_url="$1"
local out="$2"
local cache_url="${bisect_url#https://}"
if ! [ -f $fetch_dir/$cache_url/summary.txt ]; then
mkdir -p $fetch_dir/$cache_url/
curl -o $fetch_dir/$cache_url/summary.txt \
${bisect_url}artifact/artifacts/build-first_bad/mail/jira-body.txt \
--fail &
if wait $!; then
sed -i -e "/^[^-]/d" -e "/^\$/d" -e "s/^- //" \
$fetch_dir/$cache_url/summary.txt
else
echo > $fetch_dir/$cache_url/summary.txt
fi
fi
cp $fetch_dir/$cache_url/summary.txt $out/summary.txt
}
generate_status ()
{
local describe="$1"
local subdir="$2"
local ci_project="$3"
local interesting_commits="$new"
local status="$subdir/$ci_project/status.txt"
local ci_config
cat > $interesting_commits/$status <<EOF
Status of $describe commit for $ci_project ci_project:
EOF
for ci_config in $(cd $interesting_commits/$subdir/$ci_project; set +f; echo *); do
if ! [ -f "$interesting_commits/$subdir/$ci_project/$ci_config/summary.txt" ]; then
continue
fi
echo "* $ci_config"
(
cat $interesting_commits/$subdir/$ci_project/$ci_config/summary.txt
cat $interesting_commits/$subdir/$ci_project/$ci_config/build_url
) | sed "s/^/** /"
done >> $interesting_commits/$status
}
rm -rf "$new"
mkdir -p "$new"
while IFS= read -r branch; do
$git checkout --detach $branch
while true; do
ci_project=${branch# *origin/linaro-local/ci/}
bisect_url=$($git show --pretty=%s --no-patch | sed -e "s/.* from //")
pushd $old
while read component; do
ci_config=""
arr=()
while read -a arr; do
if [ ${#arr[@]} -gt 1 ]; then
sha1="${arr[0]}"
if [ x"$sha1" != x"e5a9d60317852a7323e46109fa366e630b8b5bae" ]; then
#continue
:
fi
for ci_project_config in "${arr[@]:1}"; do
ci_project2=${ci_project_config%/*}
ci_config=${ci_project_config#*/}
if [ x"$ci_project" != x"$ci_project2" ]; then
echo "ERROR: ci_project mismatch"
exit 1
fi
update_entry "$component" "$sha1" "$ci_project" "$ci_config" "$bisect_url" ""
done
elif [ x"$ci_config" != x"" ]; then
if [ x"$sha1" != x"e5a9d60317852a7323e46109fa366e630b8b5bae" ]; then
#continue
:
fi
last_good="${arr[0]}"
update_entry "$component" "$sha1" "$ci_project" "$ci_config" "$bisect_url" "$last_good"
fi
done < <(tac $component)
done < <(ls)
popd
if ! $git rev-parse --verify HEAD^ 2>/dev/null; then
break
fi
$git checkout --detach HEAD^
done
done < <($git branch -r --list "origin/linaro-local/*")
|