From aa1158a7f261100312057c94bfb40553c52296a6 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 6 Feb 2018 11:44:27 +0100 Subject: bin/show-dependencies: read some information from db --- bin/show-dependencies | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/bin/show-dependencies b/bin/show-dependencies index ee7db19..450120f 100755 --- a/bin/show-dependencies +++ b/bin/show-dependencies @@ -9,21 +9,35 @@ if [ $# -eq 0 ]; then broken=$( - find "${work_dir}/package-states" -maxdepth 1 -name '*.broken' -printf '%f\n' | \ - sed 's|\(\.[^.]\+\)\{4\}$||' | \ + # shellcheck disable=SC2016 + { + printf 'SELECT `package_sources`.`pkgbase`' + printf ' FROM `package_sources`' + printf ' JOIN `build_assignments` ON `build_assignments`.`package_source`=`package_sources`.`id`' + printf ' WHERE `build_assignments`.`is_broken`' + } | \ + ${mysql_command} --raw --batch | \ + sed '1d' | \ sort -u ) new_sum='x' sum='' tmp_dir=$(mktemp -d 'tmp.show-dependencies.0.XXXXXXXXXX' --tmpdir) trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT - find "${work_dir}/package-infos" -maxdepth 1 -name '*.builds' -exec \ - grep -HF '' {} \; | \ + # shellcheck disable=SC2016 + { + printf 'SELECT DISTINCT `package_sources`.`pkgbase`,`binary_packages`.`pkgname`' + printf ' FROM `binary_packages`' + printf ' JOIN `%s` ON `%s`.`id`=`%s`.`%s`' \ + 'build_assignments' 'build_assignments' 'binary_packages' 'build_assignment' \ + 'package_sources' 'package_sources' 'build_assignments' 'package_source' + printf ' ORDER BY `binary_packages`.`pkgname`' + } | \ + ${mysql_command} --raw --batch | \ sed ' - s|^.*/|| - s|\(\.[^.]\+\)\{4\}:| | - ' | \ - sort -k2,2 > \ + 1d + y/\t/ / + ' > \ "${tmp_dir}/builds" while ! [ "${new_sum}" = "${sum}" ]; do sum="${new_sum}" -- cgit v1.2.3-70-g09d2