From 567e716c8696754f4b3323f962a616e9be12115d Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 4 May 2018 09:44:32 +0200 Subject: lib/common-functions: irc_say: accept channel as parameter --- bin/build-master-status | 1 + bin/get-package-updates | 1 + bin/ii-connect | 1 + bin/return-assignment | 1 + bin/sanity-check | 2 ++ lib/common-functions | 16 ++++++++++++---- lib/mysql-functions | 1 + 7 files changed, 19 insertions(+), 4 deletions(-) diff --git a/bin/build-master-status b/bin/build-master-status index 7ab38d4..f46d668 100755 --- a/bin/build-master-status +++ b/bin/build-master-status @@ -111,6 +111,7 @@ rm -f "${tmp_dir}/todos" if [ -s "${webserver_directory}/mysql-sanity.html" ] && \ [ ! -s "${work_dir}/build-master-sanity" ]; then + # shellcheck disable=SC2119 printf 'girls, my database is dirty again ...\n' | \ irc_say echo 'build master is insane' > \ diff --git a/bin/get-package-updates b/bin/get-package-updates index 73766c8..8239097 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -503,6 +503,7 @@ if [ "${deletion_list_count}" -gt 1000 ]; then >&2 printf 'There are %s > 1000 packages on the deletion-list. This does not seem right.\n' \ "${deletion_list_count}" if [ ! -s "${work_dir}/told-irc-about-too-many-deletion-list-packages" ]; then + # shellcheck disable=SC2119 { printf '\001ACTION refuses to blacklist %s packages.\001\n' "${deletion_list_count}" for repo_name in ${repo_names}; do diff --git a/bin/ii-connect b/bin/ii-connect index 5fc5f37..95960f0 100755 --- a/bin/ii-connect +++ b/bin/ii-connect @@ -63,6 +63,7 @@ if [ "$1" = 'watch' ]; then /'"${welcome_user_regex}"'/ d ' "${irc_dir}/#archlinux32/out" done_something=true + # shellcheck disable=SC2119 printf '%s\n' "${new_users}" | \ sed ' s/^/Hi / diff --git a/bin/return-assignment b/bin/return-assignment index bcdb717..b4fdf1c 100755 --- a/bin/return-assignment +++ b/bin/return-assignment @@ -193,6 +193,7 @@ if [ "$5" = 'ERROR' ]; then fi ) + # shellcheck disable=SC2119 { printf '%s is broken (says %s).' \ "$1" \ diff --git a/bin/sanity-check b/bin/sanity-check index 96f028f..fdcc25a 100755 --- a/bin/sanity-check +++ b/bin/sanity-check @@ -19,6 +19,7 @@ usage() { i_am_insane() { if [ ! -s "${work_dir}/build-master-sanity" ]; then + # shellcheck disable=SC2119 printf '\001ACTION goes insane.\001\n' | \ irc_say fi @@ -461,6 +462,7 @@ done if [ -f "${work_dir}/build-master-sanity" ]; then rm "${work_dir}/build-master-sanity" + # shellcheck disable=SC2119 printf '\001ACTION resumes sanity.\001\n' | \ irc_say fi diff --git a/lib/common-functions b/lib/common-functions index 038af38..86b8aaa 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -921,10 +921,18 @@ extract_pkgname_epoch_pkgver_pkgrel_sub_pkgrel_arch_from_package_name() { fi } -# irc_say -# say content of stdin in irc channel +# irc_say $channel +# say content of stdin in irc channel $channel (default: #archlinux32) + +# shellcheck disable=SC2120 irc_say() { - if [ -p "${irc_dir}/#archlinux32/in" ]; then - sponge "${irc_dir}/#archlinux32/in" + local channel + if [ -z "$1" ]; then + channel='#archlinux32' + else + channel="$1" + fi + if [ -p "${irc_dir}/${channel}/in" ]; then + sponge "${irc_dir}/${channel}/in" fi } diff --git a/lib/mysql-functions b/lib/mysql-functions index 83b9296..40c91be 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -64,6 +64,7 @@ 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 -- cgit v1.2.3-54-g00ecf