public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: openembedded-core@lists.openembedded.org
Subject: [PATCH 12/14] devtool: refactor code for getting local recipe file
Date: Thu,  7 Jan 2016 00:15:53 +1300	[thread overview]
Message-ID: <fff5573c4feba4a957df536db4a4732445680f0e.1452078721.git.paul.eggleton@linux.intel.com> (raw)
In-Reply-To: <cover.1452078721.git.paul.eggleton@linux.intel.com>
In-Reply-To: <cover.1452078721.git.paul.eggleton@linux.intel.com>

We're doing this in a couple of places, let's just find the recipe file
if it exists within the workspace (which it will if it's been added
through "devtool add") when we read in the workspace.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 scripts/devtool                 | 12 +++++++++++-
 scripts/lib/devtool/standard.py | 19 ++++---------------
 2 files changed, 15 insertions(+), 16 deletions(-)

diff --git a/scripts/devtool b/scripts/devtool
index bda05e1..2d57da0b 100755
--- a/scripts/devtool
+++ b/scripts/devtool
@@ -112,8 +112,18 @@ def read_workspace():
                 res = externalsrc_re.match(line.rstrip())
                 if res:
                     pn = res.group(2) or os.path.splitext(os.path.basename(fn))[0].split('_')[0]
+                    # Find the recipe file within the workspace, if any
+                    bbfile = os.path.basename(fn).replace('.bbappend', '.bb').replace('%', '*')
+                    recipefile = glob.glob(os.path.join(config.workspace_path,
+                                                        'recipes',
+                                                        pn,
+                                                        bbfile))
+                    if recipefile:
+                        recipefile = recipefile[0]
                     workspace[pn] = {'srctree': res.group(3),
-                                     'bbappend': fn}
+                                     'bbappend': fn,
+                                     'recipefile': recipefile}
+                    logger.debug('Found recipe %s' % workspace[pn])
 
 def create_workspace(args, config, basepath, workspace):
     if args.layerpath:
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py
index 7ef0ab8..e26ce5a 100644
--- a/scripts/lib/devtool/standard.py
+++ b/scripts/lib/devtool/standard.py
@@ -1171,13 +1171,9 @@ def status(args, config, basepath, workspace):
     """Entry point for the devtool 'status' subcommand"""
     if workspace:
         for recipe, value in workspace.iteritems():
-            bbfile = os.path.basename(value['bbappend']).replace('.bbappend', '.bb').replace('%', '*')
-            recipefile = glob.glob(os.path.join(config.workspace_path,
-                                                'recipes',
-                                                recipe,
-                                                bbfile))
+            recipefile = value['recipefile']
             if recipefile:
-                recipestr = ' (%s)' % recipefile[0]
+                recipestr = ' (%s)' % recipefile
             else:
                 recipestr = ''
             print("%s: %s%s" % (recipe, value['srctree'], recipestr))
@@ -1261,15 +1257,8 @@ def edit_recipe(args, config, basepath, workspace):
             tinfoil.shutdown()
     else:
         check_workspace_recipe(workspace, args.recipename)
-        bbappend = workspace[args.recipename]['bbappend']
-        bbfile = os.path.basename(bbappend).replace('.bbappend', '.bb').replace('%', '*')
-        recipefile = glob.glob(os.path.join(config.workspace_path,
-                                            'recipes',
-                                            args.recipename,
-                                            bbfile))
-        if recipefile:
-            recipefile = recipefile[0]
-        else:
+        recipefile = workspace[args.recipename]['recipefile']
+        if not recipefile:
             raise DevtoolError("Recipe file for %s is not under the workspace" %
                                args.recipename)
 
-- 
2.5.0



  parent reply	other threads:[~2016-01-06 11:17 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-06 11:15 [PATCH 00/14] Extensible SDK / devtool / recipetool improvements Paul Eggleton
2016-01-06 11:15 ` [PATCH 01/14] scripts/oe-publish-sdk: add missing call to git update-server-info Paul Eggleton
2016-01-06 11:15 ` [PATCH 02/14] classes/populate_sdk_ext: fix cascading from preparation failure Paul Eggleton
2016-01-06 11:15 ` [PATCH 03/14] classes/populate_sdk_ext: disable signature warnings Paul Eggleton
2016-01-06 11:15 ` [PATCH 04/14] devtool: sdk-update: fix not using updateserver config file option Paul Eggleton
2016-01-06 11:15 ` [PATCH 05/14] devtool: sdk-update: fix metadata update step Paul Eggleton
2016-01-06 11:15 ` [PATCH 06/14] devtool: sdk-update: fix error checking Paul Eggleton
2016-01-06 11:15 ` [PATCH 07/14] devtool: sdk-update: add option to skip preparation step Paul Eggleton
2016-01-06 11:15 ` [PATCH 08/14] recipetool: create: lower case name when determining from filename Paul Eggleton
2016-01-06 11:15 ` [PATCH 09/14] recipetool: create: support creating standalone native/nativesdk recipes Paul Eggleton
2016-01-06 11:15 ` [PATCH 10/14] devtool: reset: do clean for multiple recipes at once with -a Paul Eggleton
2016-01-06 11:15 ` [PATCH 11/14] devtool: add: support adding a native variant Paul Eggleton
2016-01-06 11:15 ` Paul Eggleton [this message]
2016-01-06 11:15 ` [PATCH 13/14] devtool: reset: support recipes with BBCLASSEXTEND Paul Eggleton
2016-01-06 11:15 ` [PATCH 14/14] devtool: build: support using BBCLASSEXTENDed names Paul Eggleton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=fff5573c4feba4a957df536db4a4732445680f0e.1452078721.git.paul.eggleton@linux.intel.com \
    --to=paul.eggleton@linux.intel.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox