summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoshua Lock <josh@linux.intel.com>2011-01-04 20:28:20 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2011-02-24 15:54:51 +0000
commit3939a216a53f58831e640e85ed95f7edff3ca76f (patch)
tree897568c0cd94bc1c624a5480644387eab0213b18
parent1b3eb0c35f504e8f652303a4b238034ecc5c5d02 (diff)
downloadpoky-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>
-rw-r--r--bitbake/lib/bb/command.py11
-rw-r--r--bitbake/lib/bb/cooker.py24
-rw-r--r--bitbake/lib/bb/event.py10
3 files changed, 45 insertions, 0 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index 42b5b06712..e83751a2fa 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -232,6 +232,17 @@ class CommandsAsync:
232 command.finishAsyncCommand() 232 command.finishAsyncCommand()
233 generateTargetsTree.needcache = True 233 generateTargetsTree.needcache = True
234 234
235 def findConfigFiles(self, command, params):
236 """
237 Find config files which provide appropriate values
238 for the passed configuration variable. i.e. MACHINE
239 """
240 varname = params[0]
241
242 command.cooker.findConfigFiles(varname)
243 command.finishAsyncCommand()
244 findConfigFiles.needcache = True
245
235 def showVersions(self, command, params): 246 def showVersions(self, command, params):
236 """ 247 """
237 Show the currently selected versions 248 Show the currently selected versions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py
index e30fde0743..23388d8c97 100644
--- a/bitbake/lib/bb/cooker.py
+++ b/bitbake/lib/bb/cooker.py
@@ -430,8 +430,32 @@ class BBCooker:
430 if not regex in matched: 430 if not regex in matched:
431 collectlog.warn("No bb files matched BBFILE_PATTERN_%s '%s'" % (collection, pattern)) 431 collectlog.warn("No bb files matched BBFILE_PATTERN_%s '%s'" % (collection, pattern))
432 432
433 def findConfigFiles(self, varname):
434 """
435 Find config files which are appropriate values for varname.
436 i.e. MACHINE, DISTRO
437 """
438 possible = []
439 var = varname.lower()
440
441 data = self.configuration.data
442 # iterate configs
443 bbpaths = bb.data.getVar('BBPATH', data, True).split(':')
444 for path in bbpaths:
445 confpath = os.path.join(path, "conf", var)
446 if os.path.exists(confpath):
447 for root, dirs, files in os.walk(confpath):
448 # get all child files, these are appropriate values
449 for f in files:
450 val, sep, end = f.rpartition('.')
451 if end == 'conf':
452 possible.append(val)
453
454 bb.event.fire(bb.event.ConfigFilesFound(var, possible), self.configuration.data)
455
433 def checkInheritsClass(self, klass): 456 def checkInheritsClass(self, klass):
434 pkg_list = [] 457 pkg_list = []
458
435 for pfn in self.status.pkg_fn: 459 for pfn in self.status.pkg_fn:
436 inherits = self.status.inherits.get(pfn, None) 460 inherits = self.status.inherits.get(pfn, None)
437 if inherits and inherits.count(klass) > 0: 461 if inherits and inherits.count(klass) > 0:
diff --git a/bitbake/lib/bb/event.py b/bitbake/lib/bb/event.py
index 064848baef..504a310663 100644
--- a/bitbake/lib/bb/event.py
+++ b/bitbake/lib/bb/event.py
@@ -359,6 +359,16 @@ class TargetsTreeGenerated(Event):
359 Event.__init__(self) 359 Event.__init__(self)
360 self._model = model 360 self._model = model
361 361
362class ConfigFilesFound(Event):
363 """
364 Event when a list of appropriate config files has been generated
365 """
366
367 def __init__(self, variable, values):
368 Event.__init__(self)
369 self._variable = variable
370 self._values = values
371
362class MsgBase(Event): 372class MsgBase(Event):
363 """Base class for messages""" 373 """Base class for messages"""
364 374