[oe-commits] [bitbake] 02/10: cooker: fix watching empty directories

git at git.openembedded.org git at git.openembedded.org
Thu Sep 21 15:56:32 UTC 2017


This is an automated email from the git hooks/post-receive script.

rpurdie pushed a commit to branch 1.34
in repository bitbake.

commit b0b36ff889715227e394c59a36326c31ea21b96b
Author: Paul Eggleton <paul.eggleton at linux.intel.com>
AuthorDate: Thu Sep 14 16:09:41 2017 +1200

    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).
    
    Signed-off-by: Paul Eggleton <paul.eggleton at linux.intel.com>
    Signed-off-by: Richard Purdie <richard.purdie at linuxfoundation.org>
---
 lib/bb/cooker.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index 38c22f5..bdd9112 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -271,12 +271,15 @@ class BBCooker:
             self.inotify_modified_files.append(event.pathname)
         self.parsecache_valid = False
 
-    def add_filewatch(self, deps, watcher=None):
+    def add_filewatch(self, deps, watcher=None, dirs=False):
         if not watcher:
             watcher = self.watcher
         for i in deps:
             watcher.bbwatchedfiles.append(i[0])
-            f = os.path.dirname(i[0])
+            if dirs:
+                f = i[0]
+            else:
+                f = os.path.dirname(i[0])
             if f in watcher.bbseen:
                 continue
             watcher.bbseen.append(f)
@@ -1645,7 +1648,7 @@ class BBCooker:
 
             # Add inotify watches for directories searched for bb/bbappend files
             for dirent in searchdirs:
-                self.add_filewatch([[dirent]])
+                self.add_filewatch([[dirent]], dirs=True)
 
             self.parser = CookerParser(self, filelist, masked)
             self.parsecache_valid = True

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Openembedded-commits mailing list