@@ -55,7 +55,8 @@ def _crunch_known_licenses(d):
md5sums[md5value] = fn
# Also hash a "crunched" version
md5value = _crunch_license(path)
- md5sums[md5value] = fn
+ if md5value:
+ md5sums[md5value] = fn
return md5sums
@@ -115,6 +116,11 @@ def _crunch_license(licfile):
if line:
lictext.append(line)
+ # Only titles, copyright lines or URLs: there is no license text to
+ # compare, and an empty text would match every other empty text
+ if not lictext:
+ return None
+
m = hashlib.md5()
try:
m.update(' '.join(lictext).encode('utf-8'))
_crunch_license() drops titles, copyright lines and URLs, so a file with nothing else hashes as an empty text, as does common-licenses/Proprietary. Such a file matched "Proprietary", which is not an SPDX identifier, and go-mod-update-modules failed with "Unknown Expression 'Proprietary'". Return None when no text is left, and do not register None as the hash of a known license. An exact copy of a license file still matches by its plain md5. AI-Generated: Claude Opus 5.5 Signed-off-by: Tim Orling <tim.orling@konsulko.com> --- meta/lib/oe/license_finder.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)