Always restore initial directory after sub-phase run. Fixes bug #532168 and possibly...
authorMichał Górny <mgorny@gentoo.org>
Thu, 11 Dec 2014 18:32:30 +0000 (18:32 +0000)
committerMichał Górny <mgorny@gentoo.org>
Thu, 11 Dec 2014 18:32:30 +0000 (18:32 +0000)
eclass/ChangeLog
eclass/distutils-r1.eclass

index ff19c3bf969fad555a64170ec1a6e4a6a9879dc8..5ee9589881e1564e97a573db82e732934b1d4b6d 100644 (file)
@@ -1,6 +1,10 @@
 # ChangeLog for eclass directory
 # Copyright 1999-2014 Gentoo Foundation; Distributed under the GPL v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1457 2014/12/11 09:07:04 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.1458 2014/12/11 18:32:30 mgorny Exp $
+
+  11 Dec 2014; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass:
+  Always restore initial directory after sub-phase run. Fixes bug #532168 and
+  possibly more.
 
   11 Dec 2014; Michał Górny <mgorny@gentoo.org> distutils-r1.eclass:
   Restore using separate HOMEs for Python implementations, because of
index 737468e79009df8c32bb15afca0690c130eb808e..6efa82874e388bf20e996eb28eac780d295524ad 100644 (file)
@@ -1,6 +1,6 @@
 # Copyright 1999-2014 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.105 2014/12/11 09:07:04 mgorny Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/distutils-r1.eclass,v 1.106 2014/12/11 18:32:30 mgorny Exp $
 
 # @ECLASS: distutils-r1
 # @MAINTAINER:
@@ -587,7 +587,7 @@ distutils-r1_run_phase() {
 
        if [[ ${DISTUTILS_IN_SOURCE_BUILD} ]]; then
                if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
-                       pushd "${BUILD_DIR}" >/dev/null || die
+                       cd "${BUILD_DIR}" || die
                fi
                local BUILD_DIR=${BUILD_DIR}/build
        fi
@@ -617,10 +617,7 @@ distutils-r1_run_phase() {
 
        "${@}"
 
-       if [[ ${DISTUTILS_IN_SOURCE_BUILD} && ! ${DISTUTILS_SINGLE_IMPL} ]]
-       then
-               popd >/dev/null || die
-       fi
+       cd "${_DISTUTILS_INITIAL_CWD}" || die
 }
 
 # @FUNCTION: _distutils-r1_run_common_phase
@@ -635,6 +632,7 @@ _distutils-r1_run_common_phase() {
        local DISTUTILS_ORIG_BUILD_DIR=${BUILD_DIR}
 
        if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then
+               local _DISTUTILS_INITIAL_CWD=${PWD}
                local MULTIBUILD_VARIANTS
                _python_obtain_impls
 
@@ -654,6 +652,8 @@ _distutils-r1_run_common_phase() {
 _distutils-r1_run_foreach_impl() {
        debug-print-function ${FUNCNAME} "${@}"
 
+       # store for restoring after distutils-r1_run_phase.
+       local _DISTUTILS_INITIAL_CWD=${PWD}
        set -- distutils-r1_run_phase "${@}"
 
        if [[ ! ${DISTUTILS_SINGLE_IMPL} ]]; then