diff mbox series

[5/9] recipetool/create: show more of the license path when it can't be identified

Message ID 20250529202802.1198179-6-ross.burton@arm.com
State New
Headers show
Series Go module update class | expand

Commit Message

Ross Burton May 29, 2025, 8:27 p.m. UTC
If there are multiple source trees in a project (incredibly common with
go-mod, for example) then the relative path of the LICENSE file from
the source tree could just be "LICENSE", which is not useful when there
are tens of files across the recipe with that name.

Show the parent directory name too, to clarify which file is unknown.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 scripts/lib/recipetool/create.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py
index 24315b95b08..390cc37db43 100644
--- a/scripts/lib/recipetool/create.py
+++ b/scripts/lib/recipetool/create.py
@@ -1251,7 +1251,7 @@  def match_licenses(licfiles, srctree, d):
                 license = 'Unknown'
                 logger.info("Please add the following line for '%s' to a 'lib/recipetool/licenses.csv' " \
                     "and replace `Unknown` with the license:\n" \
-                    "%s,Unknown" % (os.path.relpath(licfile, srctree), md5value))
+                    "%s,Unknown" % (os.path.relpath(licfile, srctree + "/.."), md5value))
         if license:
             licenses.append((license, os.path.relpath(licfile, srctree), md5value))