DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] devtools: warn about release notes updates
@ 2021-05-20  7:58 David Marchand
  2021-05-20  9:47 ` Thomas Monjalon
  2021-05-20 10:39 ` [dpdk-dev] [PATCH v2] " David Marchand
  0 siblings, 2 replies; 6+ messages in thread
From: David Marchand @ 2021-05-20  7:58 UTC (permalink / raw)
  To: dev; +Cc: thomas

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


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] devtools: warn about release notes updates
  2021-05-20  7:58 [dpdk-dev] [PATCH] devtools: warn about release notes updates David Marchand
@ 2021-05-20  9:47 ` Thomas Monjalon
  2021-05-20  9:59   ` David Marchand
  2021-05-20 10:39 ` [dpdk-dev] [PATCH v2] " David Marchand
  1 sibling, 1 reply; 6+ messages in thread
From: Thomas Monjalon @ 2021-05-20  9:47 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, ferruh.yigit

20/05/2021 09:58, David Marchand:
> Touching release notes should only be for the current version.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>
> ---
> -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.

>  # 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 \
[...]
> +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

> +	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.

> +		grep -v $current_rn
> +}
[...]
> +	! $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 :)



^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] devtools: warn about release notes updates
  2021-05-20  9:47 ` Thomas Monjalon
@ 2021-05-20  9:59   ` David Marchand
  2021-05-20 10:18     ` Thomas Monjalon
  0 siblings, 1 reply; 6+ messages in thread
From: David Marchand @ 2021-05-20  9:59 UTC (permalink / raw)
  To: Thomas Monjalon; +Cc: dev, Yigit, Ferruh

On Thu, May 20, 2021 at 11:47 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 20/05/2021 09:58, David Marchand:
> > Touching release notes should only be for the current version.
> >
> > Signed-off-by: David Marchand <david.marchand@redhat.com>
> > ---
> > -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.


>
> >  # 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 \
> [...]
> > +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

Ok with this form.


>
> > +     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.


-- 
David Marchand


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH] devtools: warn about release notes updates
  2021-05-20  9:59   ` David Marchand
@ 2021-05-20 10:18     ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2021-05-20 10:18 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, Yigit, Ferruh

20/05/2021 11:59, David Marchand:
> On Thu, May 20, 2021 at 11:47 AM Thomas Monjalon <thomas@monjalon.net> wrote:
> > 20/05/2021 09:58, David Marchand:
> > > +     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

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

I think we don't care about renames.

> 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.



^ permalink raw reply	[flat|nested] 6+ messages in thread

* [dpdk-dev] [PATCH v2] devtools: warn about release notes updates
  2021-05-20  7:58 [dpdk-dev] [PATCH] devtools: warn about release notes updates David Marchand
  2021-05-20  9:47 ` Thomas Monjalon
@ 2021-05-20 10:39 ` David Marchand
  2021-05-20 21:13   ` Thomas Monjalon
  1 sibling, 1 reply; 6+ messages in thread
From: David Marchand @ 2021-05-20 10:39 UTC (permalink / raw)
  To: dev; +Cc: thomas, ferruh.yigit

Touching release notes should only be for the current version.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
Changes since v1:
- dropped unrelevant change,
- simplified VERSION extract and updated variable names,

---
 devtools/checkpatches.sh | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index db4c7d8301..aff7d2a161 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -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
-- 
2.23.0


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [dpdk-dev] [PATCH v2] devtools: warn about release notes updates
  2021-05-20 10:39 ` [dpdk-dev] [PATCH v2] " David Marchand
@ 2021-05-20 21:13   ` Thomas Monjalon
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas Monjalon @ 2021-05-20 21:13 UTC (permalink / raw)
  To: David Marchand; +Cc: dev, ferruh.yigit

20/05/2021 12:39, David Marchand:
> Touching release notes should only be for the current version.
> 
> Signed-off-by: David Marchand <david.marchand@redhat.com>

Applied, thanks




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2021-05-20 21:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-20  7:58 [dpdk-dev] [PATCH] devtools: warn about release notes updates David Marchand
2021-05-20  9:47 ` Thomas Monjalon
2021-05-20  9:59   ` David Marchand
2021-05-20 10:18     ` Thomas Monjalon
2021-05-20 10:39 ` [dpdk-dev] [PATCH v2] " David Marchand
2021-05-20 21:13   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).