From 61b1a165073ef79ef588c8606f8bc94785e4db6d Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 8 May 2018 09:56:03 +0200 Subject: lib/mysql-functions: mysql_package_name_query make table names customizable --- bin/bootstrap-mysql | 2 ++ bin/build-master-status | 2 ++ bin/build-packages | 2 ++ bin/check-bugtracker | 3 ++- bin/check-db-structure | 2 ++ bin/check-opcodes | 2 +- bin/clean-cache | 2 ++ bin/clean-git | 2 ++ bin/cleanup | 2 ++ bin/copy-to-build-support | 2 ++ bin/db-update | 3 ++- bin/delete-packages | 3 ++- bin/filter-build-logs | 2 ++ bin/find-obsolete-packages | 2 ++ bin/get-assignment | 2 ++ bin/get-package-updates | 2 ++ bin/ii-answer | 2 ++ bin/ii-connect | 2 ++ bin/interpret-mail | 2 ++ bin/modify-package-state | 2 +- bin/ping-from-slave | 2 ++ bin/ping-to-master | 2 ++ bin/prioritize-build-list | 2 ++ bin/repo-copy | 2 ++ bin/return-assignment | 2 ++ bin/sanity-check | 2 ++ bin/seed-build-list | 2 ++ bin/show-dependencies | 2 ++ bin/slave-build-connect | 2 ++ bin/why-dont-you | 2 ++ bin/wtf | 2 ++ lib/common-functions | 2 +- lib/mysql-functions | 20 ++++++++++---------- 33 files changed, 71 insertions(+), 16 deletions(-) diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql index 265bbe5..6e4afc2 100755 --- a/bin/bootstrap-mysql +++ b/bin/bootstrap-mysql @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/build-master-status b/bin/build-master-status index f46d668..c0d9cb1 100755 --- a/bin/build-master-status +++ b/bin/build-master-status @@ -2,6 +2,8 @@ # report about status of build master +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/build-packages b/bin/build-packages index 12fe9b7..1079f40 100755 --- a/bin/build-packages +++ b/bin/build-packages @@ -4,6 +4,8 @@ # Details: # https://github.com/archlinux32/builder/wiki/Build-system#build-packages +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/check-bugtracker b/bin/check-bugtracker index e77b47c..75f4995 100755 --- a/bin/check-bugtracker +++ b/bin/check-bugtracker @@ -4,7 +4,8 @@ # with issues and mark these packages as "has_issues" if they are faulty # and vice versa -# shellcheck disable=SC2039 +# shellcheck disable=SC2039,SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/check-db-structure b/bin/check-db-structure index cb63c42..3b85756 100755 --- a/bin/check-db-structure +++ b/bin/check-db-structure @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/check-opcodes b/bin/check-opcodes index 2efbce5..feaffc3 100755 --- a/bin/check-opcodes +++ b/bin/check-opcodes @@ -1,6 +1,6 @@ #!/bin/sh -# shellcheck disable=SC2086 +# shellcheck disable=SC2086,SC2119,SC2120 # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/clean-cache b/bin/clean-cache index a2fca62..251d1de 100755 --- a/bin/clean-cache +++ b/bin/clean-cache @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/clean-git b/bin/clean-git index 00f634d..9c27958 100755 --- a/bin/clean-git +++ b/bin/clean-git @@ -2,6 +2,8 @@ # clean git repositories +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/cleanup b/bin/cleanup index 830cb94..2ee6397 100755 --- a/bin/cleanup +++ b/bin/cleanup @@ -2,6 +2,8 @@ # clean up unnecessary data +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/copy-to-build-support b/bin/copy-to-build-support index 1164c1d..bd4412a 100755 --- a/bin/copy-to-build-support +++ b/bin/copy-to-build-support @@ -4,6 +4,8 @@ # TODO: enable separate repositories for each architecture +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/db-update b/bin/db-update index 28e9861..44b2a35 100755 --- a/bin/db-update +++ b/bin/db-update @@ -14,7 +14,8 @@ # TODO: enable separate repositories for each architecture -# shellcheck disable=SC2039 +# shellcheck disable=SC2039,SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/delete-packages b/bin/delete-packages index 5f60b40..0279be8 100755 --- a/bin/delete-packages +++ b/bin/delete-packages @@ -9,7 +9,8 @@ # "Package x depends on package y" means, that something needed by x # is provided by y and no other package which will not be deleted. -# shellcheck disable=SC2039 +# shellcheck disable=SC2039,SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/filter-build-logs b/bin/filter-build-logs index 9663b80..fb71154 100755 --- a/bin/filter-build-logs +++ b/bin/filter-build-logs @@ -2,6 +2,8 @@ # filter content of build-logs for display on the webserver +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/find-obsolete-packages b/bin/find-obsolete-packages index 3a4bebc..751a6c3 100755 --- a/bin/find-obsolete-packages +++ b/bin/find-obsolete-packages @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/get-assignment b/bin/get-assignment index 34a990e..6289da0 100755 --- a/bin/get-assignment +++ b/bin/get-assignment @@ -12,6 +12,8 @@ # 3: come back after the next run of get-package-updates - currently # there are no pending packages +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/get-package-updates b/bin/get-package-updates index 8239097..cf0e608 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -4,6 +4,8 @@ # Details: # https://github.com/archlinux32/builder/wiki/Build-system#get-package-updates +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/ii-answer b/bin/ii-answer index 9b25abb..52b499f 100755 --- a/bin/ii-answer +++ b/bin/ii-answer @@ -2,6 +2,8 @@ # answer to stuff on irc +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/ii-connect b/bin/ii-connect index 6e543c5..45eff65 100755 --- a/bin/ii-connect +++ b/bin/ii-connect @@ -2,6 +2,8 @@ # run and handle the irc client +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/interpret-mail b/bin/interpret-mail index 65528b4..a931cb7 100755 --- a/bin/interpret-mail +++ b/bin/interpret-mail @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/modify-package-state b/bin/modify-package-state index 7336b66..754611a 100755 --- a/bin/modify-package-state +++ b/bin/modify-package-state @@ -1,6 +1,6 @@ #!/bin/sh -# shellcheck disable=SC2039 +# shellcheck disable=SC2039,SC2119,SC2120 # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/ping-from-slave b/bin/ping-from-slave index 7611f44..5ba8395 100755 --- a/bin/ping-from-slave +++ b/bin/ping-from-slave @@ -5,6 +5,8 @@ # - show that the build is still running # - get notified by the build master if the build is not necessary anymore +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/ping-to-master b/bin/ping-to-master index 6da0749..11dc7b8 100755 --- a/bin/ping-to-master +++ b/bin/ping-to-master @@ -5,6 +5,8 @@ # - show that the build is still running # - get notified by the build master if the build is not necessary anymore +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/prioritize-build-list b/bin/prioritize-build-list index ef8e4b7..4138534 100755 --- a/bin/prioritize-build-list +++ b/bin/prioritize-build-list @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/repo-copy b/bin/repo-copy index c3450fd..803cae3 100755 --- a/bin/repo-copy +++ b/bin/repo-copy @@ -9,6 +9,8 @@ # - no database signatures are handled # - only *.db.tar.gz and *.files.tar.gz are recognized as database +# shellcheck disable=SC2119,SC2120 + usage() { >&2 echo 'usage:' >&2 echo ' repo-copy from-repo.db.tar.gz to-repo.db.tar.gz package1 package2 ...' diff --git a/bin/return-assignment b/bin/return-assignment index b4fdf1c..1155076 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -16,6 +16,8 @@ # TODO: sign database +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/sanity-check b/bin/sanity-check index fdcc25a..6c30af7 100755 --- a/bin/sanity-check +++ b/bin/sanity-check @@ -2,6 +2,8 @@ # do some basic sanity checks +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/seed-build-list b/bin/seed-build-list index bdaa227..0e43f39 100755 --- a/bin/seed-build-list +++ b/bin/seed-build-list @@ -2,6 +2,8 @@ # seed the build list from differences between an x86_64 and our master mirror +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/show-dependencies b/bin/show-dependencies index e6de854..ede0f78 100755 --- a/bin/show-dependencies +++ b/bin/show-dependencies @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/slave-build-connect b/bin/slave-build-connect index 4fcb38a..d22597b 100755 --- a/bin/slave-build-connect +++ b/bin/slave-build-connect @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC2119,SC2120 + # shellcheck source=../conf/default.conf . "${0%/*}/../conf/default.conf" diff --git a/bin/why-dont-you b/bin/why-dont-you index 945639e..f31c38c 100755 --- a/bin/why-dont-you +++ b/bin/why-dont-you @@ -2,6 +2,8 @@ # usage: why_dont_you $action $package1 $package2 ... +# shellcheck disable=SC2119,SC2120 + # investigate, why a certain operation is not done with certain packages # shellcheck source=../conf/default.conf diff --git a/bin/wtf b/bin/wtf index a54930d..b42cd15 100755 --- a/bin/wtf +++ b/bin/wtf @@ -1,5 +1,7 @@ #!/bin/sh +# shellcheck disable=SC2119,SC2120 + wget -qO- 'https://pkgapi.arch32.tyzoid.com/esearch/'"$*"'.xml' | \ awk ' BEGIN { 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 ')' } -- cgit v1.2.3