From e6e484b359a2d0cfb759f0d7cfa2d028ac50b4d0 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 1 Dec 2017 13:29:21 +0100 Subject: bin/mysql-functions: show_binary_package new (for debug only) --- bin/mysql-functions | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'bin') diff --git a/bin/mysql-functions b/bin/mysql-functions index 9def8aa..8c84857 100755 --- a/bin/mysql-functions +++ b/bin/mysql-functions @@ -80,3 +80,43 @@ add_binary_package() { ' )" } + +# show_binary_package $pkgname $pkgver $pkgrel $sub_pkgrel + +# shellcheck disable=SC2016,SC2086,SC2154 +show_binary_package() { + local names='pkgname pkgver pkgrel sub_pkgrel' + local name + for name in ${names}; do + eval 'local '"${name}" + eval "${name}"'=$( + printf "%s" "$1" | + base64 -w0 + )' + shift + done + + local joint + ${mysql_command} "$( + printf 'SELECT * FROM `binary_packages`' + for joint in 'architectures:binary_packages:architecture' 'package_sources:binary_packages:package_source'; do + printf ' JOIN `%s` ON `%s`.`id` =' \ + "${joint%%:*}" "${joint%%:*}" + joint="${joint#*:}" + printf ' `%s`.`%s`' \ + "${joint%:*}" "${joint#*:}" + done + printf ' WHERE' + { + printf ' `%s`.`%s` = from_base64("%s") AND' \ + 'binary_packages' 'pkgname' "${pkgname}" \ + 'binary_packages' 'sub_pkgrel' "${sub_pkgrel}" \ + 'package_sources' 'pkgver' "${pkgver}" \ + 'package_sources' 'pkgrel' "${pkgrel}" + printf ';' + } | \ + sed ' + s|AND;|;|g + ' + )" +} -- cgit v1.2.3-70-g09d2