diff options
author | Joshua Lock <josh@linux.intel.com> | 2011-01-04 20:28:20 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2011-02-24 15:54:51 +0000 |
commit | 3939a216a53f58831e640e85ed95f7edff3ca76f (patch) | |
tree | 897568c0cd94bc1c624a5480644387eab0213b18 /bitbake/lib/bb | |
parent | 1b3eb0c35f504e8f652303a4b238034ecc5c5d02 (diff) | |
download | ast2050-yocto-poky-3939a216a53f58831e640e85ed95f7edff3ca76f.zip ast2050-yocto-poky-3939a216a53f58831e640e85ed95f7edff3ca76f.tar.gz |
bitbake: implement command to find configuration files for a config variable
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.
Signed-off-by: Joshua Lock <josh@linux.intel.com>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r-- | bitbake/lib/bb/command.py | 11 | ||||
-rw-r--r-- | bitbake/lib/bb/cooker.py | 24 | ||||
-rw-r--r-- | bitbake/lib/bb/event.py | 10 |
3 files changed, 45 insertions, 0 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py index 42b5b06..e83751a 100644 --- a/bitbake/lib/bb/command.py +++ b/bitbake/lib/bb/command.py @@ -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 diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index e30fde0..23388d8 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py @@ -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: diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py index 064848b..504a310 100644 --- a/bitbake/lib/bb/event.py +++ b/bitbake/lib/bb/event.py @@ -359,6 +359,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""" |