DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] checkpatches: verify in-reply-to header when possible
@ 2024-07-05 15:35 Robin Jarry
  2024-10-07 20:41 ` Stephen Hemminger
  2024-10-11  8:24 ` [PATCH dpdk v2] " Robin Jarry
  0 siblings, 2 replies; 4+ messages in thread
From: Robin Jarry @ 2024-07-05 15:35 UTC (permalink / raw)
  To: dev, Thomas Monjalon

When using checkpatches.sh locally, verify that there is an In-Reply-To
header when the patch is a respin (i.e. v2, v3, etc.). This is currently
only enforced by the upstream CI but cannot be verified locally.

This cannot be verified when checking commit ids since --in-reply-to is
a git-format-patch option which is not specified by checkpatches.sh when
generating temporary files.

Here is an example:

 $ git format-patch -v6 -1 --stdout | devtools/checkpatches.sh
 warning: [PATCH v6] graph: expose node context as pointers
 warning: respins must be --in-reply-to=<v1.patch@message.id>.
 0/1 valid patch

 $ git format-patch -v6 -1 --stdout --in-reply-to=foo | \
                     devtools/checkpatches.sh
 1/1 valid patch

Link: https://git.dpdk.org/tools/dpdk-ci/commit/?id=070b31649e48460b3
Signed-off-by: Robin Jarry <rjarry@redhat.com>
---
 devtools/checkpatches.sh | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index bfacd77f398a..cb1c9972a71f 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -405,11 +405,13 @@ status=0
 check () { # <patch-file> <commit>
 	local ret=0
 	local subject=''
+	local check_in_reply_to=false
 	headline_printed=false
 
 	total=$(($total + 1))
 	if [ -n "$1" ] ; then
 		tmpinput=$1
+		check_in_reply_to=true
 	else
 		tmpinput=$(mktemp -t dpdk.checkpatches.XXXXXX)
 		trap "rm -f '$tmpinput'" INT
@@ -419,6 +421,7 @@ check () { # <patch-file> <commit>
 			--no-stat --stdout -1 $commit > "$tmpinput"
 		else
 			cat > "$tmpinput"
+			check_in_reply_to=true
 		fi
 	fi
 
@@ -426,6 +429,16 @@ check () { # <patch-file> <commit>
 	subject=$(sed '/^Subject: */!d;s///;N;s,\n[[:space:]]\+, ,;s,\n.*,,;q' "$tmpinput")
 	! $verbose || print_headline "$subject"
 
+	# check In-Reply-To for version > 1
+	if [ "$check_in_reply_to" = true ] \
+		&& echo "$subject" | grep -qi 'v[2-9].*\]' \
+		&& ! grep -qi '^In-Reply-To: ' "$tmpinput"
+	then
+		echo "warning: $subject"
+		echo "warning: respins must be --in-reply-to=<v1.patch@message.id>."
+		ret=1
+	fi
+
 	! $verbose || printf 'Running checkpatch.pl:\n'
 	report=$($DPDK_CHECKPATCH_PATH $options "$tmpinput" 2>/dev/null)
 	if [ $? -ne 0 ] ; then
-- 
2.45.2


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

* Re: [PATCH] checkpatches: verify in-reply-to header when possible
  2024-07-05 15:35 [PATCH] checkpatches: verify in-reply-to header when possible Robin Jarry
@ 2024-10-07 20:41 ` Stephen Hemminger
  2024-10-07 20:43   ` Robin Jarry
  2024-10-11  8:24 ` [PATCH dpdk v2] " Robin Jarry
  1 sibling, 1 reply; 4+ messages in thread
From: Stephen Hemminger @ 2024-10-07 20:41 UTC (permalink / raw)
  To: Robin Jarry; +Cc: dev, Thomas Monjalon

On Fri,  5 Jul 2024 17:35:33 +0200
Robin Jarry <rjarry@redhat.com> wrote:

> When using checkpatches.sh locally, verify that there is an In-Reply-To
> header when the patch is a respin (i.e. v2, v3, etc.). This is currently
> only enforced by the upstream CI but cannot be verified locally.
> 
> This cannot be verified when checking commit ids since --in-reply-to is
> a git-format-patch option which is not specified by checkpatches.sh when
> generating temporary files.
> 
> Here is an example:
> 
>  $ git format-patch -v6 -1 --stdout | devtools/checkpatches.sh
>  warning: [PATCH v6] graph: expose node context as pointers
>  warning: respins must be --in-reply-to=<v1.patch@message.id>.
>  0/1 valid patch
> 
>  $ git format-patch -v6 -1 --stdout --in-reply-to=foo | \
>                      devtools/checkpatches.sh
>  1/1 valid patch
> 
> Link: https://git.dpdk.org/tools/dpdk-ci/commit/?id=070b31649e48460b3
> Signed-off-by: Robin Jarry <rjarry@redhat.com>
> ---
>  devtools/checkpatches.sh | 13 +++++++++++++
>  1 file changed, 13 insertions(+)
> 
> diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
> index bfacd77f398a..cb1c9972a71f 100755
> --- a/devtools/checkpatches.sh
> +++ b/devtools/checkpatches.sh
> @@ -405,11 +405,13 @@ status=0
>  check () { # <patch-file> <commit>
>  	local ret=0
>  	local subject=''
> +	local check_in_reply_to=false
>  	headline_printed=false
>  
>  	total=$(($total + 1))
>  	if [ -n "$1" ] ; then
>  		tmpinput=$1
> +		check_in_reply_to=true
>  	else
>  		tmpinput=$(mktemp -t dpdk.checkpatches.XXXXXX)
>  		trap "rm -f '$tmpinput'" INT
> @@ -419,6 +421,7 @@ check () { # <patch-file> <commit>
>  			--no-stat --stdout -1 $commit > "$tmpinput"
>  		else
>  			cat > "$tmpinput"
> +			check_in_reply_to=true
>  		fi
>  	fi
>  
> @@ -426,6 +429,16 @@ check () { # <patch-file> <commit>
>  	subject=$(sed '/^Subject: */!d;s///;N;s,\n[[:space:]]\+, ,;s,\n.*,,;q' "$tmpinput")
>  	! $verbose || print_headline "$subject"
>  
> +	# check In-Reply-To for version > 1
> +	if [ "$check_in_reply_to" = true ] \
> +		&& echo "$subject" | grep -qi 'v[2-9].*\]' \

Your regex won't work for v10 etc.

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

* Re: [PATCH] checkpatches: verify in-reply-to header when possible
  2024-10-07 20:41 ` Stephen Hemminger
@ 2024-10-07 20:43   ` Robin Jarry
  0 siblings, 0 replies; 4+ messages in thread
From: Robin Jarry @ 2024-10-07 20:43 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: dev, Thomas Monjalon

Stephen Hemminger, Oct 07, 2024 at 22:41:
>> +		&& echo "$subject" | grep -qi 'v[2-9].*\]' \
>
> Your regex won't work for v10 etc.

Good catch. I'll send a v2.


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

* [PATCH dpdk v2] checkpatches: verify in-reply-to header when possible
  2024-07-05 15:35 [PATCH] checkpatches: verify in-reply-to header when possible Robin Jarry
  2024-10-07 20:41 ` Stephen Hemminger
@ 2024-10-11  8:24 ` Robin Jarry
  1 sibling, 0 replies; 4+ messages in thread
From: Robin Jarry @ 2024-10-11  8:24 UTC (permalink / raw)
  To: dev, Thomas Monjalon; +Cc: Stephen Hemminger

When using checkpatches.sh locally, verify that there is an In-Reply-To
header when the patch is a respin (i.e. v2, v3, etc.). This is currently
only enforced by the upstream CI but cannot be verified locally.

This cannot be verified when checking commit ids since --in-reply-to is
a git-format-patch option which is not specified by checkpatches.sh when
generating temporary files.

Here is an example:

 $ git format-patch -v6 -1 --stdout | devtools/checkpatches.sh
 warning: [PATCH v6] graph: expose node context as pointers
 warning: respins must be --in-reply-to=<v1.patch@message.id>.
 0/1 valid patch

 $ git format-patch -v12345 -1 --stdout | devtools/checkpatches.sh
 warning: [PATCH v12345] graph: expose node context as pointers
 warning: respins must be --in-reply-to=<v1.patch@message.id>.
 0/1 valid patch

 $ git format-patch -v6 -1 --stdout --in-reply-to=foo | \
                     devtools/checkpatches.sh
 1/1 valid patch

Link: https://git.dpdk.org/tools/dpdk-ci/commit/?id=070b31649e48460b3
Signed-off-by: Robin Jarry <rjarry@redhat.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
---

Notes:
    v2: fix check for v1[0-9]+

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

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 17a05e4986fd..b8ca2f67bbd4 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -414,11 +414,13 @@ status=0
 check () { # <patch-file> <commit>
 	local ret=0
 	local subject=''
+	local check_in_reply_to=false
 	headline_printed=false
 
 	total=$(($total + 1))
 	if [ -n "$1" ] ; then
 		tmpinput=$1
+		check_in_reply_to=true
 	else
 		tmpinput=$(mktemp -t dpdk.checkpatches.XXXXXX)
 		trap "rm -f '$tmpinput'" INT
@@ -428,6 +430,7 @@ check () { # <patch-file> <commit>
 			--no-stat --stdout -1 $commit > "$tmpinput"
 		else
 			cat > "$tmpinput"
+			check_in_reply_to=true
 		fi
 	fi
 
@@ -435,6 +438,16 @@ check () { # <patch-file> <commit>
 	subject=$(sed '/^Subject: */!d;s///;N;s,\n[[:space:]]\+, ,;s,\n.*,,;q' "$tmpinput")
 	! $verbose || print_headline "$subject"
 
+	# check In-Reply-To for version > 1
+	if [ "$check_in_reply_to" = true ] \
+		&& echo "$subject" | grep -Eq '\[[^]]+\<v([2-9]|[1-9][0-9]+)\>[^]]*\]' \
+		&& ! grep -qi '^In-Reply-To: ' "$tmpinput"
+	then
+		echo "warning: $subject"
+		echo "warning: respins must be --in-reply-to=<v1.patch@message.id>."
+		ret=1
+	fi
+
 	! $verbose || printf 'Running checkpatch.pl:\n'
 	report=$($DPDK_CHECKPATCH_PATH $options "$tmpinput" 2>/dev/null)
 	if [ $? -ne 0 ] ; then
-- 
2.46.2


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

end of thread, other threads:[~2024-10-11  8:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-07-05 15:35 [PATCH] checkpatches: verify in-reply-to header when possible Robin Jarry
2024-10-07 20:41 ` Stephen Hemminger
2024-10-07 20:43   ` Robin Jarry
2024-10-11  8:24 ` [PATCH dpdk v2] " Robin Jarry

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