summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
authorZoltán Böszörményi <zboszor@gmail.com>2022-05-13 17:30:29 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-05-15 08:57:09 +0100
commitc6740091cb7336aaa3bb9b692fe4dc6fc92aa3a8 (patch)
tree862bb84b5d6d30addd1e6016b36b2c2098b05438 /meta
parent186df231f95096c0ee0f29f1080deb351701374f (diff)
downloadopenembedded-core-c6740091cb7336aaa3bb9b692fe4dc6fc92aa3a8.tar.gz
npm.bbclass: Fix file permissions before opening it for writing
Some node module archives in npmjs.org contain wrong permissions. I found a case with package.json in the archive being r-xr-xr-x for which open(..., "w") fails. Modify the manifest file permissions to add the write bit for the owner. Signed-off-by: Zoltán Böszörményi <zboszor@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r--meta/classes/npm.bbclass2
1 files changed, 2 insertions, 0 deletions
diff --git a/meta/classes/npm.bbclass b/meta/classes/npm.bbclass
index ba50fcac20..86ee0f665a 100644
--- a/meta/classes/npm.bbclass
+++ b/meta/classes/npm.bbclass
@@ -81,6 +81,7 @@ python npm_do_configure() {
import json
import re
import shlex
+ import stat
import tempfile
from bb.fetch2.npm import NpmEnvironment
from bb.fetch2.npm import npm_unpack
@@ -202,6 +203,7 @@ python npm_do_configure() {
if has_shrinkwrap_file:
_update_manifest("devDependencies")
+ os.chmod(cached_manifest_file, os.stat(cached_manifest_file).st_mode | stat.S_IWUSR)
with open(cached_manifest_file, "w") as f:
json.dump(cached_manifest, f, indent=2)