oe/license_finder: support extra hashes being passed to find_licenses

When using the license finder the caller might know some more license
hashes, for example if it is updating existing metadata.

Allow the caller to pass more hashes that can be used when identifying
licenses.

(From OE-Core rev: 9011bc307fcdccb144b75d77b36bbc5c8d4bd96d)

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-13 14:16:19 +01:00 committed by Richard Purdie
parent 06f91813cc
commit 32232d2ec1

View File

@ -145,10 +145,11 @@ def find_license_files(srctree, first_only=False):
return licfiles
def match_licenses(licfiles, srctree, d):
def match_licenses(licfiles, srctree, d, extra_hashes={}):
md5sums = {}
md5sums.update(_load_hash_csv(d))
md5sums.update(_crunch_known_licenses(d))
md5sums.update(extra_hashes)
licenses = []
for licfile in sorted(licfiles):
@ -169,9 +170,9 @@ def match_licenses(licfiles, srctree, d):
return licenses
def find_licenses(srctree, d, first_only=False):
def find_licenses(srctree, d, first_only=False, extra_hashes={}):
licfiles = find_license_files(srctree, first_only)
licenses = match_licenses(licfiles, srctree, d)
licenses = match_licenses(licfiles, srctree, d, extra_hashes)
# FIXME should we grab at least one source file with a license header and add that too?