[bitbake-devel] [PATCH 05/10] command|cooker|event: add findConfigFilePath command

Joshua Lock josh at linux.intel.com
Fri Jul 1 06:02:51 UTC 2011


This takes the name of a .conf file and returns the full path to it

Signed-off-by: Joshua Lock <josh at linux.intel.com>
---
 lib/bb/command.py |   10 ++++++++++
 lib/bb/cooker.py  |    4 ++++
 lib/bb/event.py   |    8 ++++++++
 3 files changed, 22 insertions(+), 0 deletions(-)

diff --git a/lib/bb/command.py b/lib/bb/command.py
index d597d1d..2f37938 100644
--- a/lib/bb/command.py
+++ b/lib/bb/command.py
@@ -251,6 +251,16 @@ class CommandsAsync:
         command.finishAsyncCommand()
     findConfigFiles.needcache = True
 
+    def findConfigFilePath(self, command, params):
+        """
+        Find the path of the requested configuration file
+        """
+        configfile = params[0]
+
+        command.cooker.findConfigFilePath(configfile)
+        command.finishAsyncCommand()
+    findConfigFilePath.needcache = False
+
     def showVersions(self, command, params):
         """
         Show the currently selected versions
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 94acce6..48c9e24 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -513,6 +513,10 @@ class BBCooker:
             if regex in unmatched:
                 collectlog.warn("No bb files matched BBFILE_PATTERN_%s '%s'" % (collection, pattern))
 
+    def findConfigFilePath(self, configfile):
+        path = self._findConfigFile(configfile)
+        bb.event.fire(bb.event.ConfigFilePathFound(path), self.configuration.data)
+
     def findConfigFiles(self, varname):
         """
         Find config files which are appropriate values for varname.
diff --git a/lib/bb/event.py b/lib/bb/event.py
index 7d47edb..7c49d46 100644
--- a/lib/bb/event.py
+++ b/lib/bb/event.py
@@ -399,6 +399,14 @@ class ConfigFilesFound(Event):
         self._variable = variable
         self._values = values
 
+class ConfigFilePathFound(Event):
+    """
+    Event when a path for a config file has been found
+    """
+    def __init__(self, path):
+        Event.__init__(self)
+        self._path = path
+
 class MsgBase(Event):
     """Base class for messages"""
 
-- 
1.7.5.4





More information about the bitbake-devel mailing list