Skip to contentSkip to conversation

scripts/spdxcheck: Parse j2 comments correctly

PATCH New Thomas Gleixner 1 participant 1 message Nov 29, 2024 Licenses and spdx stuff

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scripts/spdxcheck: Parse j2 comments correctly

j2 files use '#}' as comment closure, which trips up the SPDX parser:

tools/.../definition.j2: 1:36 Invalid token: #}

Handle those comments correctly by removing the closure.

---
 scripts/spdxcheck.py |    3 +++
 1 file changed, 3 insertions(+)
scripts/spdxcheck.py +3 -0
@@ -217,6 +217,9 @@ import os
                 # Special case for SH magic boot code files
                 if line.startswith('LIST \"'):
                     expr = expr.rstrip('\"').strip()
+                # Remove j2 comment closure
+                if line.startswith('{#'):
+                    expr = expr.rstrip('#}').strip()
                 self.parse(expr)
                 self.spdx_valid += 1
                 #