Skip to contentSkip to conversation

devtools: warn about release notes updates

PATCH Superseded David Marchand 2 participants 6 messages May 20, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devtools: warn about release notes updates

Touching release notes should only be for the current version.

---
 devtools/checkpatches.sh | 44 ++++++++++++++++++++++++++++++----------
 1 file changed, 33 insertions(+), 11 deletions(-)
devtools/checkpatches.sh +33 -11
index db4c7d8301..91560cb399 100755
@@ -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
Signature · 1 line
2.23.0
#1 lore raw

20/05/2021 09:58, David Marchand:

devtools/checkpatches.sh line 14

Quoted 8 lines

Touching release notes should only be for the current version.

---

devtools/checkpatches.sh +3 -1
-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

This change is an unrelated cleanup.
Do we keep it in this patch? I'm fine with it, just asking for clarification.

Quoted 8 lines

# 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

devtools/checkpatches.sh +1 -1
@@ -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 \

[...]

devtools/checkpatches.sh check_internal_tags() { # <patch> · line 208

Quoted 6 lines
devtools/checkpatches.sh +6 -0
+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%%.*}

A simpler version:
cat VERSION | IFS=. read major minor release

devtools/checkpatches.sh check_internal_tags() { # <patch> · line 211

Quoted 3 lines
devtools/checkpatches.sh +3 -0
+	current_rn=${rel_notes_prefix}${major_version}_${minor_version}.rst
+
+	! grep -e '^--- a/'$rel_notes_prefix -e '^+++ b/'$rel_notes_prefix $1 |

Only the +++ part should matters.

Quoted 2 lines
devtools/checkpatches.sh +2 -0
+		grep -v $current_rn
+}

[...]

devtools/checkpatches.sh check () { # <patch> <commit> <title> · line 312

Quoted 7 lines
devtools/checkpatches.sh +7 -0
+	! $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

Thanks for adding a new check. More is better :)

#2 lore raw
Quoted 4 lines · Thomas Monjalon

20/05/2021 09:58, David Marchand:

Quoted 2 lines

Touching release notes should only be for the current version.

Quoted 9 lines

devtools/checkpatches.sh line 14

Quoted 6 lines

---

devtools/checkpatches.sh +3 -1
-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

This change is an unrelated cleanup.
Do we keep it in this patch? I'm fine with it, just asking for clarification.

I thought I had dropped it before sending.
Yes this is unrelated, will drop in v2.

Quoted 17 lines
Quoted 9 lines

# 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

devtools/checkpatches.sh +1 -1
@@ -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 \

[...]

devtools/checkpatches.sh check_internal_tags() { # <patch> · line 208

Quoted 6 lines
devtools/checkpatches.sh +6 -0
+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%%.*}
Quoted 2 lines

A simpler version:
cat VERSION | IFS=. read major minor release

Ok with this form.

Quoted 6 lines

devtools/checkpatches.sh check_internal_tags() { # <patch> · line 211

Quoted 4 lines
devtools/checkpatches.sh +3 -0
+     current_rn=${rel_notes_prefix}${major_version}_${minor_version}.rst
+
+     ! grep -e '^--- a/'$rel_notes_prefix -e '^+++ b/'$rel_notes_prefix $1 |

Only the +++ part should matters.

It won't catch accidental removals.
Besides, something that is not handled with my patch is renames.

But if we think those cases would be caught by reviewers, I can simplify this part in v2.

Signature · 1 line
David Marchand
#3 lore raw

20/05/2021 11:59, David Marchand:

Quoted 9 lines · Thomas Monjalon
Quoted 6 lines

20/05/2021 09:58, David Marchand:

devtools/checkpatches.sh check_internal_tags() { # <patch> · line 211

Quoted 3 lines
devtools/checkpatches.sh +3 -0
+     current_rn=${rel_notes_prefix}${major_version}_${minor_version}.rst
+
+     ! grep -e '^--- a/'$rel_notes_prefix -e '^+++ b/'$rel_notes_prefix $1 |

Only the +++ part should matters.

It won't catch accidental removals.

Ah yes

Quoted 1 line

Besides, something that is not handled with my patch is renames.

I think we don't care about renames.

Quoted 2 lines

But if we think those cases would be caught by reviewers, I can simplify this part in v2.

Catching any change (including removal) in old release notes look fine.

#4 lore raw

PATCH v2 1/1 devtools: warn about release notes updates

In reply to David Marchand

Touching release notes should only be for the current version.

---
Changes since v1:
- dropped unrelevant change,
- simplified VERSION extract and updated variable names,

---
 devtools/checkpatches.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)
devtools/checkpatches.sh +17 -0
index db4c7d8301..aff7d2a161 100755
@@ -198,6 +198,15 @@ check_internal_tags() { # <patch>
 	return $res
 }
 
+check_release_notes() { # <patch>
+	rel_notes_prefix=doc/guides/rel_notes/release_
+	IFS=. read year month release < VERSION
+	current_rel_notes=${rel_notes_prefix}${year}_${month}.rst
+
+	! grep -e '^--- a/'$rel_notes_prefix -e '^+++ b/'$rel_notes_prefix $1 |
+		grep -v $current_rel_notes
+}
+
 number=0
 range='origin/main..'
 quiet=false
@@ -289,6 +298,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
Signature · 1 line
2.23.0