diff mbox series

build: Handle conflict between cwd and cleandirs

Message ID 20240426113414.952926-1-richard.purdie@linuxfoundation.org
State New
Headers show
Series build: Handle conflict between cwd and cleandirs | expand

Commit Message

Richard Purdie April 26, 2024, 11:34 a.m. UTC
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.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
---
 lib/bb/build.py | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/lib/bb/build.py b/lib/bb/build.py
index 44d08f5c55..ab8bce3d57 100644
--- a/lib/bb/build.py
+++ b/lib/bb/build.py
@@ -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')