* [PATCH] scripts/spdxcheck: Handle license identifiers in Jinja comments
@ 2025-01-08 12:52 Lukas Bulwahn
0 siblings, 0 replies; only message in thread
From: Lukas Bulwahn @ 2025-01-08 12:52 UTC (permalink / raw)
To: Thomas Gleixner, Greg Kroah-Hartman, linux-spdx
Cc: linux-kernel, Lukas Bulwahn
From: Lukas Bulwahn <lukas.bulwahn@redhat.com>
Commit 4b132aacb076 ("tools: Add xdrgen") adds a tool, which uses Jinja
template files, i.e., files with the j2 file extension, for its lightweight
code generation.
These template files for this tool have proper headers with the SPDX
License information, which are included as Jinja comments by enclosing the
text with '{#' and '#}'. Sofar, the spdxcheck script does not support to
properly parse this license information in Jinja comments and it reports
back with 'Invalid token: #}'.
Parse Jinja comments properly by stripping the known Jinja comment suffix.
Signed-off-by: Lukas Bulwahn <lukas.bulwahn@redhat.com>
---
scripts/spdxcheck.py | 3 +++
1 file changed, 3 insertions(+)
diff --git a/scripts/spdxcheck.py b/scripts/spdxcheck.py
index 8b8fb115fc81..5c33681492dd 100755
--- a/scripts/spdxcheck.py
+++ b/scripts/spdxcheck.py
@@ -214,6 +214,9 @@ class id_parser(object):
# Remove trailing xml comment closure
if line.strip().endswith('-->'):
expr = expr.rstrip('-->').strip()
+ # Remove trailing Jinja2 comment closure
+ if line.strip().endswith('#}'):
+ expr = expr.rstrip('#}').strip()
# Special case for SH magic boot code files
if line.startswith('LIST \"'):
expr = expr.rstrip('\"').strip()
--
2.47.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-01-08 12:52 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-01-08 12:52 [PATCH] scripts/spdxcheck: Handle license identifiers in Jinja comments Lukas Bulwahn
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®