summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2017-07-20 16:48:08 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-07-21 08:44:25 +0100
commita9848fdd46f4f567444e00892a0f5868deea1643 (patch)
treebfaa7f438913bb5ae5f4dc7fb7e6c991a156e107
parentdbc7ca268ca61d14406c1f2fc7b6e4dad0bea9e1 (diff)
downloadpoky-a9848fdd46f4f567444e00892a0f5868deea1643.tar.gz
devtool: extract: refactor kern-tools-native handling
When extracting linux-yocto kernel source, we don't need to dance around shutting down and starting up tinfoil anymore, we can just execute the tasks as needed when needed using tinfoil's new build_targets() function. This allows us to tidy up the code structure a bit. (From OE-Core rev: 5c7f5031023fb74b5f2f26d6b3c829981f2f54d2) Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--scripts/lib/devtool/standard.py37
1 files changed, 5 insertions, 32 deletions
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 7e342e7687..0104e675db 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -383,7 +383,7 @@ def extract(args, config, basepath, workspace):
383 """Entry point for the devtool 'extract' subcommand""" 383 """Entry point for the devtool 'extract' subcommand"""
384 import bb 384 import bb
385 385
386 tinfoil = _prep_extract_operation(config, basepath, args.recipename) 386 tinfoil = setup_tinfoil(basepath=basepath)
387 if not tinfoil: 387 if not tinfoil:
388 # Error already shown 388 # Error already shown
389 return 1 389 return 1
@@ -407,7 +407,7 @@ def sync(args, config, basepath, workspace):
407 """Entry point for the devtool 'sync' subcommand""" 407 """Entry point for the devtool 'sync' subcommand"""
408 import bb 408 import bb
409 409
410 tinfoil = _prep_extract_operation(config, basepath, args.recipename) 410 tinfoil = setup_tinfoil(basepath=basepath)
411 if not tinfoil: 411 if not tinfoil:
412 # Error already shown 412 # Error already shown
413 return 1 413 return 1
@@ -428,29 +428,6 @@ def sync(args, config, basepath, workspace):
428 tinfoil.shutdown() 428 tinfoil.shutdown()
429 429
430 430
431def _prep_extract_operation(config, basepath, recipename, tinfoil=None):
432 """HACK: Ugly workaround for making sure that requirements are met when
433 trying to extract a package. Returns the tinfoil instance to be used."""
434 if not tinfoil:
435 tinfoil = setup_tinfoil(basepath=basepath)
436
437 rd = parse_recipe(config, tinfoil, recipename, True)
438 if not rd:
439 tinfoil.shutdown()
440 return None
441
442 if bb.data.inherits_class('kernel-yocto', rd):
443 tinfoil.shutdown()
444 try:
445 stdout, _ = exec_build_env_command(config.init_path, basepath,
446 'bitbake kern-tools-native')
447 tinfoil = setup_tinfoil(basepath=basepath)
448 except bb.process.ExecutionError as err:
449 raise DevtoolError("Failed to build kern-tools-native:\n%s" %
450 err.stdout)
451 return tinfoil
452
453
454def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil): 431def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
455 """Extract sources of a recipe""" 432 """Extract sources of a recipe"""
456 import oe.recipeutils 433 import oe.recipeutils
@@ -475,6 +452,9 @@ def _extract_source(srctree, keep_temp, devbranch, sync, d, tinfoil):
475 raise DevtoolError("The %s recipe has do_unpack disabled, unable to " 452 raise DevtoolError("The %s recipe has do_unpack disabled, unable to "
476 "extract source" % pn, 4) 453 "extract source" % pn, 4)
477 454
455 if bb.data.inherits_class('kernel-yocto', d):
456 tinfoil.build_targets('kern-tools-native')
457
478 if not sync: 458 if not sync:
479 # Prepare for shutil.move later on 459 # Prepare for shutil.move later on
480 bb.utils.mkdirhier(srctree) 460 bb.utils.mkdirhier(srctree)
@@ -773,13 +753,6 @@ def modify(args, config, basepath, workspace):
773 raise DevtoolError("--no-extract specified and source path %s does " 753 raise DevtoolError("--no-extract specified and source path %s does "
774 "not exist or is not a directory" % 754 "not exist or is not a directory" %
775 srctree) 755 srctree)
776 if not args.no_extract:
777 tinfoil = _prep_extract_operation(config, basepath, pn, tinfoil)
778 if not tinfoil:
779 # Error already shown
780 return 1
781 # We need to re-parse because tinfoil may have been re-initialised
782 rd = parse_recipe(config, tinfoil, args.recipename, True)
783 756
784 recipefile = rd.getVar('FILE') 757 recipefile = rd.getVar('FILE')
785 appendfile = recipe_to_append(recipefile, config, args.wildcard) 758 appendfile = recipe_to_append(recipefile, config, args.wildcard)