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
}
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() {
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
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..."
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} \
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
trap abort_configure SIGINT SIGQUIT
- [ -n "$EBUILD_PHASE" ] && rm -f "$T/logging/$EBUILD_PHASE"
ebuild_phase pre_src_configure
vecho ">>> Configuring source in $PWD ..."
trap abort_compile SIGINT SIGQUIT
- [ -n "$EBUILD_PHASE" ] && rm -f "$T/logging/$EBUILD_PHASE"
ebuild_phase pre_src_compile
vecho ">>> Compiling source in $PWD ..."
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" || \
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"
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)