diff options
author | bill-auger <mr.j.spam.me@gmail.com> | 2022-01-24 09:39:48 -0500 |
---|---|---|
committer | bill-auger <mr.j.spam.me@gmail.com> | 2022-01-28 07:07:29 -0500 |
commit | c2f39d58eb5e77b927bb782cf25fe103d33fceef (patch) | |
tree | e717d7e5622036c00c536568a9a7953ccf4b917d | |
parent | 2aa3f6f497ffc30303a4b290d61b9938aaf459be (diff) |
pbot announce - refactor
-rwxr-xr-x | src/abslibre-tools/librerelease | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/src/abslibre-tools/librerelease b/src/abslibre-tools/librerelease index 796da81..0b32135 100755 --- a/src/abslibre-tools/librerelease +++ b/src/abslibre-tools/librerelease @@ -6,6 +6,7 @@ # Copyright (C) 2010-2013 Nicolás Reynolds <fauno@parabola.nu> # Copyright (C) 2013 Michał Masłowski <mtjm@mtjm.eu> # Copyright (C) 2013-2014, 2017-2018 Luke Shumaker <lukeshu@parabola.nu> +# Copyright (C) 2022 bill-auger <bill-auger@programmer.net> # # For just the create_signature() function: # Copyright (C) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org> @@ -18,7 +19,7 @@ # # License: GNU GPLv3+ # -# This file is part of Parabola. +# This file is part of Parabola Libretools. # # Parabola is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -285,8 +286,15 @@ release_packages() { return $EXIT_SUCCESS fi + + ## publish ## + + local tier0_port="${REPODEST_port:+-p "$REPODEST_port"}" + local tier0_host="${REPODEST_userhost}" + local dbupdate_cmd="STAGING=${REPODEST_path@Q} DBSCRIPTS_CONFIG=${DBSCRIPTS_CONFIG@Q} db-update" + msg "Running db-update on repos" - ssh ${REPODEST_port:+-p "$REPODEST_port"} "${REPODEST_userhost}" "STAGING=${REPODEST_path@Q} DBSCRIPTS_CONFIG=${DBSCRIPTS_CONFIG@Q} db-update" + ssh ${tier0_port} "${tier0_host}" "${dbupdate_cmd}" if [[ -n $HOOKPOSTRELEASE ]]; then msg "Running HOOKPOSTRELEASE..." @@ -299,17 +307,25 @@ release_packages() { # notify pbot of the excellent work we have done local login=${REPODEST_userinfo:-somebody} ; login=${login%%:*} ; 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 reject_pkgs='-debug-' + local pkgname_rx='s|\([^/]*\)/\([^/ -]*\)-\([^-]*\)-[^-]*-\([^-\.]*\)\..*$|\2-\3-\4/\1|' 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}" + local filename + local packages=( + $( + while read -r -d '' + do filename="$REPLY" + [[ "${filename}" =~ ${select_pkgs} ]] || continue + [[ "${filename}" =~ ${reject_pkgs} ]] && continue || : + + sed "${pkgname_rx}" <<<${filename} || : + done < ${file_list} | sort -u | xargs || : + ) + ) + if (( ${#packages[@]} )); then + local pbotsay_cmd="$(printf "${pbotsay_fmt}" "${login}" "${packages[@]}")" + + ssh ${tier0_port} "${tier0_host}" "${pbotsay_cmd}" &> /dev/null || : fi return $EXIT_SUCCESS |