Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

scripts/spdxcheck: Handle license identifiers in Jinja comments

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>
Link: https://lore.kernel.org/r/20250108125207.57486-1-lukas.bulwahn@redhat.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Lukas Bulwahn and committed by
Greg Kroah-Hartman
154916f4 634d34e8

+3
+3
scripts/spdxcheck.py
··· 214 214 # Remove trailing xml comment closure 215 215 if line.strip().endswith('-->'): 216 216 expr = expr.rstrip('-->').strip() 217 + # Remove trailing Jinja2 comment closure 218 + if line.strip().endswith('#}'): 219 + expr = expr.rstrip('#}').strip() 217 220 # Special case for SH magic boot code files 218 221 if line.startswith('LIST \"'): 219 222 expr = expr.rstrip('\"').strip()