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

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.

(From OE-Core rev: 9679f4055ad5a077c6b06aa6125cee4e8fa93471)

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton 2025-06-04 15:03:22 +01:00 committed by Richard Purdie
parent 5de314ddb3
commit 632bb571d7

View File

@ -1250,7 +1250,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))