diff options
author | BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com> | 2023-05-31 00:27:49 +0200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-06-29 11:07:51 +0100 |
commit | 488d17c2af0c927ec66f0eee124bf6fc5b7f7c95 (patch) | |
tree | 7229bb9d25e3c5bc66b80821dd72db5f356440ef /scripts | |
parent | a5734148649be93529e5d5172cb47928957a6536 (diff) | |
download | openembedded-core-488d17c2af0c927ec66f0eee124bf6fc5b7f7c95.tar.gz |
recipetool: create: npm: Add support for the new format of the shrinkwrap file
The shrinkwrap file changed its format, but npm does not version this file. So we can use it properly.
The actual changes make the script check if the npm package has dependencies in the actual shrinkwrap format.
Signed-off-by: BELOUARGA Mohamed <m.belouarga@technologyandstrategy.com>
Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'scripts')
-rw-r--r-- | scripts/lib/recipetool/create_npm.py | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py index e667a4d19b..25e7ddb472 100644 --- a/scripts/lib/recipetool/create_npm.py +++ b/scripts/lib/recipetool/create_npm.py @@ -134,11 +134,10 @@ class NpmRecipeHandler(RecipeHandler): licfiles.append(os.path.relpath(readme, srctree)) # Handle the dependencies - def _handle_dependency(name, params, deptree): + def _handle_dependency(name, params, destdir): + deptree = destdir.split('node_modules/') suffix = "-".join([npm_package(dep) for dep in deptree]) - destdirs = [os.path.join("node_modules", dep) for dep in deptree] - destdir = os.path.join(*destdirs) - packages["${PN}-" + suffix] = destdir + packages["${PN}" + suffix] = destdir _licfiles_append_fallback_readme_files(destdir) with open(shrinkwrap_file, "r") as f: @@ -234,7 +233,7 @@ class NpmRecipeHandler(RecipeHandler): value = origvalue.replace("version=" + data["version"], "version=${PV}") value = value.replace("version=latest", "version=${PV}") values = [line.strip() for line in value.strip('\n').splitlines()] - if "dependencies" in shrinkwrap: + if "dependencies" in shrinkwrap.get("packages", {}).get("", {}): values.append(url_recipe) return values, None, 4, False |