]> code.ossystems Code Review - openembedded-core.git/commitdiff
classes/package: save/restore cwd in split_and_strip_files
authorRoss Burton <ross.burton@intel.com>
Mon, 13 Jun 2016 21:09:54 +0000 (22:09 +0100)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Wed, 15 Jun 2016 17:10:36 +0000 (18:10 +0100)
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@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/classes/package.bbclass

index c9e2aa81ca653f9fecde5df3e60f04872478f6b8..d6204cfee5572ca3cc59b5481f6246177c3db2d8 100644 (file)
@@ -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)
-