Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-12-01 13:29:21 +0100
committerErich Eckner <git@eckner.net>2017-12-01 13:29:21 +0100
commite6e484b359a2d0cfb759f0d7cfa2d028ac50b4d0 (patch)
tree4da440b8e921d6589e48413944db897e1db7fb89 /bin
parent6cd5ca864d2a3737b3d91e20de03548a8f7f5dfc (diff)
bin/mysql-functions: show_binary_package new (for debug only)
Diffstat (limited to 'bin')
-rwxr-xr-xbin/mysql-functions40
1 files changed, 40 insertions, 0 deletions
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
+ '
+ )"
+}