summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKamel Bouhara <kamel.bouhara@bootlin.com>2021-01-14 08:12:35 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2021-01-16 22:39:17 +0000
commitef153ad36d0299e83a03af8f207686d0d8a238b3 (patch)
tree152a7fb7bff2c7ec08e71021faaee8d05885d5c4
parent47760b0d7d66b2b68ee197d359f0b7b17374d742 (diff)
downloadopenembedded-core-contrib-ef153ad36d0299e83a03af8f207686d0d8a238b3.tar.gz
openembedded-core-contrib-ef153ad36d0299e83a03af8f207686d0d8a238b3.tar.bz2
openembedded-core-contrib-ef153ad36d0299e83a03af8f207686d0d8a238b3.zip
recipetool: create: only add npmsw url if required
Before adding a npmsw fetcher to a recipe we should first check if the generated shrinkwrap file contains dependencies. Signed-off-by: Kamel Bouhara <kamel.bouhara@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/recipetool/create_npm.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/scripts/lib/recipetool/create_npm.py b/scripts/lib/recipetool/create_npm.py
index 579b7ae48a..2bcae91dfa 100644
--- a/scripts/lib/recipetool/create_npm.py
+++ b/scripts/lib/recipetool/create_npm.py
@@ -204,6 +204,9 @@ class NpmRecipeHandler(RecipeHandler):
self._run_npm_install(d, srctree, registry, dev)
shrinkwrap_file = self._generate_shrinkwrap(d, srctree, dev)
+ with open(shrinkwrap_file, "r") as f:
+ shrinkwrap = json.load(f)
+
if os.path.exists(lock_copy):
bb.utils.movefile(lock_copy, lock_file)
@@ -226,7 +229,8 @@ 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()]
- values.append(url_recipe)
+ if "dependencies" in shrinkwrap:
+ values.append(url_recipe)
return values, None, 4, False
(_, newlines) = bb.utils.edit_metadata(lines_before, ["SRC_URI"], _handle_srcuri)