summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-xscripts/devtool5
-rw-r--r--scripts/lib/devtool/__init__.py6
-rw-r--r--scripts/lib/devtool/build-image.py2
-rw-r--r--scripts/lib/devtool/deploy.py2
-rw-r--r--scripts/lib/devtool/package.py2
-rw-r--r--scripts/lib/devtool/runqemu.py2
-rw-r--r--scripts/lib/devtool/search.py2
-rw-r--r--scripts/lib/devtool/standard.py10
-rw-r--r--scripts/lib/devtool/upgrade.py2
9 files changed, 17 insertions, 16 deletions
diff --git a/scripts/devtool b/scripts/devtool
index 87df951dc1..e4d9db301a 100755
--- a/scripts/devtool
+++ b/scripts/devtool
@@ -221,9 +221,6 @@ def main():
221 if not config.read(): 221 if not config.read():
222 return -1 222 return -1
223 223
224 # We need to be in this directory or we won't be able to initialise tinfoil
225 os.chdir(basepath)
226
227 bitbake_subdir = config.get('General', 'bitbake_subdir', '') 224 bitbake_subdir = config.get('General', 'bitbake_subdir', '')
228 if bitbake_subdir: 225 if bitbake_subdir:
229 # Normally set for use within the SDK 226 # Normally set for use within the SDK
@@ -244,7 +241,7 @@ def main():
244 scriptutils.logger_setup_color(logger, global_args.color) 241 scriptutils.logger_setup_color(logger, global_args.color)
245 242
246 if global_args.bbpath is None: 243 if global_args.bbpath is None:
247 tinfoil = setup_tinfoil(config_only=True) 244 tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
248 global_args.bbpath = tinfoil.config_data.getVar('BBPATH', True) 245 global_args.bbpath = tinfoil.config_data.getVar('BBPATH', True)
249 else: 246 else:
250 tinfoil = None 247 tinfoil = None
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):
96 newenv[splitval[0]] = splitval[1] 96 newenv[splitval[0]] = splitval[1]
97 return subprocess.call("%s %s" % (fakerootcmd, cmd), env=newenv, **kwargs) 97 return subprocess.call("%s %s" % (fakerootcmd, cmd), env=newenv, **kwargs)
98 98
99def setup_tinfoil(config_only=False): 99def setup_tinfoil(config_only=False, basepath=None):
100 """Initialize tinfoil api from bitbake""" 100 """Initialize tinfoil api from bitbake"""
101 import scriptpath 101 import scriptpath
102 orig_cwd = os.path.abspath(os.curdir)
103 if basepath:
104 os.chdir(basepath)
102 bitbakepath = scriptpath.add_bitbake_lib_path() 105 bitbakepath = scriptpath.add_bitbake_lib_path()
103 if not bitbakepath: 106 if not bitbakepath:
104 logger.error("Unable to find bitbake by searching parent directory of this script or PATH") 107 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):
108 tinfoil = bb.tinfoil.Tinfoil() 111 tinfoil = bb.tinfoil.Tinfoil()
109 tinfoil.prepare(config_only) 112 tinfoil.prepare(config_only)
110 tinfoil.logger.setLevel(logger.getEffectiveLevel()) 113 tinfoil.logger.setLevel(logger.getEffectiveLevel())
114 os.chdir(orig_cwd)
111 return tinfoil 115 return tinfoil
112 116
113def get_recipe_file(cooker, pn): 117def get_recipe_file(cooker, pn):
diff --git a/scripts/lib/devtool/build-image.py b/scripts/lib/devtool/build-image.py
index 05c1d75c67..e53239dd28 100644
--- a/scripts/lib/devtool/build-image.py
+++ b/scripts/lib/devtool/build-image.py
@@ -59,7 +59,7 @@ def build_image(args, config, basepath, workspace):
59 if os.path.isfile(appendfile): 59 if os.path.isfile(appendfile):
60 os.unlink(appendfile) 60 os.unlink(appendfile)
61 61
62 tinfoil = setup_tinfoil() 62 tinfoil = setup_tinfoil(basepath=basepath)
63 rd = parse_recipe(config, tinfoil, image, True) 63 rd = parse_recipe(config, tinfoil, image, True)
64 if not rd: 64 if not rd:
65 # Error already shown 65 # Error already shown
diff --git a/scripts/lib/devtool/deploy.py b/scripts/lib/devtool/deploy.py
index 41b666ff96..c90c6b1f76 100644
--- a/scripts/lib/devtool/deploy.py
+++ b/scripts/lib/devtool/deploy.py
@@ -40,7 +40,7 @@ def deploy(args, config, basepath, workspace):
40 deploy_dir = os.path.join(basepath, 'target_deploy', args.target) 40 deploy_dir = os.path.join(basepath, 'target_deploy', args.target)
41 deploy_file = os.path.join(deploy_dir, args.recipename + '.list') 41 deploy_file = os.path.join(deploy_dir, args.recipename + '.list')
42 42
43 tinfoil = setup_tinfoil() 43 tinfoil = setup_tinfoil(basepath=basepath)
44 try: 44 try:
45 rd = oe.recipeutils.parse_recipe_simple(tinfoil.cooker, args.recipename, tinfoil.config_data) 45 rd = oe.recipeutils.parse_recipe_simple(tinfoil.cooker, args.recipename, tinfoil.config_data)
46 except Exception as e: 46 except Exception as e:
diff --git a/scripts/lib/devtool/package.py b/scripts/lib/devtool/package.py
index 28ecfed7a7..b8d84235c8 100644
--- a/scripts/lib/devtool/package.py
+++ b/scripts/lib/devtool/package.py
@@ -34,7 +34,7 @@ def package(args, config, basepath, workspace):
34 34
35 image_pkgtype = config.get('Package', 'image_pkgtype', '') 35 image_pkgtype = config.get('Package', 'image_pkgtype', '')
36 if not image_pkgtype: 36 if not image_pkgtype:
37 tinfoil = setup_tinfoil() 37 tinfoil = setup_tinfoil(basepath=basepath)
38 try: 38 try:
39 tinfoil.prepare(config_only=True) 39 tinfoil.prepare(config_only=True)
40 image_pkgtype = tinfoil.config_data.getVar('IMAGE_PKGTYPE', True) 40 image_pkgtype = tinfoil.config_data.getVar('IMAGE_PKGTYPE', True)
diff --git a/scripts/lib/devtool/runqemu.py b/scripts/lib/devtool/runqemu.py
index e7f26ab6d8..4d08d8c3dd 100644
--- a/scripts/lib/devtool/runqemu.py
+++ b/scripts/lib/devtool/runqemu.py
@@ -29,7 +29,7 @@ logger = logging.getLogger('devtool')
29def runqemu(args, config, basepath, workspace): 29def runqemu(args, config, basepath, workspace):
30 """Entry point for the devtool 'runqemu' subcommand""" 30 """Entry point for the devtool 'runqemu' subcommand"""
31 31
32 tinfoil = setup_tinfoil() 32 tinfoil = setup_tinfoil(basepath=basepath)
33 machine = tinfoil.config_data.getVar('MACHINE', True) 33 machine = tinfoil.config_data.getVar('MACHINE', True)
34 bindir_native = tinfoil.config_data.getVar('STAGING_BINDIR_NATIVE', True) 34 bindir_native = tinfoil.config_data.getVar('STAGING_BINDIR_NATIVE', True)
35 tinfoil.shutdown() 35 tinfoil.shutdown()
diff --git a/scripts/lib/devtool/search.py b/scripts/lib/devtool/search.py
index e6ae9229c0..c2f420c33c 100644
--- a/scripts/lib/devtool/search.py
+++ b/scripts/lib/devtool/search.py
@@ -29,7 +29,7 @@ logger = logging.getLogger('devtool')
29def search(args, config, basepath, workspace): 29def search(args, config, basepath, workspace):
30 """Entry point for the devtool 'search' subcommand""" 30 """Entry point for the devtool 'search' subcommand"""
31 31
32 tinfoil = setup_tinfoil(config_only=True) 32 tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
33 pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True) 33 pkgdata_dir = tinfoil.config_data.getVar('PKGDATA_DIR', True)
34 tinfoil.shutdown() 34 tinfoil.shutdown()
35 35
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 96b271c2d6..1dcf7cdf07 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -111,7 +111,7 @@ def add(args, config, basepath, workspace):
111 (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree) 111 (stdout, _) = bb.process.run('git rev-parse HEAD', cwd=srctree)
112 initial_rev = stdout.rstrip() 112 initial_rev = stdout.rstrip()
113 113
114 tinfoil = setup_tinfoil(config_only=True) 114 tinfoil = setup_tinfoil(config_only=True, basepath=basepath)
115 rd = oe.recipeutils.parse_recipe(recipefile, None, tinfoil.config_data) 115 rd = oe.recipeutils.parse_recipe(recipefile, None, tinfoil.config_data)
116 if not rd: 116 if not rd:
117 return 1 117 return 1
@@ -231,7 +231,7 @@ class BbTaskExecutor(object):
231def _prep_extract_operation(config, basepath, recipename): 231def _prep_extract_operation(config, basepath, recipename):
232 """HACK: Ugly workaround for making sure that requirements are met when 232 """HACK: Ugly workaround for making sure that requirements are met when
233 trying to extract a package. Returns the tinfoil instance to be used.""" 233 trying to extract a package. Returns the tinfoil instance to be used."""
234 tinfoil = setup_tinfoil() 234 tinfoil = setup_tinfoil(basepath=basepath)
235 rd = parse_recipe(config, tinfoil, recipename, True) 235 rd = parse_recipe(config, tinfoil, recipename, True)
236 236
237 if bb.data.inherits_class('kernel-yocto', rd): 237 if bb.data.inherits_class('kernel-yocto', rd):
@@ -239,7 +239,7 @@ def _prep_extract_operation(config, basepath, recipename):
239 try: 239 try:
240 stdout, _ = exec_build_env_command(config.init_path, basepath, 240 stdout, _ = exec_build_env_command(config.init_path, basepath,
241 'bitbake kern-tools-native') 241 'bitbake kern-tools-native')
242 tinfoil = setup_tinfoil() 242 tinfoil = setup_tinfoil(basepath=basepath)
243 except bb.process.ExecutionError as err: 243 except bb.process.ExecutionError as err:
244 raise DevtoolError("Failed to build kern-tools-native:\n%s" % 244 raise DevtoolError("Failed to build kern-tools-native:\n%s" %
245 err.stdout) 245 err.stdout)
@@ -443,7 +443,7 @@ def modify(args, config, basepath, workspace):
443 if args.extract: 443 if args.extract:
444 tinfoil = _prep_extract_operation(config, basepath, args.recipename) 444 tinfoil = _prep_extract_operation(config, basepath, args.recipename)
445 else: 445 else:
446 tinfoil = setup_tinfoil() 446 tinfoil = setup_tinfoil(basepath=basepath)
447 447
448 rd = parse_recipe(config, tinfoil, args.recipename, True) 448 rd = parse_recipe(config, tinfoil, args.recipename, True)
449 if not rd: 449 if not rd:
@@ -797,7 +797,7 @@ def update_recipe(args, config, basepath, workspace):
797 raise DevtoolError('conf/layer.conf not found in bbappend ' 797 raise DevtoolError('conf/layer.conf not found in bbappend '
798 'destination layer "%s"' % args.append) 798 'destination layer "%s"' % args.append)
799 799
800 tinfoil = setup_tinfoil() 800 tinfoil = setup_tinfoil(basepath=basepath)
801 801
802 rd = parse_recipe(config, tinfoil, args.recipename, True) 802 rd = parse_recipe(config, tinfoil, args.recipename, True)
803 if not rd: 803 if not rd:
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py
index 6c1dfee3fe..aa53c8e00b 100644
--- a/scripts/lib/devtool/upgrade.py
+++ b/scripts/lib/devtool/upgrade.py
@@ -294,7 +294,7 @@ def upgrade(args, config, basepath, workspace):
294 if reason: 294 if reason:
295 raise DevtoolError(reason) 295 raise DevtoolError(reason)
296 296
297 tinfoil = setup_tinfoil() 297 tinfoil = setup_tinfoil(basepath=basepath)
298 298
299 rd = parse_recipe(config, tinfoil, args.recipename, True) 299 rd = parse_recipe(config, tinfoil, args.recipename, True)
300 if not rd: 300 if not rd: