[gnome-continuous-yocto/gnomeostree-3.28-rocko: 2715/8267] bitbake: build.py: fix os.getcwd() exception



commit 8b24b0c3593de2d8ada977cd4a49229771a6c477
Author: Juro Bystricky <juro bystricky intel com>
Date:   Mon Sep 26 13:53:13 2016 -0700

    bitbake: build.py: fix os.getcwd() exception
    
    When trying to obtain the current directory from a directory
    that does not exist anymore, an exception is raised.
    This patch handles such exception.
    
    [YOCTO #10331]
    
    (Bitbake rev: 4bcf77589312d9936340d8c308006c2fc9baf67c)
    
    Signed-off-by: Juro Bystricky <juro bystricky intel com>
    Signed-off-by: Richard Purdie <richard purdie linuxfoundation org>

 bitbake/lib/bb/build.py |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py
index 2ed0441..249f7d6 100644
--- a/bitbake/lib/bb/build.py
+++ b/bitbake/lib/bb/build.py
@@ -261,9 +261,14 @@ def exec_func(func, d, dirs = None, pythonexception=False):
         else:
             exec_func_shell(func, d, runfile, cwd=adir)
 
-    if oldcwd and os.getcwd() != oldcwd:
+    try:
+        curcwd = os.getcwd()
+    except:
+        curcwd = None
+
+    if oldcwd and curcwd != oldcwd:
         try:
-            bb.warn("Task %s changed cwd to %s" % (func, os.getcwd()))
+            bb.warn("Task %s changed cwd to %s" % (func, curcwd))
             os.chdir(oldcwd)
         except:
             pass


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]