build_dir = EbuildBuildDir(pkg=pkg, settings=pkgsettings)
try:
build_dir.lock()
+ # Cleaning is triggered before the setup
+ # phase, in portage.doebuild().
msg = " === (%s of %s) Cleaning (%s::%s)" % \
(mergecount, len(mymergelist), pkg_key, y)
short_msg = "emerge: (%s of %s) %s Clean" % \
(mergecount, len(mymergelist), pkg_key)
emergelog(xterm_titles, msg, short_msg=short_msg)
- retval = portage.doebuild(y, "clean", myroot,
- pkgsettings, self.edebug, cleanup=1,
- mydbapi=portdb, tree="porttree")
- if retval != os.EX_OK:
- raise self._pkg_failure(retval)
if "--buildpkg" in self.myopts or issyspkg:
if issyspkg:
vartree = db[myroot]["vartree"]
features = mysettings.features
+ noauto = "noauto" in features
from portage.data import secpass
validcommands = ["help","clean","prerm","postrm","cleanrm","preinst","postinst",
doebuild_environment(myebuild, mydo, myroot, mysettings, debug,
use_cache, mydbapi)
+ clean_phases = ("clean", "cleanrm")
+ if mydo in clean_phases or \
+ (not noauto and mydo in actionmap_deps and \
+ mysettings.get("EMERGE_FROM") == "ebuild"):
+ if mydo not in clean_phases:
+ mysettings["EBUILD_PHASE"] = "clean"
+ try:
+ retval = spawn(_shell_quote(ebuild_sh_binary) + " clean",
+ mysettings, debug=debug, free=1, logfile=None)
+ finally:
+ mysettings["EBUILD_PHASE"] = mydo
+ if mydo in clean_phases or retval != os.EX_OK:
+ return retval
+
# get possible slot information from the deps file
if mydo == "depend":
writemsg("!!! DEBUG: dbkey: %s\n" % str(dbkey), 2)
# if any of these are being called, handle them -- running them out of
# the sandbox -- and stop now.
- if mydo in ["clean","cleanrm"]:
- return spawn(_shell_quote(ebuild_sh_binary) + " clean", mysettings,
- debug=debug, free=1, logfile=None)
- elif mydo == "help":
+ if mydo == "help":
return spawn(_shell_quote(ebuild_sh_binary) + " " + mydo,
mysettings, debug=debug, free=1, logfile=logfile)
elif mydo == "setup":