Skip to contentSkip to conversation

devtools: align trailer checks with kernel convention

PATCH New Stephen Hemminger 1 participant 3 messages Apr 2

lore
Share & tools
lore
#0 lore raw

cover devtools: align trailer checks with kernel convention

This series makes four incremental changes to check-git-log.sh to align DPDK's commit message trailer handling with the Linux kernel convention.

The motivation came from the recent work in kernel where the same patch needed different trailer formatting for DPDK vs. the kernel. This is unnecessary friction for developers who work across both projects.

Patch 1: Use git's built-in %(trailers) format instead of grepping
the commit body with hand-rolled patterns.

Patch 2: Recognize the kernel trailer tags that DPDK was missing:
Co-developed-by, Closes:, and Link:. Also adds proper format validation for Cc:, Coverity issue:, and Bugzilla ID: tags.

Patch 3: Remove the blank line requirement between relation tags
(Fixes, Cc) and attribution tags (Signed-off-by). All trailers now form a single contiguous block, matching kernel convention and git-interpret-trailers(1) semantics.

Patch 4: Demote tag ordering from error to warning, since the
kernel itself does not enforce strict ordering via tooling.

Stephen Hemminger (4):
devtools: use git trailer parser for tag extraction
devtools: recognize kernel trailer tags
devtools: remove blank line requirement between trailers
devtools: demote tag ordering to warning

 devtools/check-git-log.sh | 50 +++++++++++++++++++++++----------------
 1 file changed, 29 insertions(+), 21 deletions(-)
Signature · 1 line
2.53.0
#1 lore raw

RFC 3/4 devtools: remove blank line requirement between trailers

Remove the SEQ[4]="^$" entry that required a blank line between relation tags (Fixes, Cc) and attribution tags (Signed-off-by).

In the Linux kernel, all trailers form a single contiguous block with no internal blank lines. This is also how git-interpret-trailers(1) defines a trailer block: a group of consecutive trailer lines preceded by a blank line. A blank line within the block causes git to only parse the lower portion, losing the upper trailers.

Use %(trailers:key-only) to feed tag names into the ordering check instead of the previous grep+cut pipeline on the body. This is consistent with the %(trailers:unfold) change for tag extraction.

---
 devtools/check-git-log.sh | 33 +++++++++++++++++----------------
 1 file changed, 17 insertions(+), 16 deletions(-)
devtools/check-git-log.sh +17 -16
index 3775b1587f..94cf68b926 100755
@@ -223,28 +223,29 @@ done)
 	&& failure=true;}
 
 # check tag sequence
+# All trailers form a single contiguous block with no blank lines,
+# matching kernel/netdev convention and git-interpret-trailers(1).
 bad=$(for commit in $commits; do
-	body=$(git log --format='%b' -1 $commit)
-	echo "$body" |
-	grep -o -e "$reltag\|^[[:blank:]]*$\|$bytag" |
-	# retrieve tags only
-	cut -f1 -d":" |
+	git log --format='%(trailers:key-only)' -1 $commit |
+	grep -v '^$' |
 	# it is okay to have several tags of the same type
 	# but for processing we need to squash them
 	uniq |
 	# make sure the tags are in the proper order as presented in SEQ
 	awk -v subject="$(git log --format='\t%s' -1 $commit)" 'BEGIN{
-		SEQ[0] = "Coverity issue";
-		SEQ[1] = "Bugzilla ID";
-		SEQ[2] = "Fixes";
-		SEQ[3] = "Cc";
-		SEQ[4] = "^$";
-		SEQ[5] = "Reported-by";
-		SEQ[6] = "Suggested-by";
-		SEQ[7] = "Signed-off-by";
-		SEQ[8] = "Acked-by";
-		SEQ[9] = "Reviewed-by";
-		SEQ[10] = "Tested-by";
+		SEQ[0] = "Fixes";
+		SEQ[1] = "Closes";
+		SEQ[2] = "Link";
+		SEQ[3] = "Coverity issue";
+		SEQ[4] = "Bugzilla ID";
+		SEQ[5] = "Cc";
+		SEQ[6] = "Reported-by";
+		SEQ[7] = "Suggested-by";
+		SEQ[8] = "Co-developed-by";
+		SEQ[9] = "Signed-off-by";
+		SEQ[10] = "Acked-by";
+		SEQ[11] = "Reviewed-by";
+		SEQ[12] = "Tested-by";
 		latest = 0;
 		chronological = 0;
 	}
Signature · 1 line
2.53.0
#2 lore raw

RFC 4/4 devtools: demote tag ordering to warning

In reply to Stephen Hemminger

The Linux kernel does not enforce a strict tag ordering via tooling. Ordering is a convention, enforced socially by maintainers rather than by checkpatch.pl. The b4 tool has a configurable trailer-order preference, but it is not mandatory.

Demote the tag ordering check from an error (which sets failure=true and causes a non-zero exit) to a warning (printed but does not affect the exit code). This avoids rejecting patches that are otherwise correct but happen to have Reviewed-by before Acked-by or similar minor ordering differences.

---
 devtools/check-git-log.sh | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
devtools/check-git-log.sh +1 -2
index 94cf68b926..5b621f5c8d 100755
@@ -266,8 +266,7 @@ bad=$(for commit in $commits; do
 			chronological = 1;
 	 }'
 done)
-[ -z "$bad" ] || { printf "Wrong tag order: \n$bad\n"\
-	&& failure=true;}
+[ -z "$bad" ] || printf "WARNING: non-preferred tag order: \n$bad\n"
 
 # check required tag
 bad=$(for commit in $commits; do
Signature · 1 line
2.53.0