summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorZac Medico <zmedico@gentoo.org>2010-08-16 21:19:26 -0700
committerZac Medico <zmedico@gentoo.org>2010-08-16 21:19:26 -0700
commit15c8a621ad1211912b00a604c862e15c320f560c (patch)
treef62c94e52e5217bf3cb14427da21926af39d206e
parent2f508a0f40252ad00b8055d27818647d0d0f5970 (diff)
downloadportage-15c8a621ad1211912b00a604c862e15c320f560c.tar.gz
portage-15c8a621ad1211912b00a604c862e15c320f560c.tar.bz2
portage-15c8a621ad1211912b00a604c862e15c320f560c.zip
Use MiscFunctionsProcess to eliminate the _spawn_misc_sh() function.
-rw-r--r--pym/portage/dbapi/vartree.py15
-rw-r--r--pym/portage/package/ebuild/doebuild.py27
2 files changed, 11 insertions, 31 deletions
diff --git a/pym/portage/dbapi/vartree.py b/pym/portage/dbapi/vartree.py
index ccb48dc76..6ec1d5e09 100644
--- a/pym/portage/dbapi/vartree.py
+++ b/pym/portage/dbapi/vartree.py
@@ -15,8 +15,7 @@ portage.proxy.lazyimport.lazyimport(globals(),
'portage.elog:elog_process',
'portage.locks:lockdir,unlockdir',
'portage.output:bold,colorize',
- 'portage.package.ebuild.doebuild:doebuild,doebuild_environment,' + \
- '_spawn_misc_sh',
+ 'portage.package.ebuild.doebuild:doebuild,doebuild_environment',
'portage.package.ebuild.prepare_build_dirs:prepare_build_dirs',
'portage.update:fixdbentries',
'portage.util:apply_secpass_permissions,ConfigProtect,ensure_dirs,' + \
@@ -49,6 +48,8 @@ from portage import _unicode_decode
from portage import _unicode_encode
from portage.cache.mappings import slot_dict_class
+from _emerge.TaskScheduler import TaskScheduler
+from _emerge.MiscFunctionsProcess import MiscFunctionsProcess
import codecs
import gc
@@ -4449,8 +4450,14 @@ class dblink(object):
phase = 'die_hooks'
if self._scheduler is None:
- _spawn_misc_sh(self.settings, [phase],
- phase=phase)
+ task_scheduler = TaskScheduler()
+ ebuild_phase = MiscFunctionsProcess(
+ background=False,
+ commands=[phase],
+ scheduler=task_scheduler.sched_iface,
+ settings=self.settings)
+ task_scheduler.add(ebuild_phase)
+ task_scheduler.run()
else:
self._scheduler.dblinkEbuildPhase(
self, mydbapi, myebuild, phase)
diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py
index ad51bfa54..003cb4356 100644
--- a/pym/portage/package/ebuild/doebuild.py
+++ b/pym/portage/package/ebuild/doebuild.py
@@ -1573,30 +1573,3 @@ def _post_pkg_postinst_cmd(mysettings):
myargs = [_shell_quote(misc_sh_binary)] + _post_phase_cmds["postinst"]
return myargs
-
-def _spawn_misc_sh(mysettings, commands, phase=None, **kwargs):
- """
- @param mysettings: the ebuild config
- @type mysettings: config
- @param commands: a list of function names to call in misc-functions.sh
- @type commands: list
- @rtype: int
- @returns: the return value from the spawn() call
- """
-
- # Note: PORTAGE_BIN_PATH may differ from the global
- # constant when portage is reinstalling itself.
- portage_bin_path = mysettings["PORTAGE_BIN_PATH"]
- misc_sh_binary = os.path.join(portage_bin_path,
- os.path.basename(MISC_SH_BINARY))
- mycommand = " ".join([_shell_quote(misc_sh_binary)] + commands)
- debug = mysettings.get("PORTAGE_DEBUG") == "1"
- logfile = mysettings.get("PORTAGE_LOG_FILE")
- mysettings.pop("EBUILD_PHASE", None)
- try:
- rval = spawn(mycommand, mysettings, debug=debug,
- logfile=logfile, **kwargs)
- finally:
- pass
-
- return rval