Created attachment 5249 [details] recipetool create: npm: fail when parsing licenses defined in package.json Hello, recipetool from Wrynose (and likely from master) fail to generate the recipe template (.bb) to package a npm project when licenses defined in package.json are used in last resort (when there is no license file found). FileNotFoundError: [Errno 2] No such file or directory: '[...]/openembedded-core/meta/files/common-licenses/[foo]' Since commit [1], the package.json parsing expect a SPDX format while it's not guaranteed [2]. _get_licenses_from_package_json() fail to parse custom license string containing spaces, each space separated text is handled as a license info added to fallback_licenses list. Latter, generate_common_licenses_chksums() uses common license files present in COMMON_LICENSE_DIR. So any listed license in fallback_licenses (fallback_licenses_flat), must exist in COMMON_LICENSE_DIR. We can still find a few npm package using custom strings: "license": "SEE LICENSE IN LICENSE", "license": "Apache 2.0" "license": "CC BY 4.0" While such npm package must be fixed upstream, the recipetool should not crash and careful check its input from parsed package.json files. Since offending npm packages doesn't provide any further licensing information, what should recipetool do? Here is an experimental patch to filter out non SPDX licences from fallback_licenses_flat. [1] https://github.com/openembedded/openembedded-core/commit/445604cfc4a5813ea635f18053cd1f673bf0b830 [2] https://docs.npmjs.com/cli/v12/configuring-npm/package-json#license Best regards, Romain
Should exit more gracefully with a sensible error.