diff options
-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 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 | ||
362 | class 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 | |||
362 | class MsgBase(Event): | 372 | class MsgBase(Event): |
363 | """Base class for messages""" | 373 | """Base class for messages""" |
364 | 374 | ||