From f75d02eb630c5595127faded4a048268ff59ac17 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Wed, 9 Nov 2011 10:48:36 -0800 Subject: [PATCH] Use local EPREFIX for uniformity. The EPREFIX variable is not readonly in EAPI 0, 1, and 2, so we can declare EPREFIX as a local variable. We must be careful not to let this variable leak into the environment of ebuild/eclass functions that we call, since bash propagates local variables to nested function calls. --- bin/misc-functions.sh | 7 +++---- bin/phase-helpers.sh | 23 +++++++++++------------ 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/bin/misc-functions.sh b/bin/misc-functions.sh index b1f47366d..1c11dc51a 100755 --- a/bin/misc-functions.sh +++ b/bin/misc-functions.sh @@ -1097,13 +1097,12 @@ __END1__ dyn_rpm() { - local eprefix=${EPREFIX} - case "$EAPI" in 0|1|2) eprefix= ;; esac + case "$EAPI" in 0|1|2) local EPREFIX= ;; esac cd "${T}" || die "cd failed" local machine_name=$(uname -m) - local dest_dir=${eprefix}/usr/src/rpm/RPMS/${machine_name} - addwrite ${eprefix}/usr/src/rpm + local dest_dir=${EPREFIX}/usr/src/rpm/RPMS/${machine_name} + addwrite ${EPREFIX}/usr/src/rpm addwrite "${RPMDIR}" dyn_spec rpmbuild -bb --clean --rmsource "${PF}.spec" || die "Failed to integrate rpm spec file" diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh index be8919c9f..04cf35aa4 100644 --- a/bin/phase-helpers.sh +++ b/bin/phase-helpers.sh @@ -374,8 +374,7 @@ unpack() { econf() { local x - local eprefix=${EPREFIX} - case "$EAPI" in 0|1|2) eprefix= ;; esac + case "$EAPI" in 0|1|2) local EPREFIX= ;; esac _hasg() { local x s=$1 @@ -406,12 +405,12 @@ econf() { sed -e "1s:^#![[:space:]]*/bin/sh:#!$CONFIG_SHELL:" -i "$ECONF_SOURCE/configure" || \ die "Substition of shebang in '$ECONF_SOURCE/configure' failed" fi - if [ -e "${eprefix}"/usr/share/gnuconfig/ ]; then + if [ -e "${EPREFIX}"/usr/share/gnuconfig/ ]; then find "${WORKDIR}" -type f '(' \ -name config.guess -o -name config.sub ')' -print0 | \ while read -r -d $'\0' x ; do - vecho " * econf: updating ${x/${WORKDIR}\/} with ${eprefix}/usr/share/gnuconfig/${x##*/}" - cp -f "${eprefix}"/usr/share/gnuconfig/"${x##*/}" "${x}" + vecho " * econf: updating ${x/${WORKDIR}\/} with ${EPREFIX}/usr/share/gnuconfig/${x##*/}" + cp -f "${EPREFIX}"/usr/share/gnuconfig/"${x##*/}" "${x}" done fi @@ -431,7 +430,7 @@ econf() { if [[ -n ${CONF_LIBDIR} ]] && ! _hasgq --libdir=\* "$@" ; then export CONF_PREFIX=$(_hasg --exec-prefix=\* "$@") [[ -z ${CONF_PREFIX} ]] && CONF_PREFIX=$(_hasg --prefix=\* "$@") - : ${CONF_PREFIX:=${eprefix}/usr} + : ${CONF_PREFIX:=${EPREFIX}/usr} CONF_PREFIX=${CONF_PREFIX#*=} [[ ${CONF_PREFIX} != /* ]] && CONF_PREFIX="/${CONF_PREFIX}" [[ ${CONF_LIBDIR} != /* ]] && CONF_LIBDIR="/${CONF_LIBDIR}" @@ -439,15 +438,15 @@ econf() { fi set -- \ - --prefix="${eprefix}"/usr \ + --prefix="${EPREFIX}"/usr \ ${CBUILD:+--build=${CBUILD}} \ --host=${CHOST} \ ${CTARGET:+--target=${CTARGET}} \ - --mandir="${eprefix}"/usr/share/man \ - --infodir="${eprefix}"/usr/share/info \ - --datadir="${eprefix}"/usr/share \ - --sysconfdir="${eprefix}"/etc \ - --localstatedir="${eprefix}"/var/lib \ + --mandir="${EPREFIX}"/usr/share/man \ + --infodir="${EPREFIX}"/usr/share/info \ + --datadir="${EPREFIX}"/usr/share \ + --sysconfdir="${EPREFIX}"/etc \ + --localstatedir="${EPREFIX}"/var/lib \ "$@" \ ${EXTRA_ECONF} vecho "${ECONF_SOURCE}/configure" "$@" -- 2.26.2