bitbake: cooker: fix findFilesMatchingInDir documentation

The documentation for findFilesMatchingInDir() was inconsistant with the
implementation: the regex was escaped before searching so effectively it's a
pure textual substring, and the machine example was broken.

(Bitbake rev: 6bef981488ec94b46dbe3797acfecf9c4b6ecbbc)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
This commit is contained in:
Ross Burton 2015-12-18 12:23:14 +00:00 committed by Richard Purdie
parent 3d4273716d
commit bfa7859ffa
1 changed files with 3 additions and 4 deletions

View File

@ -1027,22 +1027,21 @@ class BBCooker:
def findFilesMatchingInDir(self, filepattern, directory):
"""
Searches for files matching the regex 'pattern' which are children of
Searches for files containing the substring 'filepattern' which are children of
'directory' in each BBPATH. i.e. to find all rootfs package classes available
to BitBake one could call findFilesMatchingInDir(self, 'rootfs_', 'classes')
or to find all machine configuration files one could call:
findFilesMatchingInDir(self, 'conf/machines', 'conf')
findFilesMatchingInDir(self, '.conf', 'conf/machine')
"""
matches = []
p = re.compile(re.escape(filepattern))
bbpaths = self.data.getVar('BBPATH', True).split(':')
for path in bbpaths:
dirpath = os.path.join(path, directory)
if os.path.exists(dirpath):
for root, dirs, files in os.walk(dirpath):
for f in files:
if p.search(f):
if filepattern in f:
matches.append(f)
if matches: