]> git.ozlabs.org Git - next-scripts/blobdiff - message_helper
update to_build_host a bit
[next-scripts] / message_helper
index 80bf2559fc058f088483529833cca5c0b51c4f41..d13360a7a22f02e818af672d9779e1f7923228ac 100755 (executable)
@@ -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-next@vger.kernel.org>'
+       'Linux Kernel Mailing List <linux-kernel@vger.kernel.org>'
+       "$@" )
 
-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