commit:     a3687ce0d23feec413a41b7d06b91292224919ac
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sat Sep 25 12:02:55 2021 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Mon Sep 27 16:54:45 2021 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a3687ce0

bzr.eclass: Don't rely on sandbox internals

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 eclass/bzr.eclass | 18 ++++++++----------
 1 file changed, 8 insertions(+), 10 deletions(-)

diff --git a/eclass/bzr.eclass b/eclass/bzr.eclass
index de73aed7f67..5dd5d40c13f 100644
--- a/eclass/bzr.eclass
+++ b/eclass/bzr.eclass
@@ -201,16 +201,16 @@ _bzr_update() {
 # bzr branch or bzr pull, depending on whether there is an existing
 # working copy.
 bzr_fetch() {
-       local repo_dir branch_dir
-       local save_sandbox_write=${SANDBOX_WRITE} save_umask
+       local repo_dir branch_dir save_umask
 
        [[ -n ${EBZR_REPO_URI} ]] || die "${ECLASS}: EBZR_REPO_URI is empty"
 
-       if [[ ! -d ${EBZR_STORE_DIR} ]] ; then
-               addwrite /
-               mkdir -p "${EBZR_STORE_DIR}" \
-                       || die "${ECLASS}: can't mkdir ${EBZR_STORE_DIR}"
-               SANDBOX_WRITE=${save_sandbox_write}
+       if [[ ! -d ${EBZR_STORE_DIR} ]]; then
+               (
+                       addwrite /
+                       mkdir -p "${EBZR_STORE_DIR}" \
+                               || die "${ECLASS}: can't mkdir 
${EBZR_STORE_DIR}"
+               )
        fi
 
        pushd "${EBZR_STORE_DIR}" > /dev/null \
@@ -220,7 +220,7 @@ bzr_fetch() {
        branch_dir=${repo_dir}${EBZR_BRANCH:+/${EBZR_BRANCH}}
 
        if [[ -n ${EVCS_UMASK} ]]; then
-               save_umask=$(umask)
+               save_umask=$(umask) || die
                umask "${EVCS_UMASK}" || die
        fi
        addwrite "${EBZR_STORE_DIR}"
@@ -248,8 +248,6 @@ bzr_fetch() {
                _bzr_update "${EBZR_REPO_URI}" "${branch_dir}"
        fi
 
-       # Restore sandbox environment and umask
-       SANDBOX_WRITE=${save_sandbox_write}
        if [[ -n ${save_umask} ]]; then
                umask "${save_umask}" || die
        fi

Reply via email to