From 579280e9f3e65d8aa2b105c4067e3f3d6a084552 Mon Sep 17 00:00:00 2001 From: bill-auger Date: Mon, 24 Jan 2022 06:00:18 -0500 Subject: pbot announce - ignore empty pushes (ie: nothing was staged) --- src/abslibre-tools/librerelease | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease index 57eb291..e57be7d 100755 --- a/src/abslibre-tools/librerelease +++ b/src/abslibre-tools/librerelease @@ -313,12 +313,19 @@ release_packages() { # notify pbot of the excellent work we have done local login=${REPODEST_userinfo:-somebody} ; login=${login%%:*} ; - local packages=$(grep -zE '\.pkg\.tar\.[^\.]+$' ${file_list} | \ - grep -zEv '\-debug\-' | \ - sed -z 's|\([^/]*\)/\([^/ ]*\)-[^-]*$|\2(\1) |' | \ - sort -zu | xargs -0 ) - local pbot_say_cmd="which pbot-say && pbot-say ${login} just published: ${packages}" - ssh ${REPODEST_port:+-p "$REPODEST_port"} "${REPODEST_userhost}" "${pbot_say_cmd}" + local select_pkgs='\.pkg\.tar\.[^\.]+$' + local reject_pkgs='\-debug\-' + local pkgname_rx='s|\([^/]*\)/\([^/ ]*\)-[^-]*$|\2(\1) |' + local packages=$(grep -zE "${select_pkgs}" ${file_list} | \ + grep -zEv "${reject_pkgs}" | \ + sed -z "${pkgname_rx}" | \ + sort -zu | xargs -0 ) + local pbotsay_fmt="which pbot-say && pbot-say %s just published: %s" + + if [[ -n "$(echo ${packages})" ]]; then + local pbotsay_cmd="$(printf "${pbotsay_fmt}" "${login}" "${packages}")" + ssh ${REPODEST_port:+-p "$REPODEST_port"} "${REPODEST_userhost}" "${pbotsay_cmd}" + fi return $EXIT_SUCCESS } -- cgit v1.2.2