diff options
author | Paul Eggleton <paul.eggleton@linux.intel.com> | 2017-09-14 16:09:41 +1200 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2017-09-21 16:51:06 +0100 |
commit | 0704bbdaeb404561a8fbdd9c00730f2b016d5511 (patch) | |
tree | ee815021206cda0fe7040d0f19e1f245168b6eda /bitbake/lib | |
parent | 200362645b46541b561627154e8b40680058cffc (diff) | |
download | poky-0704bbdaeb404561a8fbdd9c00730f2b016d5511.tar.gz |
bitbake: cooker: fix watching empty directories
The code that was supposed to watch directories along BBFILES for
creation of new files wasn't working in the case where the directory did
not initially contain any matching files - since in updateCache() we are
passing the directory path to add_filewatch() and the latter function
calls os.path.dirname() on the path on the assumption that it is a file
path, and thus the parent of the directory got watched but not the
directory itself. (If the directory wasn't empty everything worked fine
since add_filewatch() was called elsewhere with the path to one of the
files in that directory, and thus the directory got watched). Add a
parameter to add_filewatch() to tell it we are passing it directory
path(s) rather than file path(s).
(Bitbake rev: b0b36ff889715227e394c59a36326c31ea21b96b)
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib')
-rw-r--r-- | bitbake/lib/bb/cooker.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/bitbake/lib/bb/cooker.py b/bitbake/lib/bb/cooker.py index 38c22f50ed..bdd9112510 100644 --- a/bitbake/lib/bb/cooker.py +++ b/bitbake/lib/bb/cooker.py | |||
@@ -271,12 +271,15 @@ class BBCooker: | |||
271 | self.inotify_modified_files.append(event.pathname) | 271 | self.inotify_modified_files.append(event.pathname) |
272 | self.parsecache_valid = False | 272 | self.parsecache_valid = False |
273 | 273 | ||
274 | def add_filewatch(self, deps, watcher=None): | 274 | def add_filewatch(self, deps, watcher=None, dirs=False): |
275 | if not watcher: | 275 | if not watcher: |
276 | watcher = self.watcher | 276 | watcher = self.watcher |
277 | for i in deps: | 277 | for i in deps: |
278 | watcher.bbwatchedfiles.append(i[0]) | 278 | watcher.bbwatchedfiles.append(i[0]) |
279 | f = os.path.dirname(i[0]) | 279 | if dirs: |
280 | f = i[0] | ||
281 | else: | ||
282 | f = os.path.dirname(i[0]) | ||
280 | if f in watcher.bbseen: | 283 | if f in watcher.bbseen: |
281 | continue | 284 | continue |
282 | watcher.bbseen.append(f) | 285 | watcher.bbseen.append(f) |
@@ -1645,7 +1648,7 @@ class BBCooker: | |||
1645 | 1648 | ||
1646 | # Add inotify watches for directories searched for bb/bbappend files | 1649 | # Add inotify watches for directories searched for bb/bbappend files |
1647 | for dirent in searchdirs: | 1650 | for dirent in searchdirs: |
1648 | self.add_filewatch([[dirent]]) | 1651 | self.add_filewatch([[dirent]], dirs=True) |
1649 | 1652 | ||
1650 | self.parser = CookerParser(self, filelist, masked) | 1653 | self.parser = CookerParser(self, filelist, masked) |
1651 | self.parsecache_valid = True | 1654 | self.parsecache_valid = True |