From 85d8b4a92fc7873a458a92a7d409bf73ff25c23b Mon Sep 17 00:00:00 2001 From: Markus Lehtonen Date: Wed, 23 Sep 2015 11:05:23 +0100 Subject: devtool: second fix for running from a different directory Do not change change current working directory permanently, but, only for the duration of tinfoil initialization instead. The previous fix caused very unintuitive behavior where using relative paths were solved with respect to the builddir instead of the current working directory. E.g. calling "devtool extract zlib ./zlib" would always create create srctree in ${TOPDIR}/zlib, independent of the users cwd. (From OE-Core rev: 4c7f159b0e17a0475a4a4e9dc4dd012e3d2e6a1f) (From OE-Core rev: 05060699e63cd25d089e83e9aa56c11d5baa8fd8) Signed-off-by: Markus Lehtonen Signed-off-by: Ross Burton Signed-off-by: Paul Eggleton Signed-off-by: Richard Purdie --- scripts/lib/devtool/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'scripts/lib/devtool/__init__.py') diff --git a/scripts/lib/devtool/__init__.py b/scripts/lib/devtool/__init__.py index f815ef27fa..7b1ab1110d 100644 --- a/scripts/lib/devtool/__init__.py +++ b/scripts/lib/devtool/__init__.py @@ -96,9 +96,12 @@ def exec_fakeroot(d, cmd, **kwargs): newenv[splitval[0]] = splitval[1] return subprocess.call("%s %s" % (fakerootcmd, cmd), env=newenv, **kwargs) -def setup_tinfoil(config_only=False): +def setup_tinfoil(config_only=False, basepath=None): """Initialize tinfoil api from bitbake""" import scriptpath + orig_cwd = os.path.abspath(os.curdir) + if basepath: + os.chdir(basepath) bitbakepath = scriptpath.add_bitbake_lib_path() if not bitbakepath: logger.error("Unable to find bitbake by searching parent directory of this script or PATH") @@ -108,6 +111,7 @@ def setup_tinfoil(config_only=False): tinfoil = bb.tinfoil.Tinfoil() tinfoil.prepare(config_only) tinfoil.logger.setLevel(logger.getEffectiveLevel()) + os.chdir(orig_cwd) return tinfoil def get_recipe_file(cooker, pn): -- cgit v1.2.3-54-g00ecf