diff options
author | Zac Medico <zmedico@gentoo.org> | 2008-06-29 03:13:17 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2008-06-29 03:13:17 +0000 |
commit | 44e9e854b09020727a0acff739e4230213627086 (patch) | |
tree | fdcc4d11e292f202a84a5ba3690a06e5af873c04 | |
parent | 1555ce76c13915236a45c22c441c6bb06b3b6555 (diff) | |
download | portage-44e9e854b09020727a0acff739e4230213627086.tar.gz portage-44e9e854b09020727a0acff739e4230213627086.tar.bz2 portage-44e9e854b09020727a0acff739e4230213627086.zip |
Instead of calling the ebuild "clean" phase in MergeTask.merge(),
move it inside doebuild() where it can be tied into the actionmap_deps
framework.
svn path=/main/trunk/; revision=10842
-rw-r--r-- | pym/_emerge/__init__.py | 7 | ||||
-rw-r--r-- | pym/portage/__init__.py | 20 |
2 files changed, 18 insertions, 9 deletions
diff --git a/pym/_emerge/__init__.py b/pym/_emerge/__init__.py index 57463bab9..c88d8af8f 100644 --- a/pym/_emerge/__init__.py +++ b/pym/_emerge/__init__.py @@ -6562,16 +6562,13 @@ class MergeTask(object): 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: diff --git a/pym/portage/__init__.py b/pym/portage/__init__.py index 5c90a2ee1..6bdf03a78 100644 --- a/pym/portage/__init__.py +++ b/pym/portage/__init__.py @@ -4817,6 +4817,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, vartree = db[myroot]["vartree"] features = mysettings.features + noauto = "noauto" in features from portage.data import secpass validcommands = ["help","clean","prerm","postrm","cleanrm","preinst","postinst", @@ -4932,6 +4933,20 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, 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) @@ -5144,10 +5159,7 @@ def doebuild(myebuild, mydo, myroot, mysettings, debug=0, listonly=0, # 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": |