From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) by dpdk.org (Postfix) with ESMTP id 3FFADD4B4 for ; Fri, 25 Nov 2016 18:02:30 +0100 (CET) Received: by mail-wm0-f49.google.com with SMTP id a197so149193490wmd.0 for ; Fri, 25 Nov 2016 09:02:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:subject:date:message-id:in-reply-to:references; bh=3h1IO643RPFWZw/7WqBuCWm5TrEjUX1c2o5ChpoYntc=; b=sq9EmY0scTWxukC2h9K7PESxdbYIX1YOD8BaSoQYRyTUVYNeNSjXcF7SqrJtHweKWz nasczwVb6N940ECuclpIBivmEqtc73SI6JE9CLyJnKl7T0sZp4knICNQMWU+vzdTq17R L2EGpjpklK/z4YnNPgLfgX1qcmg0RmbKX1q9QoEn6fAXq/EJoiYhmVY1BwF7VNnhOl2I yycMYeGBLrcmeei8Rf3/YJ1PippyvwER/pVlW7VQT5AhjhpjFbFKmsxxX+w+Psu57Azy xyYctcg+NBwWdNRt1ldmUn4LFGBif4r5mzimVxA0kCai4t83gHoDT3SGNRO2WLUGW/LL iAZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=3h1IO643RPFWZw/7WqBuCWm5TrEjUX1c2o5ChpoYntc=; b=aXXzyEU0GXC34tRkyIAvIA3u4j/KCgoI5DS2l77C+5Pi2V3aSIV81iy77aN2HHk6uR n/olRIT1zRVlxLAUsVUCkrZ1ji+JnhYaVeswlKBaru2eUVmPi4kZ+I4mH5MSXEmuSnGs 2Y7p0arrqW5xGIu98m1fDnDtYlsQgpri7J2BGhETJ7mgvie3IhXELB6ogkjixoOxdonQ dNjNtXFqHuDVxqrKDXibLO7LTKKDGrL5l1B1cfaHxC0KXnrt3XWya/L1n2W6PSesH4bQ lHNFWAQ/lbtKTYzsDqa1eQSW0+Ry+3kjTxzX+gD7YMmv+OgxUSuvhvzpN7IbZZky8Pg+ gXQg== X-Gm-Message-State: AKaTC03HHKaFkdHuA3W7HMPZ9qDx+qfL5EGPgaLQn39+9we1bnnzulJLxCIA12T/9CuX21oW X-Received: by 10.28.156.87 with SMTP id f84mr8203553wme.57.1480093349698; Fri, 25 Nov 2016 09:02:29 -0800 (PST) Received: from XPS13.localdomain (184.203.134.77.rev.sfr.net. [77.134.203.184]) by smtp.gmail.com with ESMTPSA id ct7sm29707757wjc.2.2016.11.25.09.02.29 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 25 Nov 2016 09:02:29 -0800 (PST) From: Thomas Monjalon To: ci@dpdk.org Date: Fri, 25 Nov 2016 18:02:12 +0100 Message-Id: <1480093334-29957-6-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.7.0 In-Reply-To: <1480093334-29957-1-git-send-email-thomas.monjalon@6wind.com> References: <1480093334-29957-1-git-send-email-thomas.monjalon@6wind.com> Subject: [dpdk-ci] [PATCH 5/7] tools: add per-patch report mailer X-BeenThere: ci@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: CI discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Nov 2016 17:02:30 -0000 The report sent by this script will be parsed and integrated in patchwork if the patch was public. Otherwise it will just send the report to the patch submitter. Signed-off-by: Thomas Monjalon --- config/ci.config | 3 ++ tools/send-patch-report.sh | 100 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+) create mode 100755 tools/send-patch-report.sh diff --git a/config/ci.config b/config/ci.config index 722aeb5..b3b0376 100644 --- a/config/ci.config +++ b/config/ci.config @@ -3,5 +3,8 @@ # or ~/.config/dpdk/ci.config # or .ciconfig +# The mailer (sendmail, mail, mailx) must support the option -t +# export DPDK_CI_MAILER=/usr/sbin/sendmail + # The pwclient script is part of patchwork and is copied in dpdk-ci # export DPDK_CI_PWCLIENT=tools/pwclient diff --git a/tools/send-patch-report.sh b/tools/send-patch-report.sh new file mode 100755 index 0000000..34b451d --- /dev/null +++ b/tools/send-patch-report.sh @@ -0,0 +1,100 @@ +#! /bin/sh -e + +# This file is in the public domain. + +print_usage () { + cat <<- END_OF_HELP + usage: $(basename $0) [options] < report + + Send test report in a properly formatted email for patchwork integration. + The report is submitted to this script via stdin. + + options: + -t title subject of the patch email + -f from sender of the patch email + -m msgid id of the patch email + -p listid mailing list publishing the patch + -l label title of the test + -s status one of these test results: SUCCESS, WARNING, FAILURE + -d desc few words to better describe the status + -h this help + END_OF_HELP +} + +. $(dirname $(readlink -e $0))/load-ci-config.sh +sendmail=${DPDK_CI_MAILER:-/usr/sbin/sendmail} +pwclient=${DPDK_CI_PWCLIENT:-$(dirname $(readlink -m $0))/pwclient} + +unset title +unset from +unset msgid +unset listid +unset label +unset status +unset desc +while getopts d:f:hl:m:p:s:t: arg ; do + case $arg in + t ) title=$OPTARG ;; + f ) from=$OPTARG ;; + m ) msgid=$OPTARG ;; + p ) listid=$OPTARG ;; + l ) label=$OPTARG ;; + s ) status=$OPTARG ;; + d ) desc=$OPTARG ;; + h ) print_usage ; exit 0 ;; + ? ) print_usage >&2 ; exit 1 ;; + esac +done +shift $(($OPTIND - 1)) +if [ -t 0 ] ; then + printf 'nothing to read on stdin\n\n' >&2 + print_usage >&2 + exit 1 +fi +report=$(cat) + +writeheaders () # [cc] +{ + echo "Subject: $1" + echo "In-Reply-To: $2" + echo "References: $2" + echo "To: $3" + [ -z "$4" ] || echo "Cc: $4" + echo +} + +writeheadlines () #