diff mbox series

[03/10] recipetool: create_npm: Give the package fallback licenses as strings

Message ID 20261120135342.2628228-4-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>

The npm handler finds the licenses of a dependency in its package.json
when it has no license file. Since 727ea2769c ("license: Remove
tidy_licenses()"), split_pkg_licenses() writes such a fallback value
as it is. The npm handler gives a list, so the recipe gets lines like:

  LICENSE:${PN}-cookie-signature = "['MIT']"

Join the licenses of each package with " AND ", as before that change.

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

Patch

diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py
index 5edf647176..437cb91ad4 100644
--- a/scripts/lib/recipetool/create_npm.py
+++ b/scripts/lib/recipetool/create_npm.py
@@ -282,7 +282,8 @@  class NpmRecipeHandler(RecipeHandler):
         bb.note("Handling licences ...")
         (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)
+        split_pkg_licenses(licvalues, packages, lines_after,
+                           {pkg: " AND ".join(lics) for pkg, lics in fallback_licenses.items()})
         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"] = " AND ".join(fallback_licenses_flat)