DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Thomas Monjalon <thomas@monjalon.net>
Subject: [PATCH] check-spdk: check that tag is on first line
Date: Wed,  5 Nov 2025 14:28:10 -0800	[thread overview]
Message-ID: <20251105222827.904627-1-stephen@networkplumber.org> (raw)
In-Reply-To: <20251031142018.49319-1-thomas@monjalon.net>

For C files the tag needs to be on the first line.
Add a check for that.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 devtools/check-spdx-tag.sh | 16 +++++++++++++++-
 1 file changed, 15 insertions(+), 1 deletion(-)

diff --git a/devtools/check-spdx-tag.sh b/devtools/check-spdx-tag.sh
index 984825026e..cbb6cd3a8d 100755
--- a/devtools/check-spdx-tag.sh
+++ b/devtools/check-spdx-tag.sh
@@ -67,6 +67,17 @@ check_boilerplate() {
     $quiet || cat $tmpfile
 }
 
+check_firstline() {
+    if $verbose ; then
+	echo "Files with license text not on first line"
+	echo "-----------------------------------------"
+    fi
+    git grep -n SPDX-License-Identifier -- '*.[ch]' | awk -F: '$2 != 1 { print $1}' >$tmpfile
+
+    not_first=$(wc -l < $tmpfile)
+    $quiet || cat $tmpfile
+}
+
 while getopts qvh ARG ; do
 	case $ARG in
 		q ) quiet=true ;;
@@ -89,5 +100,8 @@ $verbose && echo
 check_boilerplate
 $verbose && echo
 
-echo "total: $missing_spdx missing SPDX, $wrong_license license errors, $warnings warnings"
+check_firstline
+$verbose && echo
+
+echo "total: $missing_spdx missing SPDX, $not_first not on first line, $wrong_license license errors, $warnings warnings"
 exit $((missing_spdx + wrong_license))
-- 
2.51.0


  parent reply	other threads:[~2025-11-05 22:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-31 14:20 [PATCH 1/1] move SPDX tag on the " Thomas Monjalon
2025-10-31 14:55 ` Morten Brørup
2025-11-05 21:31   ` Thomas Monjalon
2025-11-05 22:28 ` Stephen Hemminger [this message]
2025-11-05 22:37   ` [PATCH] check-spdk: check that tag is on " Thomas Monjalon
2025-11-06  1:22   ` [PATCH v2] " Stephen Hemminger

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251105222827.904627-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=thomas@monjalon.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).