From 5f98684282db080a37f42db24ebc36e5743ad91c Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Sat, 28 May 2011 02:26:13 -0700 Subject: [PATCH] more EMERGE_FROM fixes for bug #368865 Use ebuild_phase_with_hooks for all phases, so EMERGE_FROM is set for all user bashrc pre/post phase hooks. Also, set EMERGE_FROM when sourcing user bashrcs inside source_all_bashrcs. --- bin/ebuild.sh | 40 ++++++++++------------------------------ 1 files changed, 10 insertions(+), 30 deletions(-) diff --git a/bin/ebuild.sh b/bin/ebuild.sh index 273d2b2..91547fa 100755 --- a/bin/ebuild.sh +++ b/bin/ebuild.sh @@ -708,11 +708,9 @@ dyn_pretend() { vecho ">>> Remove '$PORTAGE_BUILDDIR/.pretended' to force pretend." return 0 fi - ebuild_phase pre_pkg_pretend - ebuild_phase pkg_pretend + ebuild_phase_with_hooks pkg_pretend >> "$PORTAGE_BUILDDIR/.pretended" || \ die "Failed to create $PORTAGE_BUILDDIR/.pretended" - ebuild_phase post_pkg_pretend } dyn_setup() { @@ -721,11 +719,9 @@ dyn_setup() { vecho ">>> Remove '$PORTAGE_BUILDDIR/.setuped' to force setup." return 0 fi - ebuild_phase pre_pkg_setup - ebuild_phase pkg_setup + ebuild_phase_with_hooks pkg_setup >> "$PORTAGE_BUILDDIR/.setuped" || \ die "Failed to create $PORTAGE_BUILDDIR/.setuped" - ebuild_phase post_pkg_setup } dyn_unpack() { @@ -768,13 +764,11 @@ dyn_unpack() { install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'" fi cd "${WORKDIR}" || die "Directory change failed: \`cd '${WORKDIR}'\`" - ebuild_phase pre_src_unpack vecho ">>> Unpacking source..." - ebuild_phase src_unpack + ebuild_phase_with_hooks src_unpack >> "$PORTAGE_BUILDDIR/.unpacked" || \ die "Failed to create $PORTAGE_BUILDDIR/.unpacked" vecho ">>> Source unpacked in ${WORKDIR}" - ebuild_phase post_src_unpack } dyn_clean() { @@ -1014,13 +1008,11 @@ dyn_prepare() { trap abort_prepare SIGINT SIGQUIT - ebuild_phase pre_src_prepare vecho ">>> Preparing source in $PWD ..." - ebuild_phase src_prepare + ebuild_phase_with_hooks src_prepare >> "$PORTAGE_BUILDDIR/.prepared" || \ die "Failed to create $PORTAGE_BUILDDIR/.prepared" vecho ">>> Source prepared." - ebuild_phase post_src_prepare trap - SIGINT SIGQUIT } @@ -1045,16 +1037,12 @@ dyn_configure() { trap abort_configure SIGINT SIGQUIT - ebuild_phase pre_src_configure - vecho ">>> Configuring source in $PWD ..." - ebuild_phase src_configure + ebuild_phase_with_hooks src_configure >> "$PORTAGE_BUILDDIR/.configured" || \ die "Failed to create $PORTAGE_BUILDDIR/.configured" vecho ">>> Source configured." - ebuild_phase post_src_configure - trap - SIGINT SIGQUIT } @@ -1085,16 +1073,12 @@ dyn_compile() { fi fi - ebuild_phase pre_src_compile - vecho ">>> Compiling source in $PWD ..." - ebuild_phase src_compile + ebuild_phase_with_hooks src_compile >> "$PORTAGE_BUILDDIR/.compiled" || \ die "Failed to create $PORTAGE_BUILDDIR/.compiled" vecho ">>> Source compiled." - ebuild_phase post_src_compile - trap - SIGINT SIGQUIT } @@ -1127,11 +1111,9 @@ dyn_test() { else local save_sp=${SANDBOX_PREDICT} addpredict / - ebuild_phase pre_src_test - ebuild_phase src_test + ebuild_phase_with_hooks src_test >> "$PORTAGE_BUILDDIR/.tested" || \ die "Failed to create $PORTAGE_BUILDDIR/.tested" - ebuild_phase post_src_test SANDBOX_PREDICT=${save_sp} fi @@ -1148,7 +1130,6 @@ dyn_install() { return 0 fi trap "abort_install" SIGINT SIGQUIT - ebuild_phase pre_src_install rm -rf "${PORTAGE_BUILDDIR}/image" mkdir "${PORTAGE_BUILDDIR}/image" if [[ -d $S ]] ; then @@ -1175,12 +1156,11 @@ dyn_install() { export _E_EXEDESTTREE_="" export _E_DOCDESTTREE_="" - ebuild_phase src_install + ebuild_phase_with_hooks src_install >> "$PORTAGE_BUILDDIR/.installed" || \ die "Failed to create $PORTAGE_BUILDDIR/.installed" vecho ">>> Completed installing ${PF} into ${D}" vecho - ebuild_phase post_src_install cd "${PORTAGE_BUILDDIR}"/build-info set -f @@ -1727,10 +1707,10 @@ source_all_bashrcs() { # If $- contains x, then tracing has already enabled elsewhere for some # reason. We preserve it's state so as not to interfere. if [ "$PORTAGE_DEBUG" != "1" ] || [ "${-/x/}" != "$-" ]; then - source "${x}" + EMERGE_FROM="${PORTAGE_EMERGE_FROM}" source "${x}" else set -x - source "${x}" + EMERGE_FROM="${PORTAGE_EMERGE_FROM}" source "${x}" set +x fi fi -- 1.7.5.rc3