summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-03-22 15:30:45 +0100
committerErich Eckner <git@eckner.net>2018-03-22 15:30:45 +0100
commitd22efbc22053a482c6d1b9f264b12d54f509508c (patch)
tree4e636554499aba226b47ec7601163658bdc46bb6 /bin
parent3edfb5d8d42567807b949ddac48efbb680ed4d9c (diff)
downloadbuilder-d22efbc22053a482c6d1b9f264b12d54f509508c.tar.xz
bin/sanity-check: read more information from the database
Diffstat (limited to 'bin')
-rwxr-xr-xbin/sanity-check40
1 files changed, 21 insertions, 19 deletions
diff --git a/bin/sanity-check b/bin/sanity-check
index 4398595..e6b4184 100755
--- a/bin/sanity-check
+++ b/bin/sanity-check
@@ -145,20 +145,19 @@ while [ $# -gt 0 ]; do
"${tmp_dir}/messages"
errors=$(
- grep -vn '^\S\+ [0-9a-f]\{40\} [0-9a-f]\{40\} \S\+$' "${work_dir}/build-list"
- ) || true
- if [ -n "${errors}" ]; then
- if [ ${silence} -le 1 ]; then
- printf '\nThe following build orders are wrongly formatted:\n%s\n' \
- "${errors}" >> \
- "${tmp_dir}/messages"
- fi
- i_am_insane
- fi
-
- errors=$(
- cut -d' ' -f1 < \
- "${work_dir}/build-list" | \
+ # shellcheck disable=SC2016
+ {
+ printf 'SELECT `architectures`.`name`,`package_sources`.`pkgbase` FROM `package_sources`'
+ mysql_join_package_sources_build_assignments
+ mysql_join_build_assignments_architectures
+ printf ' WHERE EXISTS('
+ printf 'SELECT * FROM `binary_packages`'
+ mysql_join_binary_packages_repositories
+ printf ' WHERE `repositories`.`name`="build-list"'
+ printf ' AND `binary_packages`.`build_assignment`=`build_assignments`.`id`'
+ printf ');\n'
+ } | \
+ mysql_run_query | \
sort | \
uniq -d
)
@@ -172,13 +171,16 @@ while [ $# -gt 0 ]; do
fi
errors=$(
+ # shellcheck disable=SC2016
{
- cut -d' ' -f1 < \
- "${work_dir}/build-list"
- cat "${work_dir}/deletion-list"
+ printf 'SELECT `a`.`pkgname` FROM `binary_packages` AS `a`'
+ mysql_join_binary_packages_repositories 'a' 'a_r'
+ printf ' AND `a_r`.`name`="build-list"'
+ printf ' JOIN `binary_packages` AS `b` ON `a`.`pkgname`=`b`.`pkgname`'
+ mysql_join_binary_packages_repositories 'b' 'b_r'
+ printf ' AND `b_r`.`name`="deletion-list";\n'
} | \
- sort | \
- uniq -d
+ mysql_run_query
)
if [ -n "${errors}" ]; then
if [ ${silence} -le 1 ]; then