summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/command.py
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2023-09-16 18:20:03 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2023-09-18 11:35:05 +0100
commit37c31a5adc26fc947a447ca9eae0983a654d1a33 (patch)
tree4d40adb741fd25fb0f60993e303ad5e9e7d5fa1a /bitbake/lib/bb/command.py
parentd1f84db670bd130353ebc5fb8077cf9657fb4e44 (diff)
downloadpoky-37c31a5adc26fc947a447ca9eae0983a654d1a33.tar.gz
bitbake: lib: Drop inotify support and replace with mtime checks
With the flush in serverlog() removed and a memory resident bitbake with a 60s timeout, the following could fail in strange ways: rm bitbake-cookerdaemon.log bitbake-layers add-layer ../meta-virtualization/ bitbake-layers add-layer ../meta-openembedded/meta-oe/ bitbake -m specifically that it might error adding meta-oe with an error related to meta-virt. This clearly shows that whilst bblayers.conf was modified, bitbake was not recognising that. This would fit with the random autobuilder issues seen when the serverlog flush() call was removed. The issue appears to be that you have no way to "sync()" the inotify events with the command stream coming over the socket. There is no way to know if there are changes in the IO queue which bitbake needs to wait for before proceeding with the next command. I did experiment with os.sync() and fsync on the inotify fd, however nothing addressed the issue. Since it is extremely important we have accurate cache data, the only realistic thing to do is to switch to stat() calls and check mtime. For bitbake commands, this is straightforward since we can revalidate the cache upon new connections/commands. For tinfoil this is problematic and we need to introduce and explict command "revalidateCaches" that the code can use to force bitbake to re-check it's cache validity. I've exposed this through tinfoil with a new "modified_files" function. So, this patch: a) drops inotify support within bitbake's cooker/server and switch to using mtime b) requires a new function call in tinfoil when metadata has been modified (Bitbake rev: da3ec3801bdb80180b3f1ac24edb27a698415ff7) Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/command.py')
-rw-r--r--bitbake/lib/bb/command.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/bitbake/lib/bb/command.py b/bitbake/lib/bb/command.py
index b494f84a0a..8663eed933 100644
--- a/bitbake/lib/bb/command.py
+++ b/bitbake/lib/bb/command.py
@@ -85,8 +85,6 @@ class Command:
85 if not hasattr(command_method, 'readonly') or not getattr(command_method, 'readonly'): 85 if not hasattr(command_method, 'readonly') or not getattr(command_method, 'readonly'):
86 return None, "Not able to execute not readonly commands in readonly mode" 86 return None, "Not able to execute not readonly commands in readonly mode"
87 try: 87 try:
88 if command != "ping":
89 self.cooker.process_inotify_updates_apply()
90 if getattr(command_method, 'needconfig', True): 88 if getattr(command_method, 'needconfig', True):
91 self.cooker.updateCacheSync() 89 self.cooker.updateCacheSync()
92 result = command_method(self, commandline) 90 result = command_method(self, commandline)
@@ -110,7 +108,6 @@ class Command:
110 108
111 def runAsyncCommand(self, _, process_server, halt): 109 def runAsyncCommand(self, _, process_server, halt):
112 try: 110 try:
113 self.cooker.process_inotify_updates_apply()
114 if self.cooker.state in (bb.cooker.state.error, bb.cooker.state.shutdown, bb.cooker.state.forceshutdown): 111 if self.cooker.state in (bb.cooker.state.error, bb.cooker.state.shutdown, bb.cooker.state.forceshutdown):
115 # updateCache will trigger a shutdown of the parser 112 # updateCache will trigger a shutdown of the parser
116 # and then raise BBHandledException triggering an exit 113 # and then raise BBHandledException triggering an exit
@@ -310,6 +307,11 @@ class CommandsSync:
310 return ret 307 return ret
311 getLayerPriorities.readonly = True 308 getLayerPriorities.readonly = True
312 309
310 def revalidateCaches(self, command, params):
311 """Called by UI clients when metadata may have changed"""
312 command.cooker.revalidateCaches()
313 parseConfiguration.needconfig = False
314
313 def getRecipes(self, command, params): 315 def getRecipes(self, command, params):
314 try: 316 try:
315 mc = params[0] 317 mc = params[0]