summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2017-08-09 12:53:06 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2017-09-21 16:48:16 +0100
commita161ea021a1e309c25d1adc09e6e3fc58442c893 (patch)
treeece2f66140f9c0530ce2a16ea45594013c66a4f8
parent4966a56bea7e404c574c197bdaaeb12ead895021 (diff)
downloadbitbake-contrib-a161ea021a1e309c25d1adc09e6e3fc58442c893.tar.gz
cooker: Track directories searched for bbappend/bb files
Some of the directories searched by BBFILES are not currently being added to the inotify watch list. This can mean that added append files are not noticed leading to misleading metadata results when using BB_SERVER_TIMEOUT != 0. We use glob to expand the BBFILES references and without writing our own implentation, figuring out the directories it searches is hard. We use some horrible hacks here to intecept the listdir calls, I'm open to better ways to handle this but this does ensure we have the right watches set. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/cooker.py24
1 files changed, 21 insertions, 3 deletions
diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py
index bc8574aa1..38c22f50e 100644
--- a/lib/bb/cooker.py
+++ b/lib/bb/cooker.py
@@ -1321,7 +1321,7 @@ class BBCooker:
bf = os.path.abspath(bf)
self.collection = CookerCollectFiles(self.bbfile_config_priorities)
- filelist, masked = self.collection.collect_bbfiles(self.data, self.data)
+ filelist, masked, searchdirs = self.collection.collect_bbfiles(self.data, self.data)
try:
os.stat(bf)
bf = os.path.abspath(bf)
@@ -1641,7 +1641,11 @@ class BBCooker:
self.recipecaches[mc].ignored_dependencies.add(dep)
self.collection = CookerCollectFiles(self.bbfile_config_priorities)
- (filelist, masked) = self.collection.collect_bbfiles(self.data, self.data)
+ (filelist, masked, searchdirs) = self.collection.collect_bbfiles(self.data, self.data)
+
+ # Add inotify watches for directories searched for bb/bbappend files
+ for dirent in searchdirs:
+ self.add_filewatch([[dirent]])
self.parser = CookerParser(self, filelist, masked)
self.parsecache_valid = True
@@ -1876,6 +1880,18 @@ class CookerCollectFiles(object):
collectlog.error("no recipe files to build, check your BBPATH and BBFILES?")
bb.event.fire(CookerExit(), eventdata)
+ # We need to track where we look so that we can add inotify watches. There
+ # is no nice way to do this, this is horrid. We intercept the os.listdir()
+ # calls while we run glob().
+ origlistdir = os.listdir
+ searchdirs = []
+
+ def ourlistdir(d):
+ searchdirs.append(d)
+ return origlistdir(d)
+
+ os.listdir = ourlistdir
+
# Can't use set here as order is important
newfiles = []
for f in files:
@@ -1893,6 +1909,8 @@ class CookerCollectFiles(object):
if g not in newfiles:
newfiles.append(g)
+ os.listdir = origlistdir
+
bbmask = config.getVar('BBMASK')
if bbmask:
@@ -1951,7 +1969,7 @@ class CookerCollectFiles(object):
topfile = bbfile_seen[base]
self.overlayed[topfile].append(f)
- return (bbfiles, masked)
+ return (bbfiles, masked, searchdirs)
def get_file_appends(self, fn):
"""