summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-09-07 12:51:08 -0700
committerZac Medico <zmedico@gentoo.org>2010-09-07 12:51:08 -0700
commitba32c33455b32fdea5c0355af4caf118a266c9cf (patch)
treeecdd6756895b1f31d344847218c5f44d4d95c254
parentb7be0b42ccfee6c30e7bcd6f4427aeafa67f4791 (diff)
downloadportage-ba32c33455b32fdea5c0355af4caf118a266c9cf.tar.gz
portage-ba32c33455b32fdea5c0355af4caf118a266c9cf.tar.bz2
portage-ba32c33455b32fdea5c0355af4caf118a266c9cf.zip
Move stale elog cleanup code from ebuild.sh to _doebuild_spawn(), so
that elog messages generated by bashrc are preserved when appropriate.
-rwxr-xr-xbin/ebuild.sh21
-rw-r--r--pym/portage/package/ebuild/doebuild.py12
2 files changed, 23 insertions, 10 deletions
diff --git a/bin/ebuild.sh b/bin/ebuild.sh
index e976bd114..d49259bd7 100755
--- a/bin/ebuild.sh
+++ b/bin/ebuild.sh
@@ -687,7 +687,6 @@ ebuild_phase() {
ebuild_phase_with_hooks() {
local x phase_name=${1}
- [ -n "$EBUILD_PHASE" ] && rm -f "$T/logging/$EBUILD_PHASE"
for x in {pre_,,post_}${phase_name} ; do
ebuild_phase ${x}
done
@@ -698,7 +697,15 @@ dyn_pretend() {
}
dyn_setup() {
- ebuild_phase_with_hooks pkg_setup
+ if [[ -e $PORTAGE_BUILDDIR/.setuped ]] ; then
+ vecho ">>> It appears that '$PF' is already setup; skipping."
+ vecho ">>> Remove '$PORTAGE_BUILDDIR/.setuped' to force prepare."
+ return 0
+ fi
+ ebuild_phase pre_pkg_setup
+ ebuild_phase pkg_setup
+ > "$PORTAGE_BUILDDIR"/.setuped
+ ebuild_phase post_pkg_setup
}
dyn_unpack() {
@@ -721,7 +728,7 @@ dyn_unpack() {
fi
if [ "${newstuff}" == "yes" ]; then
# We don't necessarily have privileges to do a full dyn_clean here.
- rm -rf "${PORTAGE_BUILDDIR}"/{.unpacked,.prepared,.configured,.compiled,.tested,.installed,.packaged,build-info}
+ rm -rf "${PORTAGE_BUILDDIR}"/{.setuped,.unpacked,.prepared,.configured,.compiled,.tested,.installed,.packaged,build-info}
if ! hasq keepwork $FEATURES ; then
rm -rf "${WORKDIR}"
fi
@@ -740,7 +747,6 @@ dyn_unpack() {
if [ ! -d "${WORKDIR}" ]; then
install -m${PORTAGE_WORKDIR_MODE:-0700} -d "${WORKDIR}" || die "Failed to create dir '${WORKDIR}'"
fi
- [ -n "$EBUILD_PHASE" ] && rm -f "$T/logging/$EBUILD_PHASE"
cd "${WORKDIR}" || die "Directory change failed: \`cd '${WORKDIR}'\`"
ebuild_phase pre_src_unpack
vecho ">>> Unpacking source..."
@@ -771,7 +777,7 @@ dyn_clean() {
fi
if [[ $EMERGE_FROM = binary ]] || ! hasq keepwork $FEATURES; then
- rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,logid,unpacked,prepared} \
+ rm -f "$PORTAGE_BUILDDIR"/.{ebuild_changed,logid,setuped,unpacked,prepared} \
"$PORTAGE_BUILDDIR"/.{configured,compiled,tested,packaged} \
"$PORTAGE_BUILDDIR"/.die_hooks \
"$PORTAGE_BUILDDIR"/.ipc_{in,out,lock} \
@@ -987,7 +993,6 @@ dyn_prepare() {
trap abort_prepare SIGINT SIGQUIT
- [ -n "$EBUILD_PHASE" ] && rm -f "$T/logging/$EBUILD_PHASE"
ebuild_phase pre_src_prepare
vecho ">>> Preparing source in $PWD ..."
ebuild_phase src_prepare
@@ -1018,7 +1023,6 @@ dyn_configure() {
trap abort_configure SIGINT SIGQUIT
- [ -n "$EBUILD_PHASE" ] && rm -f "$T/logging/$EBUILD_PHASE"
ebuild_phase pre_src_configure
vecho ">>> Configuring source in $PWD ..."
@@ -1051,7 +1055,6 @@ dyn_compile() {
trap abort_compile SIGINT SIGQUIT
- [ -n "$EBUILD_PHASE" ] && rm -f "$T/logging/$EBUILD_PHASE"
ebuild_phase pre_src_compile
vecho ">>> Compiling source in $PWD ..."
@@ -1093,7 +1096,6 @@ dyn_test() {
else
local save_sp=${SANDBOX_PREDICT}
addpredict /
- [ -n "$EBUILD_PHASE" ] && rm -f "$T/logging/$EBUILD_PHASE"
ebuild_phase pre_src_test
ebuild_phase src_test
touch "$PORTAGE_BUILDDIR/.tested" || \
@@ -1115,7 +1117,6 @@ dyn_install() {
return 0
fi
trap "abort_install" SIGINT SIGQUIT
- [ -n "$EBUILD_PHASE" ] && rm -f "$T/logging/$EBUILD_PHASE"
ebuild_phase pre_src_install
rm -rf "${PORTAGE_BUILDDIR}/image"
mkdir "${PORTAGE_BUILDDIR}/image"
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index 696b65eb7..a61a56687 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -92,6 +92,18 @@ def _doebuild_spawn(phase, settings, actionmap=None, **kwargs):
os.path.basename(EBUILD_SH_BINARY))),
ebuild_sh_arg)
+ if phase not in EbuildSpawnProcess._phases_without_builddir:
+ phase_completed_file = os.path.join(settings['PORTAGE_BUILDIR'],
+ phase.rstrip('e') + 'ed')
+ if not os.path.exists(phase_completed_file):
+ # If the phase is really going to run then we want
+ # to eliminate any stale elog messages that may
+ # exist from a previous run.
+ try:
+ os.unlink(os.path.join(settings['T'], 'logging', phase))
+ except OSError:
+ pass
+
settings['EBUILD_PHASE'] = phase
try:
return spawn(cmd, settings, **kwargs)