X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=message_helper;h=d13360a7a22f02e818af672d9779e1f7923228ac;hb=HEAD;hp=80bf2559fc058f088483529833cca5c0b51c4f41;hpb=11517024b2c84f2e0eb128adc11e36b0c590954b;p=next-scripts diff --git a/message_helper b/message_helper index 80bf255..d13360a 100755 --- a/message_helper +++ b/message_helper @@ -1,31 +1,47 @@ #!/bin/bash -log=../merge.log -[ -f merge.log ] && log=merge.log -control=../etc/control -[ -f control ] && control=control - -branch="" -[ "$1" = "-t" ] && { - branch=$2 +# shellcheck source=./common.sh +. "$(dirname "$0")/common.sh" '' + +log="$LOG_FILE" +if [ -f merge.log ]; then + log='merge.log' +fi + +branch= +if [ "$1" = '-b' ]; then + branch="$2" shift 2 -} +fi + +kconfig= +if [ "$1" = '-c' ]; then + kconfig="$2" + shift 2 +fi + +subject="$1" +shift -[ "$branch" ] || { - branch=$(grep '^Merging ' $log | tail -1 | sed 's/^Merging //' | sed 's/ .*$//') - branch=${branch%%/*} -} +cc=( 'Linux Next Mailing List ' + 'Linux Kernel Mailing List ' + "$@" ) -contact=$(awk -F ' ' '$3=="'"$branch"'" { print $1; }' $control) -greeting=${contact%% *} -greeting=${greeting#\"} -[ "${contact%,*}" = "${contact}" ] || greeting="all" +if [ -z "$branch" ]; then + branch=$(grep '^Merging ' "$log" | tail -n 1 | + sed 's/^Merging \([^ /]*\).*$/\1/') +fi -subject="${1//BRANCH/$branch}" -body="${2//BRANCH/$branch}" +contact=$(get_contacts "$branch") +subject=${subject//BRANCH/$branch} +filter=( -E -e 's/^([^ ])/|\1/' -e "s/BRANCH/$branch/g" ) +if [ -n "$kconfig" ]; then + filter+=( -e "s/KCONFIG_NAME/$kconfig/g" ) +fi -sylpheed --compose "mailto:$contact?Cc=linux-next@vger.kernel.org,%20linux-kernel@vger.kernel.org&Subject=linux-next: $subject&Body=Hi $greeting,%0A\ -%0A\ -$body" +{ + printf 'Hi all,\n\n' + sed "${filter[@]}" | fmt -w 76 -u -p '|' | sed 's/^|//' +} | "$bin_dir"/send_email "linux-next: $subject" "$contact" "${cc[@]}" exit 0