From 48abda2dd07cb8379996d0046bd99fdbb9dbd29d Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 6 Jul 2018 10:31:08 +0200 Subject: bin/wtp new to query package database --- bin/wtp | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100755 bin/wtp (limited to 'bin/wtp') diff --git a/bin/wtp b/bin/wtp new file mode 100755 index 0000000..3545f61 --- /dev/null +++ b/bin/wtp @@ -0,0 +1,46 @@ +#!/bin/sh + +# search for a package in the database + +# shellcheck disable=SC2119,SC2120 + +# shellcheck source=../lib/load-configuration +. "${0%/*}/../lib/load-configuration" + +# shellcheck disable=SC2016 +{ + printf 'SELECT' + printf ' CONCAT(' + printf '`architectures`.`name`,"/",' + printf '`binary_packages`.`pkgname`,": ",' + printf 'GROUP_CONCAT(' + printf 'CONCAT(' + printf '`r_a`.`name`,"/",' + printf '`repositories`.`name`," (",' + printf 'IF(' + printf '`binary_packages`.`epoch`=0,' + printf '"",' + printf 'CONCAT(`binary_packages`.`epoch`,":")' + printf '),' + printf '`binary_packages`.`pkgver`,"-",' + printf '`binary_packages`.`pkgrel`,' + printf 'IF(' + printf 'NOT `binary_packages`.`sub_pkgrel_omitted`,' + printf 'CONCAT(".",`binary_packages`.`sub_pkgrel`),' + printf '""),' + printf '")"' + printf ') SEPARATOR ", "' + printf ')' + printf ')' + printf ' FROM `binary_packages`' + mysql_join_binary_packages_architectures + mysql_join_binary_packages_binary_packages_in_repositories + mysql_join_binary_packages_in_repositories_repositories + mysql_join_repositories_architectures '' 'r_a' + printf ' WHERE `binary_packages`.`pkgname` LIKE from_base64("' + printf '%s' "$*" | \ + base64 -w0 + printf '") AND `repositories`.`is_on_master_mirror`' + printf ' GROUP BY CONCAT(`binary_packages`.`pkgname`,"-",`architectures`.`name`);\n' +} | \ + mysql_run_query -- cgit v1.2.3-70-g09d2