summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/fetch2/npm.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/fetch2/npm.py')
-rw-r--r--bitbake/lib/bb/fetch2/npm.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/bitbake/lib/bb/fetch2/npm.py b/bitbake/lib/bb/fetch2/npm.py
index 2fd43034ba..b26ac22eff 100644
--- a/bitbake/lib/bb/fetch2/npm.py
+++ b/bitbake/lib/bb/fetch2/npm.py
@@ -113,16 +113,13 @@ class Npm(FetchMethod):
113 bb.fatal("NPM package %s downloaded not a tarball!" % file) 113 bb.fatal("NPM package %s downloaded not a tarball!" % file)
114 114
115 # Change to subdir before executing command 115 # Change to subdir before executing command
116 save_cwd = os.getcwd()
117 if not os.path.exists(destdir): 116 if not os.path.exists(destdir):
118 os.makedirs(destdir) 117 os.makedirs(destdir)
119 os.chdir(destdir)
120 path = d.getVar('PATH', True) 118 path = d.getVar('PATH', True)
121 if path: 119 if path:
122 cmd = "PATH=\"%s\" %s" % (path, cmd) 120 cmd = "PATH=\"%s\" %s" % (path, cmd)
123 bb.note("Unpacking %s to %s/" % (file, os.getcwd())) 121 bb.note("Unpacking %s to %s/" % (file, destdir))
124 ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True) 122 ret = subprocess.call(cmd, preexec_fn=subprocess_setup, shell=True, cwd=destdir)
125 os.chdir(save_cwd)
126 123
127 if ret != 0: 124 if ret != 0:
128 raise UnpackError("Unpack command %s failed with return value %s" % (cmd, ret), ud.url) 125 raise UnpackError("Unpack command %s failed with return value %s" % (cmd, ret), ud.url)
@@ -239,10 +236,7 @@ class Npm(FetchMethod):
239 if not os.listdir(ud.pkgdatadir) and os.path.exists(ud.fullmirror): 236 if not os.listdir(ud.pkgdatadir) and os.path.exists(ud.fullmirror):
240 dest = d.getVar("DL_DIR", True) 237 dest = d.getVar("DL_DIR", True)
241 bb.utils.mkdirhier(dest) 238 bb.utils.mkdirhier(dest)
242 save_cwd = os.getcwd() 239 runfetchcmd("tar -xJf %s" % (ud.fullmirror), d, workdir=dest)
243 os.chdir(dest)
244 runfetchcmd("tar -xJf %s" % (ud.fullmirror), d)
245 os.chdir(save_cwd)
246 return 240 return
247 241
248 shwrf = d.getVar('NPM_SHRINKWRAP', True) 242 shwrf = d.getVar('NPM_SHRINKWRAP', True)
@@ -275,10 +269,8 @@ class Npm(FetchMethod):
275 if os.path.islink(ud.fullmirror): 269 if os.path.islink(ud.fullmirror):
276 os.unlink(ud.fullmirror) 270 os.unlink(ud.fullmirror)
277 271
278 save_cwd = os.getcwd() 272 dldir = d.getVar("DL_DIR", True)
279 os.chdir(d.getVar("DL_DIR", True))
280 logger.info("Creating tarball of npm data") 273 logger.info("Creating tarball of npm data")
281 runfetchcmd("tar -cJf %s npm/%s npm/%s" % (ud.fullmirror, ud.bbnpmmanifest, ud.pkgname), d) 274 runfetchcmd("tar -cJf %s npm/%s npm/%s" % (ud.fullmirror, ud.bbnpmmanifest, ud.pkgname), d,
282 runfetchcmd("touch %s.done" % (ud.fullmirror), d) 275 workdir=dldir)
283 os.chdir(save_cwd) 276 runfetchcmd("touch %s.done" % (ud.fullmirror), d, workdir=dldir)
284