]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
implement command to find configuration files for a config variable
authorJoshua Lock <josh@linux.intel.com>
Tue, 4 Jan 2011 20:28:20 +0000 (20:28 +0000)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Thu, 3 Mar 2011 22:30:21 +0000 (22:30 +0000)
Some configuration variables (MACHINE, MACHINE-SDK and DISTRO) set which
confguration files bitbake should use.
The added command , findConfigFiles, enables a UI to query which files are
suitable values for a specified parameter.

(From Poky rev: 3939a216a53f58831e640e85ed95f7edff3ca76f)

Signed-off-by: Joshua Lock <josh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/command.py
lib/bb/cooker.py
lib/bb/event.py

index d84898a848f0e5f917bb90f3eb0e4f53b491678a..9841e6874e1c07fb5b1cca2789a0ddab7a65fde2 100644 (file)
@@ -232,6 +232,17 @@ class CommandsAsync:
         command.finishAsyncCommand()
     generateTargetsTree.needcache = True
 
+    def findConfigFiles(self, command, params):
+        """
+        Find config files which provide appropriate values
+        for the passed configuration variable. i.e. MACHINE
+        """
+        varname = params[0]
+
+        command.cooker.findConfigFiles(varname)
+        command.finishAsyncCommand()
+    findConfigFiles.needcache = True
+
     def showVersions(self, command, params):
         """
         Show the currently selected versions
index 89a2d604aac64fd5d90aee8c3ac9d3653e9e2d81..46d059db39aaf789501a1881f38dabb848b51f83 100644 (file)
@@ -430,8 +430,32 @@ class BBCooker:
             if not regex in matched:
                 collectlog.warn("No bb files matched BBFILE_PATTERN_%s '%s'" % (collection, pattern))
 
+    def findConfigFiles(self, varname):
+        """
+        Find config files which are appropriate values for varname.
+        i.e. MACHINE, DISTRO
+        """
+        possible = []
+        var = varname.lower()
+
+        data = self.configuration.data
+        # iterate configs
+        bbpaths = bb.data.getVar('BBPATH', data, True).split(':')
+        for path in bbpaths:
+            confpath = os.path.join(path, "conf", var)
+            if os.path.exists(confpath):
+                for root, dirs, files in os.walk(confpath):
+                    # get all child files, these are appropriate values
+                    for f in files:
+                        val, sep, end = f.rpartition('.')
+                        if end == 'conf':
+                            possible.append(val)
+
+        bb.event.fire(bb.event.ConfigFilesFound(var, possible), self.configuration.data)
+
     def checkInheritsClass(self, klass):
         pkg_list = []
+
         for pfn in self.status.pkg_fn:
             inherits = self.status.inherits.get(pfn, None)
             if inherits and inherits.count(klass) > 0:
index 2acf9b119525a43a195feb65b0b12ddfd87c89a9..0612bd67cab98ca8634e87ddee157cf9ec423378 100644 (file)
@@ -360,6 +360,16 @@ class TargetsTreeGenerated(Event):
         Event.__init__(self)
         self._model = model
 
+class ConfigFilesFound(Event):
+    """
+    Event when a list of appropriate config files has been generated
+    """
+
+    def __init__(self, variable, values):
+        Event.__init__(self)
+        self._variable =  variable
+        self._values = values
+
 class MsgBase(Event):
     """Base class for messages"""