diff options
Diffstat (limited to 'bitbake/lib/bb/cooker.py')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index e537634df8..9874f664b5 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -520,6 +520,29 @@ class BBCooker: | |||
520 | path = self._findConfigFile(configfile) | 520 | path = self._findConfigFile(configfile) |
521 | bb.event.fire(bb.event.ConfigFilePathFound(path), self.configuration.data) | 521 | bb.event.fire(bb.event.ConfigFilePathFound(path), self.configuration.data) |
522 | 522 | ||
523 | def findFilesMatchingInDir(self, filepattern, directory): | ||
524 | """ | ||
525 | Searches for files matching the regex 'pattern' which are children of | ||
526 | 'directory' in each BBPATH. i.e. to find all rootfs package classes available | ||
527 | to BitBake one could call findFilesMatchingInDir(self, 'rootfs_', 'classes') | ||
528 | or to find all machine configuration files on could call | ||
529 | findFilesMatchingInDir(self, 'conf/machines', 'conf') | ||
530 | """ | ||
531 | import re | ||
532 | |||
533 | matches = [] | ||
534 | p = re.compile(re.escape(filepattern)) | ||
535 | bbpaths = bb.data.getVar('BBPATH', self.configuration.data, True).split(':') | ||
536 | for path in bbpaths: | ||
537 | dirpath = os.path.join(path, directory) | ||
538 | if os.path.exists(dirpath): | ||
539 | for root, dirs, files in os.walk(dirpath): | ||
540 | for f in files: | ||
541 | if p.search(f): | ||
542 | matches.append(f) | ||
543 | |||
544 | bb.event.fire(bb.event.FilesMatchingFound(filepattern, matches), self.configuration.data) | ||
545 | |||
523 | def findConfigFiles(self, varname): | 546 | def findConfigFiles(self, varname): |
524 | """ | 547 | """ |
525 | Find config files which are appropriate values for varname. | 548 | Find config files which are appropriate values for varname. |