mirror of
https://git.yoctoproject.org/poky
synced 2026-02-05 16:28:43 +01:00
npm.bbclass: make shrinkwrap file optional
Some packages don't have shrinkwrap file which means no npmsw uri is provided in the recipe. (From OE-Core rev: 47760b0d7d66b2b68ee197d359f0b7b17374d742) Signed-off-by: Kamel Bouhara <kamel.bouhara@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
committed by
Richard Purdie
parent
a2ca184abb
commit
8b0884569f
@@ -130,11 +130,17 @@ python npm_do_configure() {
|
||||
cached_manifest.pop("dependencies", None)
|
||||
cached_manifest.pop("devDependencies", None)
|
||||
|
||||
with open(orig_shrinkwrap_file, "r") as f:
|
||||
orig_shrinkwrap = json.load(f)
|
||||
has_shrinkwrap_file = True
|
||||
|
||||
cached_shrinkwrap = copy.deepcopy(orig_shrinkwrap)
|
||||
cached_shrinkwrap.pop("dependencies", None)
|
||||
try:
|
||||
with open(orig_shrinkwrap_file, "r") as f:
|
||||
orig_shrinkwrap = json.load(f)
|
||||
except IOError:
|
||||
has_shrinkwrap_file = False
|
||||
|
||||
if has_shrinkwrap_file:
|
||||
cached_shrinkwrap = copy.deepcopy(orig_shrinkwrap)
|
||||
cached_shrinkwrap.pop("dependencies", None)
|
||||
|
||||
# Manage the dependencies
|
||||
progress = OutOfProgressHandler(d, r"^(\d+)/(\d+)$")
|
||||
@@ -165,8 +171,10 @@ python npm_do_configure() {
|
||||
progress.write("%d/%d" % (progress_done, progress_total))
|
||||
|
||||
dev = bb.utils.to_boolean(d.getVar("NPM_INSTALL_DEV"), False)
|
||||
foreach_dependencies(orig_shrinkwrap, _count_dependency, dev)
|
||||
foreach_dependencies(orig_shrinkwrap, _cache_dependency, dev)
|
||||
|
||||
if has_shrinkwrap_file:
|
||||
foreach_dependencies(orig_shrinkwrap, _count_dependency, dev)
|
||||
foreach_dependencies(orig_shrinkwrap, _cache_dependency, dev)
|
||||
|
||||
# Configure the main package
|
||||
with tempfile.TemporaryDirectory() as tmpdir:
|
||||
@@ -181,16 +189,19 @@ python npm_do_configure() {
|
||||
cached_manifest[depkey] = {}
|
||||
cached_manifest[depkey][name] = version
|
||||
|
||||
_update_manifest("dependencies")
|
||||
if has_shrinkwrap_file:
|
||||
_update_manifest("dependencies")
|
||||
|
||||
if dev:
|
||||
_update_manifest("devDependencies")
|
||||
if has_shrinkwrap_file:
|
||||
_update_manifest("devDependencies")
|
||||
|
||||
with open(cached_manifest_file, "w") as f:
|
||||
json.dump(cached_manifest, f, indent=2)
|
||||
|
||||
with open(cached_shrinkwrap_file, "w") as f:
|
||||
json.dump(cached_shrinkwrap, f, indent=2)
|
||||
if has_shrinkwrap_file:
|
||||
with open(cached_shrinkwrap_file, "w") as f:
|
||||
json.dump(cached_shrinkwrap, f, indent=2)
|
||||
}
|
||||
|
||||
python npm_do_compile() {
|
||||
|
||||
Reference in New Issue
Block a user