blob: b1bbb981fc0fd948d2d1fd030cf54ec9b36fbd4c (
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
|
#!/bin/sh
# report about status of build master - according to mysql database
# shellcheck source=conf/default.conf
. "${0%/*}/../conf/default.conf"
tmp_dir=$(mktemp -d 'tmp.build-master-status-from-mysql.XXXXXXXXXX' --tmpdir)
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
# shellcheck disable=SC2016
{
printf 'SELECT DISTINCT `package_sources`.`pkgbase`,`package_sources`.`git_revision`,`package_sources`.`mod_git_revision`,`upstream_repositories`.`name`'
printf ' FROM `package_sources`'
printf ' JOIN `%s` ON `%s`.`%s`=`%s`.`id`' \
'upstream_repositories' 'package_sources' 'upstream_package_repository' 'upstream_repositories' \
'build_assignments' 'build_assignments' 'package_source' 'package_sources' \
'binary_packages' 'binary_packages' 'build_assignment' 'build_assignments' \
'repositories' 'binary_packages' 'repository' 'repositories'
printf ' WHERE `repositories`.`name`="build-list"'
} | \
${mysql_command} --batch | \
sed '
1d
y/\t/ /
' | \
sort > \
"${tmp_dir}/build-list.mysql"
sort "${work_dir}/build-list" > \
"${tmp_dir}/build-list.file"
# shellcheck disable=SC2016
{
printf 'SELECT DISTINCT `package_sources`.`pkgbase`'
printf ' FROM `package_sources`'
printf ' JOIN `%s` ON `%s`.`%s`=`%s`.`id`' \
'build_assignments' 'build_assignments' 'package_source' 'package_sources' \
'binary_packages' 'binary_packages' 'build_assignment' 'build_assignments' \
'repositories' 'binary_packages' 'repository' 'repositories'
printf ' WHERE `repositories`.`name`="deletion-list";\n'
} | \
${mysql_command} --batch | \
sed '
1d
y/\t/ /
' | \
sort > \
"${tmp_dir}/deletion-list.mysql"
sort "${work_dir}/deletion-list" > \
"${tmp_dir}/deletion-list.file"
# shellcheck disable=SC2016
{
printf 'SELECT `package_sources`.`pkgbase`'
printf ' FROM `package_sources`'
printf ' JOIN `%s` ON `%s`.`%s`=`%s`.`id`' \
'build_assignments' 'build_assignments' 'package_source' 'package_sources' \
'build_dependency_loops' 'build_dependency_loops' 'build_assignment' 'build_assignments'
printf ';\n'
} | \
${mysql_command} --batch | \
sed '
1d
y/\t/ /
' | \
sort > \
"${tmp_dir}/loops.mysql"
find "${work_dir}/build-list.loops" -regextype grep -mindepth 1 -maxdepth 1 \
-regex '.*/loop_[0-9]\+' \
-exec 'cat' '{}' \; | \
sort > \
"${tmp_dir}/loops.file"
{
mysql_sanity_check || true
diff -u \
"${tmp_dir}/build-list.file" \
"${tmp_dir}/build-list.mysql" || \
true
diff -u \
"${tmp_dir}/deletion-list.file" \
"${tmp_dir}/deletion-list.mysql" || \
true
diff -u \
"${tmp_dir}/loops.file" \
"${tmp_dir}/loops.mysql" || \
true
} | \
sed '
s,^-.*$,<font color="#FF0000">\0</font>,
s,^+.*$,<font color="#00FF00">\0</font>,
s/$/<br>/
1 i <html><head><title>sanity of the buildmaster'"'"'s mysql database</title></head><body>
$ a </body></html>
' | \
sponge "${webserver_directory}/mysql-sanity.html"
|