]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
oe/license_finder: support extra hashes being passed to find_licenses
authorRoss Burton <ross.burton@arm.com>
Fri, 13 Jun 2025 13:16:19 +0000 (14:16 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 16 Jun 2025 16:56:27 +0000 (17:56 +0100)
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.

Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/lib/oe/license_finder.py

index 1bdc39e1c533b353580e0397806a04230113b0bb..16f5d7c94cb6f08f5460b143d3b50a9593553fd4 100644 (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?