From: Joshua Lock Date: Tue, 4 Jan 2011 20:28:20 +0000 (+0000) Subject: implement command to find configuration files for a config variable X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f9111cc8960b7ecdf7451c275518d4c9cd32750e;p=thirdparty%2Fopenembedded%2Fopenembedded-core-contrib.git 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. (From Poky rev: 3939a216a53f58831e640e85ed95f7edff3ca76f) Signed-off-by: Joshua Lock Signed-off-by: Richard Purdie --- diff --git a/lib/bb/command.py b/lib/bb/command.py index d84898a848f..9841e6874e1 100644 --- a/lib/bb/command.py +++ b/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/lib/bb/cooker.py b/lib/bb/cooker.py index 89a2d604aac..46d059db39a 100644 --- a/lib/bb/cooker.py +++ b/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/lib/bb/event.py b/lib/bb/event.py index 2acf9b11952..0612bd67cab 100644 --- a/lib/bb/event.py +++ b/lib/bb/event.py @@ -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"""