From 942ae25279bea1b9768112e33f459a9b191d18bd Mon Sep 17 00:00:00 2001 From: Paul Eggleton Date: Mon, 22 Feb 2016 11:37:28 +1300 Subject: [PATCH] devtool: modify: fix source tree default name when mapping virtuals If you for example ran devtool modify virtual/libusb0 without specifying a source tree path, the default was /sources/virtual/libusb0 which isn't correct - it should be using the mapped name i.e. libusb-compat (in the default OE-Core configuration). Reorder some of the code to ensure that the mapped name is used. (From OE-Core rev: c51736df17da8e6e561dd5b7ce59cb08254da870) Signed-off-by: Paul Eggleton Signed-off-by: Ross Burton Signed-off-by: Richard Purdie --- scripts/lib/devtool/standard.py | 39 +++++++++++++++++---------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index b707e6e9eb..5f83a91929 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py @@ -426,10 +426,12 @@ class PatchTaskExecutor(BbTaskExecutor): bb.process.run('git add .; git commit -a -m "Committing changes from %s\n\n%s"' % (func, GitApplyTree.ignore_commit_prefix + ' - from %s' % func), cwd=srcsubdir) -def _prep_extract_operation(config, basepath, recipename): +def _prep_extract_operation(config, basepath, recipename, tinfoil=None): """HACK: Ugly workaround for making sure that requirements are met when trying to extract a package. Returns the tinfoil instance to be used.""" - tinfoil = setup_tinfoil(basepath=basepath) + if not tinfoil: + tinfoil = setup_tinfoil(basepath=basepath) + rd = parse_recipe(config, tinfoil, recipename, True) if not rd: return None @@ -685,23 +687,7 @@ def modify(args, config, basepath, workspace): raise DevtoolError("recipe %s is already in your workspace" % args.recipename) - if args.srctree: - srctree = os.path.abspath(args.srctree) - else: - srctree = get_default_srctree(config, args.recipename) - - if args.no_extract and not os.path.isdir(srctree): - raise DevtoolError("--no-extract specified and source path %s does " - "not exist or is not a directory" % - srctree) - if not args.no_extract: - tinfoil = _prep_extract_operation(config, basepath, args.recipename) - if not tinfoil: - # Error already shown - return 1 - else: - tinfoil = setup_tinfoil(basepath=basepath) - + tinfoil = setup_tinfoil(basepath=basepath) rd = parse_recipe(config, tinfoil, args.recipename, True) if not rd: return 1 @@ -713,6 +699,21 @@ def modify(args, config, basepath, workspace): raise DevtoolError("recipe %s is already in your workspace" % pn) + if args.srctree: + srctree = os.path.abspath(args.srctree) + else: + srctree = get_default_srctree(config, pn) + + if args.no_extract and not os.path.isdir(srctree): + raise DevtoolError("--no-extract specified and source path %s does " + "not exist or is not a directory" % + srctree) + if not args.no_extract: + tinfoil = _prep_extract_operation(config, basepath, pn, tinfoil) + if not tinfoil: + # Error already shown + return 1 + recipefile = rd.getVar('FILE', True) appendfile = recipe_to_append(recipefile, config, args.wildcard) if os.path.exists(appendfile):