Skip to contentSkip to conversation

build: Handle conflict between cwd and cleandirs

PATCH New Richard Purdie 1 participant 1 message Apr 26, 2024

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 build: Handle conflict between cwd and cleandirs

If the cwd of the task is also a cleandirs, you would see warnings from bitbake about being unable to obtain cwd during the task execution. Tweak the code to detect this and avoid the warnings.

---
 lib/bb/build.py | 2 ++
 1 file changed, 2 insertions(+)
lib/bb/build.py +2 -0
index 44d08f5c55..ab8bce3d57 100644
@@ -197,6 +197,8 @@ def exec_func(func, d, dirs = None):
         for cdir in d.expand(cleandirs).split():
             bb.utils.remove(cdir, True)
             bb.utils.mkdirhier(cdir)
+            if cdir == oldcwd:
+                os.chdir(cdir)
 
     if flags and dirs is None:
         dirs = flags.get('dirs')
Signature · 1 line
2.40.1