[OE-core] [PATCH 4/4] classes/package: save/restore cwd in split_and_strip_files

Ross Burton ross.burton at intel.com
Tue Jun 14 07:59:39 UTC 2016


This function uses chdir() heavily, so save and restore the cwd so that it
doesn't affect the system state.

Signed-off-by: Ross Burton <ross.burton at intel.com>
---
 meta/classes/package.bbclass | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/meta/classes/package.bbclass b/meta/classes/package.bbclass
index c9e2aa8..d6204cf 100644
--- a/meta/classes/package.bbclass
+++ b/meta/classes/package.bbclass
@@ -841,6 +841,9 @@ python split_and_strip_files () {
     dvar = d.getVar('PKGD', True)
     pn = d.getVar('PN', True)
 
+    oldcwd = os.getcwd()
+    os.chdir(dvar)
+
     # We default to '.debug' style
     if d.getVar('PACKAGE_DEBUG_SPLIT_STYLE', True) == 'debug-file-directory':
         # Single debug-file-directory style debug info
@@ -864,8 +867,6 @@ python split_and_strip_files () {
     sourcefile = d.expand("${WORKDIR}/debugsources.list")
     bb.utils.remove(sourcefile)
 
-    os.chdir(dvar)
-
     # Return type (bits):
     # 0 - not elf
     # 1 - ELF
@@ -1052,6 +1053,7 @@ python split_and_strip_files () {
     #
     # End of strip
     #
+    os.chdir(oldcwd)
 }
 
 python populate_packages () {
@@ -2129,4 +2131,3 @@ def mapping_rename_hook(d):
     runtime_mapping_rename("RDEPENDS", pkg, d)
     runtime_mapping_rename("RRECOMMENDS", pkg, d)
     runtime_mapping_rename("RSUGGESTS", pkg, d)
-
-- 
2.8.0.rc3




More information about the Openembedded-core mailing list