All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paul Eggleton <paul.eggleton@linux.intel.com>
To: bitbake-devel@lists.openembedded.org
Subject: [PATCH] bitbake-layers: avoid loading configuration when not needed
Date: Thu, 21 Nov 2013 14:09:46 +0000	[thread overview]
Message-ID: <1385042986-11444-1-git-send-email-paul.eggleton@linux.intel.com> (raw)

In recent versions of bitbake, it is not possible to initialise a
BBCooker object without having it load the configuration first. Thus we
should avoid creating the Tinfoil object here in bitbake-layers which
does that internally until we actually need to, so you can run
"bitbake-layers help" and not have to wait several seconds for the
output.

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
---
 bin/bitbake-layers | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/bin/bitbake-layers b/bin/bitbake-layers
index 047583c..2a7f829 100755
--- a/bin/bitbake-layers
+++ b/bin/bitbake-layers
@@ -55,10 +55,16 @@ def main(args):
 
 class Commands(cmd.Cmd):
     def __init__(self):
-        cmd.Cmd.__init__(self)
-        self.bbhandler = bb.tinfoil.Tinfoil()
+        self.bbhandler = None
         self.returncode = 0
-        self.bblayers = (self.bbhandler.config_data.getVar('BBLAYERS', True) or "").split()
+        self.bblayers = []
+        cmd.Cmd.__init__(self)
+
+    def init_bbhandler(self, config_only = False):
+        if not self.bbhandler:
+            self.bbhandler = bb.tinfoil.Tinfoil()
+            self.bblayers = (self.bbhandler.config_data.getVar('BBLAYERS', True) or "").split()
+            self.bbhandler.prepare(config_only)
 
     def default(self, line):
         """Handle unrecognised commands"""
@@ -83,7 +89,7 @@ class Commands(cmd.Cmd):
 
     def do_show_layers(self, args):
         """show current configured layers"""
-        self.bbhandler.prepare(config_only = True)
+        self.init_bbhandler(config_only = True)
         logger.plain("%s  %s  %s" % ("layer".ljust(20), "path".ljust(40), "priority"))
         logger.plain('=' * 74)
         for layerdir in self.bblayers:
@@ -120,7 +126,7 @@ Options:
        recipes with the ones they overlay indented underneath
   -s   only list overlayed recipes where the version is the same
 """
-        self.bbhandler.prepare()
+        self.init_bbhandler()
 
         show_filenames = False
         show_same_ver_only = False
@@ -203,7 +209,7 @@ Options:
   -m   only list where multiple recipes (in the same layer or different
        layers) exist for the same recipe name
 """
-        self.bbhandler.prepare()
+        self.init_bbhandler()
 
         show_filenames = False
         show_multi_provider_only = False
@@ -341,7 +347,7 @@ build results (as the layer priority order has effectively changed).
             logger.error('Directory %s exists and is non-empty, please clear it out first' % outputdir)
             return
 
-        self.bbhandler.prepare()
+        self.init_bbhandler()
         layers = self.bblayers
         if len(arglist) > 2:
             layernames = arglist[:-1]
@@ -497,7 +503,7 @@ usage: show-appends
 
 Recipes are listed with the bbappends that apply to them as subitems.
 """
-        self.bbhandler.prepare()
+        self.init_bbhandler()
         if not self.bbhandler.cooker.collection.appendlist:
             logger.plain('No append files found')
             return
@@ -570,7 +576,7 @@ Options:
 NOTE:
 The .bbappend file can impact the dependency.
 """
-        self.bbhandler.prepare()
+        self.init_bbhandler()
 
         show_filenames = False
         for arg in args.split():
-- 
1.8.1.2



                 reply	other threads:[~2013-11-21 14:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=1385042986-11444-1-git-send-email-paul.eggleton@linux.intel.com \
    --to=paul.eggleton@linux.intel.com \
    --cc=bitbake-devel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.