From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 6B305A046B for ; Tue, 25 Jun 2019 19:01:16 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 7AEC11B9CA; Tue, 25 Jun 2019 19:01:14 +0200 (CEST) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id AB0771B9C0 for ; Tue, 25 Jun 2019 19:01:12 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Jun 2019 10:01:09 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.63,416,1557212400"; d="scan'208";a="155568808" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.223.78]) by orsmga008.jf.intel.com with ESMTP; 25 Jun 2019 10:01:08 -0700 From: Ferruh Yigit To: Thomas Monjalon Cc: dev@dpdk.org Date: Tue, 25 Jun 2019 18:01:06 +0100 Message-Id: <20190625170107.87583-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] devtools: return error on failure X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Currently script is always returning success, returning failure on error helps on using script on automation tools. Signed-off-by: Ferruh Yigit --- devtools/check-git-log.sh | 56 ++++++++++++++++++++++++++++++--------- 1 file changed, 43 insertions(+), 13 deletions(-) diff --git a/devtools/check-git-log.sh b/devtools/check-git-log.sh index a763ccf78..509d8ef1d 100755 --- a/devtools/check-git-log.sh +++ b/devtools/check-git-log.sh @@ -19,6 +19,8 @@ if [ "$1" = '-h' -o "$1" = '--help' ] ; then exit fi +ret=0 + selfdir=$(dirname $(readlink -f $0)) range=${1:-origin/master..} # convert -N to HEAD~N.. in order to comply with git-log-fixes.sh getopts @@ -46,7 +48,9 @@ bad=$(echo "$headlines" | grep --color=always \ -e ':[^ ]' \ -e ' :' \ | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline format:\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Wrong headline format:\n$bad\n" && ret=$((ret+1)) +fi # check headline prefix when touching only drivers, e.g. net/ bad=$(for commit in $commits ; do @@ -64,7 +68,9 @@ bad=$(for commit in $commits ; do echo "$headline" | grep -v "^$drv" fi done | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline prefix:\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Wrong headline prefix:\n$bad\n" && ret=$((ret+1)) +fi # check headline label for common typos bad=$(echo "$headlines" | grep --color=always \ @@ -74,14 +80,18 @@ bad=$(echo "$headlines" | grep --color=always \ -e 'test-pmd' \ -e '^bond:' \ | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline label:\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Wrong headline label:\n$bad\n" && ret=$((ret+1)) +fi # check headline lowercase for first words bad=$(echo "$headlines" | grep --color=always \ -e '^.*[[:upper:]].*:' \ -e ': *[[:upper:]]' \ | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline uppercase:\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Wrong headline uppercase:\n$bad\n" && ret=$((ret+1)) +fi # check headline uppercase (Rx/Tx, VF, L2, MAC, Linux, ARM...) bad=$(echo "$headlines" | grep -E --color=always \ @@ -127,46 +137,60 @@ bad=$(echo "$headlines" | grep -E --color=always \ | grep \ -v ':.*\' \ | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline lowercase:\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Wrong headline lowercase:\n$bad\n" && ret=$((ret+1)) +fi # special case check for VMDq to give good error message bad=$(echo "$headlines" | grep -E --color=always \ -e '\<(vmdq|VMDQ)\>' \ | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline capitalization, use 'VMDq':\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Wrong headline capitalization, use 'VMDq':\n$bad\n" && ret=$((ret+1)) +fi # check headline length (60 max) bad=$(echo "$headlines" | awk 'length>60 {print}' | sed 's,^,\t,') -[ -z "$bad" ] || printf "Headline too long:\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Headline too long:\n$bad\n" && ret=$((ret+1)) +fi # check body lines length (75 max) bad=$(echo "$bodylines" | grep -v '^Fixes:' | awk 'length>75 {print}' | sed 's,^,\t,') -[ -z "$bad" ] || printf "Line too long:\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Line too long:\n$bad\n" && ret=$((ret+1)) +fi # check starting commit message with "It" bad=$(for commit in $commits ; do firstbodyline=$(git log --format='%b' -1 $commit | head -n1) echo "$firstbodyline" | grep --color=always -ie '^It ' done | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong beginning of commit message:\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Wrong beginning of commit message:\n$bad\n" && ret=$((ret+1)) +fi # check tags spelling bad=$(echo "$tags" | grep -v "^$bytag [^,]* <.*@.*>$" | grep -v '^Fixes: [0-9a-f]\{7\}[0-9a-f]* (".*")$' | sed 's,^.,\t&,') -[ -z "$bad" ] || printf "Wrong tag:\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Wrong tag:\n$bad\n" && ret=$((ret+1)) +fi # check missing Fixes: tag bad=$(for fix in $fixes ; do git log --format='%b' -1 $fix | grep -q '^Fixes: ' || git log --format='\t%s' -1 $fix done) -[ -z "$bad" ] || printf "Missing 'Fixes' tag:\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Missing 'Fixes' tag:\n$bad\n" && ret=$((ret+1)) +fi # check Fixes: reference IFS=' @@ -181,11 +205,17 @@ bad=$(for fixtag in $fixtags ; do fi printf "$fixtag" | grep -v "^$good$" done | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong 'Fixes' reference:\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Wrong 'Fixes' reference:\n$bad\n" && ret=$((ret+1)) +fi # check Cc: stable@dpdk.org for fixes bad=$(for fix in $stablefixes ; do git log --format='%b' -1 $fix | grep -qi '^Cc: *stable@dpdk.org' || git log --format='\t%s' -1 $fix done) -[ -z "$bad" ] || printf "Is it candidate for Cc: stable@dpdk.org backport?\n$bad\n" +if [ ! -z "$bad" ]; then + printf "Is it candidate for Cc: stable@dpdk.org backport?\n$bad\n" && ret=$((ret+1)) +fi + +exit $ret -- 2.21.0