Use MiscFunctionsProcess to eliminate the _spawn_misc_sh() function.
authorZac Medico <zmedico@gentoo.org>
Tue, 17 Aug 2010 04:19:26 +0000 (21:19 -0700)
committerZac Medico <zmedico@gentoo.org>
Tue, 17 Aug 2010 04:19:26 +0000 (21:19 -0700)
pym/portage/dbapi/vartree.py
pym/portage/package/ebuild/doebuild.py

index ccb48dc76e2c560ce7d5062c5c69d5e9d60560d5..6ec1d5e09939af6c040297345282d937811962b6 100644 (file)
@@ -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)
index ad51bfa54803e8f6b22a55011cb52fc448901830..003cb4356a9c4af478c2fc63776b50fea744234c 100644 (file)
@@ -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