From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id 5A4EFA0A0A;
	Thu, 20 May 2021 09:59:45 +0200 (CEST)
Received: from [217.70.189.124] (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id CD55940143;
	Thu, 20 May 2021 09:59:44 +0200 (CEST)
Received: from us-smtp-delivery-124.mimecast.com
 (us-smtp-delivery-124.mimecast.com [170.10.133.124])
 by mails.dpdk.org (Postfix) with ESMTP id 9DBFE40041
 for <dev@dpdk.org>; Thu, 20 May 2021 09:59:43 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;
 s=mimecast20190719; t=1621497583;
 h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
 content-transfer-encoding:content-transfer-encoding;
 bh=IZchVWQ6Fe+8wNCV46ImftoSU4m2zCFOgXgYcHbqq5s=;
 b=fpMFWTF+JfCpbAAya6RG6ovz5hlRzGeU0Tt00Elz2cvxixQBqgbPTqRCpWWYxvKd89Wm9s
 JRc0Jp8YThx11++GcqI1Ko8R9Xf5LkpEnBAp7mllyV6dBGPoygP2XBSOqXK8LJolXiHx4T
 4nQzOlm1uyWWes0+0dp5jr8/f3ba8Pg=
Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com
 [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id
 us-mta-566-s22TL0JxNQmDDG5Afw9GYQ-1; Thu, 20 May 2021 03:59:40 -0400
X-MC-Unique: s22TL0JxNQmDDG5Afw9GYQ-1
Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com
 [10.5.11.12])
 (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 0EB9F803620;
 Thu, 20 May 2021 07:59:39 +0000 (UTC)
Received: from dmarchan.remote.csb (unknown [10.40.193.146])
 by smtp.corp.redhat.com (Postfix) with ESMTP id E327A196A8;
 Thu, 20 May 2021 07:59:37 +0000 (UTC)
From: David Marchand <david.marchand@redhat.com>
To: dev@dpdk.org
Cc: thomas@monjalon.net
Date: Thu, 20 May 2021 09:58:37 +0200
Message-Id: <20210520075837.30954-1-david.marchand@redhat.com>
MIME-Version: 1.0
X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12
Authentication-Results: relay.mimecast.com;
 auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com
X-Mimecast-Spam-Score: 0
X-Mimecast-Originator: redhat.com
Content-Transfer-Encoding: 8bit
Content-Type: text/plain; charset="US-ASCII"
Subject: [dpdk-dev] [PATCH] devtools: warn about release notes updates
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

Touching release notes should only be for the current version.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 devtools/checkpatches.sh | 44 ++++++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 11 deletions(-)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index db4c7d8301..91560cb399 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -9,7 +9,9 @@
 # - DPDK_CHECKPATCH_OPTIONS
 . $(dirname $(readlink -f $0))/load-devel-config
 
-VALIDATE_NEW_API=$(dirname $(readlink -f $0))/check-symbol-change.sh
+ROOTDIR=$(readlink -f $(dirname $(readlink -f $0))/..)
+VALIDATE_NEW_API=$ROOTDIR/devtools/check-symbol-change.sh
+FORBIDDEN_TOKENS_SCRIPT=$ROOTDIR/devtools/check-forbidden-tokens.awk
 
 # Enable codespell by default. This can be overwritten from a config file.
 # Codespell can also be enabled by setting DPDK_CHECKPATCH_CODESPELL to a valid path
@@ -58,7 +60,7 @@ check_forbidden_additions() { # <patch>
 		-v EXPRESSIONS="rte_panic\\\( rte_exit\\\(" \
 		-v RET_ON_FAIL=1 \
 		-v MESSAGE='Using rte_panic/rte_exit' \
-		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		-f $FORBIDDEN_TOKENS_SCRIPT \
 		"$1" || res=1
 
 	# refrain from using compiler attribute without defining a common macro
@@ -66,7 +68,7 @@ check_forbidden_additions() { # <patch>
 		-v EXPRESSIONS="__attribute__" \
 		-v RET_ON_FAIL=1 \
 		-v MESSAGE='Using compiler attribute directly' \
-		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		-f $FORBIDDEN_TOKENS_SCRIPT \
 		"$1" || res=1
 
 	# forbid variable declaration inside "for" loop
@@ -74,7 +76,7 @@ check_forbidden_additions() { # <patch>
 		-v EXPRESSIONS='for[[:space:]]*\\((char|u?int|unsigned|s?size_t)' \
 		-v RET_ON_FAIL=1 \
 		-v MESSAGE='Declaring a variable inside for()' \
-		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		-f $FORBIDDEN_TOKENS_SCRIPT \
 		"$1" || res=1
 
 	# refrain from new additions of 16/32/64 bits rte_atomicNN_xxx()
@@ -82,7 +84,7 @@ check_forbidden_additions() { # <patch>
 		-v EXPRESSIONS="rte_atomic[0-9][0-9]_.*\\\(" \
 		-v RET_ON_FAIL=1 \
 		-v MESSAGE='Using rte_atomicNN_xxx' \
-		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		-f $FORBIDDEN_TOKENS_SCRIPT \
 		"$1" || res=1
 
 	# refrain from new additions of rte_smp_[r/w]mb()
@@ -90,7 +92,7 @@ check_forbidden_additions() { # <patch>
 		-v EXPRESSIONS="rte_smp_(r|w)?mb\\\(" \
 		-v RET_ON_FAIL=1 \
 		-v MESSAGE='Using rte_smp_[r/w]mb' \
-		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		-f $FORBIDDEN_TOKENS_SCRIPT \
 		"$1" || res=1
 
 	# refrain from using compiler __sync_xxx builtins
@@ -98,7 +100,7 @@ check_forbidden_additions() { # <patch>
 		-v EXPRESSIONS="__sync_.*\\\(" \
 		-v RET_ON_FAIL=1 \
 		-v MESSAGE='Using __sync_xxx builtins' \
-		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		-f $FORBIDDEN_TOKENS_SCRIPT \
 		"$1" || res=1
 
 	# refrain from using compiler __atomic_thread_fence()
@@ -107,7 +109,7 @@ check_forbidden_additions() { # <patch>
 		-v EXPRESSIONS="__atomic_thread_fence\\\(" \
 		-v RET_ON_FAIL=1 \
 		-v MESSAGE='Using __atomic_thread_fence' \
-		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		-f $FORBIDDEN_TOKENS_SCRIPT \
 		"$1" || res=1
 
 	# forbid use of experimental build flag except in examples
@@ -115,7 +117,7 @@ check_forbidden_additions() { # <patch>
 		-v EXPRESSIONS='-DALLOW_EXPERIMENTAL_API allow_experimental_apis' \
 		-v RET_ON_FAIL=1 \
 		-v MESSAGE='Using experimental build flag for in-tree compilation' \
-		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		-f $FORBIDDEN_TOKENS_SCRIPT \
 		"$1" || res=1
 
 	# SVG must be included with wildcard extension to allow conversion
@@ -123,7 +125,7 @@ check_forbidden_additions() { # <patch>
 		-v EXPRESSIONS='::[[:space:]]*[^[:space:]]*\\.svg' \
 		-v RET_ON_FAIL=1 \
 		-v MESSAGE='Using explicit .svg extension instead of .*' \
-		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		-f $FORBIDDEN_TOKENS_SCRIPT \
 		"$1" || res=1
 
 	# links must prefer https over http
@@ -131,7 +133,7 @@ check_forbidden_additions() { # <patch>
 		-v EXPRESSIONS='http://.*dpdk.org' \
 		-v RET_ON_FAIL=1 \
 		-v MESSAGE='Using non https link to dpdk.org' \
-		-f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \
+		-f $FORBIDDEN_TOKENS_SCRIPT \
 		"$1" || res=1
 
 	return $res
@@ -198,6 +200,18 @@ check_internal_tags() { # <patch>
 	return $res
 }
 
+check_release_notes() { # <patch>
+	rel_notes_prefix=doc/guides/rel_notes/release_
+	current_version=$(cat $ROOTDIR/VERSION)
+	major_version=${current_version%%.*}
+	current_version=${current_version##${major_version}.}
+	minor_version=${current_version%%.*}
+	current_rn=${rel_notes_prefix}${major_version}_${minor_version}.rst
+
+	! grep -e '^--- a/'$rel_notes_prefix -e '^+++ b/'$rel_notes_prefix $1 |
+		grep -v $current_rn
+}
+
 number=0
 range='origin/main..'
 quiet=false
@@ -289,6 +303,14 @@ check () { # <patch> <commit> <title>
 		ret=1
 	fi
 
+	! $verbose || printf '\nChecking release notes updates:\n'
+	report=$(check_release_notes "$tmpinput")
+	if [ $? -ne 0 ] ; then
+		$headline_printed || print_headline "$3"
+		printf '%s\n' "$report"
+		ret=1
+	fi
+
 	if [ "$tmpinput" != "$1" ]; then
 		rm -f "$tmpinput"
 		trap - INT
-- 
2.23.0