Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-05-08 09:56:03 +0200
committerErich Eckner <git@eckner.net>2018-05-08 09:56:03 +0200
commit61b1a165073ef79ef588c8606f8bc94785e4db6d (patch)
treed3cc39e11aec71790c63f4a63cdc045cdc4669a5 /lib
parent936c9161dce0d01b0c47a406085c2e46e6d35040 (diff)
lib/mysql-functions: mysql_package_name_query make table names customizable
Diffstat (limited to 'lib')
-rwxr-xr-xlib/common-functions2
-rwxr-xr-xlib/mysql-functions20
2 files changed, 11 insertions, 11 deletions
diff --git a/lib/common-functions b/lib/common-functions
index c0121e6..530b166 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -2,7 +2,7 @@
# contains functions used by more than one script
-# shellcheck disable=SC2039
+# shellcheck disable=SC2039,SC2119,SC2120
if [ -z "${base_dir}" ]; then
# just to make shellcheck happy
diff --git a/lib/mysql-functions b/lib/mysql-functions
index ede5867..03c73b3 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -5,7 +5,7 @@
# TODO: return ids on INSERT/UPDATE queries and use those in subsequent
# queries
-# shellcheck disable=SC2016,SC2039
+# shellcheck disable=SC2016,SC2039,SC2119,SC2120
if [ -z "${base_dir}" ]; then
# just to make shellcheck happy
@@ -67,7 +67,6 @@ mysql_run_query() {
>&2 printf 'I could not complete a mysql query!\n'
if [ ! -s "${work_dir}/build-master-sanity" ] && \
[ -z "${file_name_extra}" ]; then
- # shellcheck disable=SC2119
printf '\001ACTION failed to execute a mysql query - can you have a look at "%s"?.\001\n' \
"${query_stdin##*/}" \
| irc_say
@@ -891,18 +890,19 @@ mysql_query_select_pkgbase_and_revision() {
mysql_join_package_sources_upstream_repositories
}
-# mysql_package_name_query
+# mysql_package_name_query [binary_packages] [architectures]
# print a mysql query of the full name of a package file
-# shellcheck disable=SC2120
mysql_package_name_query() {
+ local bp_name="${1:-binary_packages}"
+ local a_name="${2:-architectures}"
printf 'CONCAT('
- printf '`binary_packages`.`pkgname`,"-",'
- printf 'IF(`binary_packages`.`epoch`=0,"",CONCAT(`binary_packages`.`epoch`,":")),'
- printf '`binary_packages`.`pkgver`,"-",'
- printf '`binary_packages`.`pkgrel`,".",'
- printf '`binary_packages`.`sub_pkgrel`,"-",'
- printf '`architectures`.`name`,".pkg.tar.xz"'
+ printf '`%s`.`pkgname`,"-",' "${bp_name}"
+ printf 'IF(`%s`.`epoch`=0,"",CONCAT(`%s`.`epoch`,":")),' "${bp_name}" "${bp_name}"
+ printf '`%s`.`pkgver`,"-",' "${bp_name}"
+ printf '`%s`.`pkgrel`,".",' "${bp_name}"
+ printf '`%s`.`sub_pkgrel`,"-",' "${bp_name}"
+ printf '`%s`.`name`,".pkg.tar.xz"' "${a_name}"
printf ')'
}