From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E4580A0513; Tue, 2 Jun 2020 15:58:03 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 81F071BF78; Tue, 2 Jun 2020 15:57:45 +0200 (CEST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id D947A1BF6F for ; Tue, 2 Jun 2020 15:57:43 +0200 (CEST) IronPort-SDR: ccO1HuftoGQGSh4PjIEhPEzhirysX0HNSsfdyOl/MC+T/vw+lKtvtXPoByCQ8tphg0gHTjYvrK L6GM7OLwYj2Q== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga001.jf.intel.com ([10.7.209.18]) by fmsmga105.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Jun 2020 06:57:42 -0700 IronPort-SDR: spqhUvIMJdOnHQ4NVLCloFBToQlMjO+nLjYz9RX/+YUkEia4sxG0CpUzX/eVUnwa1vVEx8NIWw LKzw5wMEyMxg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,464,1583222400"; d="scan'208";a="347406312" Received: from silpixa00399953.ir.intel.com (HELO silpixa00399953.ger.corp.intel.com) ([10.237.222.53]) by orsmga001.jf.intel.com with ESMTP; 02 Jun 2020 06:57:40 -0700 From: Ciara Power To: thomas@monjalon.net, john.mcnamara@intel.com, marko.kovacevic@intel.com Cc: ferruh.yigit@intel.com, dev@dpdk.org, Ciara Power Date: Tue, 2 Jun 2020 14:53:18 +0100 Message-Id: <20200602135319.21457-3-ciara.power@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200602135319.21457-1-ciara.power@intel.com> References: <20200128150256.14339-1-ciara.power@intel.com> <20200602135319.21457-1-ciara.power@intel.com> Subject: [dpdk-dev] [PATCH v3 2/3] devtools: added stats print 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" When all checks are completed on the specified commit logs, the script indicates if all are valid, or if there were some failures. Signed-off-by: Ciara Power Acked-by: Ferruh Yigit --- v2: Added appropriate exit codes based on failure status. --- devtools/check-git-log.sh | 45 +++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/devtools/check-git-log.sh b/devtools/check-git-log.sh index 5220765b9..eca8506d9 100755 --- a/devtools/check-git-log.sh +++ b/devtools/check-git-log.sh @@ -70,7 +70,7 @@ bad=$(echo "$headlines" | grep --color=always \ -e ':[^ ]' \ -e ' :' \ | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline format:\n$bad\n" +[ -z "$bad" ] || { printf "Wrong headline format:\n$bad\n" && failure=true;} # check headline prefix when touching only drivers, e.g. net/ bad=$(for commit in $commits ; do @@ -88,7 +88,7 @@ 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" +[ -z "$bad" ] || { printf "Wrong headline prefix:\n$bad\n" && failure=true;} # check headline label for common typos bad=$(echo "$headlines" | grep --color=always \ @@ -98,14 +98,14 @@ bad=$(echo "$headlines" | grep --color=always \ -e 'test-pmd' \ -e '^bond:' \ | sed 's,^,\t,') -[ -z "$bad" ] || printf "Wrong headline label:\n$bad\n" +[ -z "$bad" ] || { printf "Wrong headline label:\n$bad\n" && failure=true;} # 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" +[ -z "$bad" ] || { printf "Wrong headline uppercase:\n$bad\n" && failure=true;} # check headline case (Rx/Tx, VF, L2, MAC, Linux ...) IFS=' @@ -118,9 +118,8 @@ for word in $(cat $words); do fi for bad_line in $bad; do bad_word=$(echo $bad_line | cut -d":" -f2 | grep -io $word) - if [ -n "$bad_word" ]; then - printf "Wrong headline case:\n\"$bad_line\": $bad_word --> $word\n" - fi + [ -z "$bad_word" ] || { printf "Wrong headline case:\n\ + \"$bad_line\": $bad_word --> $word\n" && failure=true;} done done @@ -128,27 +127,28 @@ done bad=$(echo "$headlines" | awk 'length>60 {print}' | sed 's,^,\t,') -[ -z "$bad" ] || printf "Headline too long:\n$bad\n" +[ -z "$bad" ] || { printf "Headline too long:\n$bad\n" && failure=true;} # 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" +[ -z "$bad" ] || { printf "Line too long:\n$bad\n" && failure=true;} # 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" +[ -z "$bad" ] || { printf "Wrong beginning of commit message:\n$bad\n"\ + && failure=true;} # 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" +[ -z "$bad" ] || { printf "Wrong tag:\n$bad\n" && failure=true;} # check missing Coverity issue: tag bad=$(for commit in $commits; do @@ -157,7 +157,8 @@ bad=$(for commit in $commits; do echo "$body" | grep -q '^Coverity issue:' && continue git log --format='\t%s' -1 $commit done) -[ -z "$bad" ] || printf "Missing 'Coverity issue:' tag:\n$bad\n" +[ -z "$bad" ] || { printf "Missing 'Coverity issue:' tag:\n$bad\n"\ + && failure=true;} # check missing Bugzilla ID: tag bad=$(for commit in $commits; do @@ -166,14 +167,15 @@ bad=$(for commit in $commits; do echo "$body" | grep -q '^Bugzilla ID:' && continue git log --format='\t%s' -1 $commit done) -[ -z "$bad" ] || printf "Missing 'Bugzilla ID:' tag:\n$bad\n" +[ -z "$bad" ] || { printf "Missing 'Bugzilla ID:' tag:\n$bad\n"\ + && failure=true;} # 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" +[ -z "$bad" ] || { printf "Missing 'Fixes' tag:\n$bad\n" && failure=true;} # check Fixes: reference fixtags=$(echo "$tags" | grep '^Fixes: ') @@ -186,11 +188,22 @@ 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" +[ -z "$bad" ] || { printf "Wrong 'Fixes' reference:\n$bad\n" && failure=true;} # 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" +[ -z "$bad" ] || { printf "Is it candidate for Cc: stable@dpdk.org backport?\n$bad\n"\ + && failure=true;} + +total=$(echo "$commits" | wc -l) +if [ -n "$failure" ] ; then + printf "\nInvalid patch(es) found - checked $total patch" +else + printf "\n$total/$total valid patch" +fi +[ $total -le 1 ] || printf 'es' +printf '\n' +[ -n "$failure" ] && exit 1 || exit 0 -- 2.17.1