diff mbox series

[01/10] recipetool: create_npm: Give the fallback licenses as a string

Message ID 20261120135342.2628228-2-stondo@gmail.com
State New
Headers show
Series npm: list the dependencies in SRC_URI | expand

Commit Message

Stefano Tondo Nov. 20, 2026, 1:53 p.m. UTC
From: Stefano Tondo <stefano.tondo.ext@siemens.com>

Since 727ea2769c ("license: Remove tidy_licenses()"),
handle_license_vars() reads LICENSE from the extra values as a license
string. The npm handler still gives a set, so recipetool create stops
with "AttributeError: 'set' object has no attribute 'strip'" for each
npm package that has dependencies.

Join the sorted fallback licenses with " AND ". Also remove a line that
sorted a copy of the set and did not use the result.

Signed-off-by: Stefano Tondo <stefano.tondo.ext@siemens.com>
---
 scripts/lib/recipetool/create_npm.py | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py
index 10eca3c63e..5edf647176 100644
--- a/scripts/lib/recipetool/create_npm.py
+++ b/scripts/lib/recipetool/create_npm.py
@@ -283,10 +283,9 @@  class NpmRecipeHandler(RecipeHandler):
         (licfiles, packages, fallback_licenses) = self._handle_licenses(srctree, shrinkwrap_file, dev)
         licvalues = match_licenses(licfiles, srctree, d)
         split_pkg_licenses(licvalues, packages, lines_after, fallback_licenses)
-        fallback_licenses_flat = set(license for sublist in fallback_licenses.values() for license in sublist)
-        fallback_licesens_flat = sorted(fallback_licenses_flat).sort()
+        fallback_licenses_flat = sorted(set(license for sublist in fallback_licenses.values() for license in sublist))
         extravalues["LIC_FILES_CHKSUM"] = generate_common_licenses_chksums(fallback_licenses_flat, d)
-        extravalues["LICENSE"] = fallback_licenses_flat
+        extravalues["LICENSE"] = " AND ".join(fallback_licenses_flat)
 
         classes.append("npm")
         handled.append("buildsystem")