diff options
author | Ross Burton <ross.burton@intel.com> | 2015-12-18 12:23:14 +0000 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2016-01-08 13:58:08 +0000 |
commit | bfa7859ffa42927214c429a6e081acc8027227c5 (patch) | |
tree | c8fdc49ef73e3e4f722c342922ab94895d1eabad /bitbake | |
parent | 3d4273716d6b6c2be2b2de774fd86dc6997eb95a (diff) | |
download | poky-bfa7859ffa42927214c429a6e081acc8027227c5.tar.gz |
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>
Diffstat (limited to 'bitbake')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 8592d234a3..81d4dd1886 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -1027,22 +1027,21 @@ class BBCooker: | |||
1027 | 1027 | ||
1028 | def findFilesMatchingInDir(self, filepattern, directory): | 1028 | def findFilesMatchingInDir(self, filepattern, directory): |
1029 | """ | 1029 | """ |
1030 | Searches for files matching the regex 'pattern' which are children of | 1030 | Searches for files containing the substring 'filepattern' which are children of |
1031 | 'directory' in each BBPATH. i.e. to find all rootfs package classes available | 1031 | 'directory' in each BBPATH. i.e. to find all rootfs package classes available |
1032 | to BitBake one could call findFilesMatchingInDir(self, 'rootfs_', 'classes') | 1032 | to BitBake one could call findFilesMatchingInDir(self, 'rootfs_', 'classes') |
1033 | or to find all machine configuration files one could call: | 1033 | or to find all machine configuration files one could call: |
1034 | findFilesMatchingInDir(self, 'conf/machines', 'conf') | 1034 | findFilesMatchingInDir(self, '.conf', 'conf/machine') |
1035 | """ | 1035 | """ |
1036 | 1036 | ||
1037 | matches = [] | 1037 | matches = [] |
1038 | p = re.compile(re.escape(filepattern)) | ||
1039 | bbpaths = self.data.getVar('BBPATH', True).split(':') | 1038 | bbpaths = self.data.getVar('BBPATH', True).split(':') |
1040 | for path in bbpaths: | 1039 | for path in bbpaths: |
1041 | dirpath = os.path.join(path, directory) | 1040 | dirpath = os.path.join(path, directory) |
1042 | if os.path.exists(dirpath): | 1041 | if os.path.exists(dirpath): |
1043 | for root, dirs, files in os.walk(dirpath): | 1042 | for root, dirs, files in os.walk(dirpath): |
1044 | for f in files: | 1043 | for f in files: |
1045 | if p.search(f): | 1044 | if filepattern in f: |
1046 | matches.append(f) | 1045 | matches.append(f) |
1047 | 1046 | ||
1048 | if matches: | 1047 | if matches: |