From 612a8abf9995c593101b8344fda15acd8267c5e3 Mon Sep 17 00:00:00 2001 From: Zac Medico Date: Fri, 13 Aug 2010 12:14:06 -0700 Subject: Bug #315615 - Use EbuildIpcDaemon to implement has_version and best_version. This provides performance benefits and also avoids permissions issues with FEATURES=userpriv. --- pym/_emerge/AbstractEbuildProcess.py | 8 +++++++- pym/_emerge/EbuildIpcDaemon.py | 1 - pym/_emerge/actions.py | 2 ++ 3 files changed, 9 insertions(+), 2 deletions(-) (limited to 'pym/_emerge') diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py index 57f4c8f87..964095b2a 100644 --- a/pym/_emerge/AbstractEbuildProcess.py +++ b/pym/_emerge/AbstractEbuildProcess.py @@ -8,6 +8,7 @@ from _emerge.EbuildIpcDaemon import EbuildIpcDaemon from portage.elog.messages import eerror from portage.localization import _ from portage.package.ebuild._ipc.ExitCommand import ExitCommand +from portage.package.ebuild._ipc.QueryCommand import QueryCommand from portage import os from portage import StringIO from portage import _encodings @@ -44,7 +45,12 @@ class AbstractEbuildProcess(SpawnProcess): self.settings['PORTAGE_BUILDDIR'], '.ipc_in') output_fifo = os.path.join( self.settings['PORTAGE_BUILDDIR'], '.ipc_out') - commands = {'exit' : self._exit_command} + query_command = QueryCommand() + commands = { + 'best_version' : query_command, + 'exit' : self._exit_command, + 'has_version' : query_command, + } self._ipc_daemon = EbuildIpcDaemon(commands=commands, input_fifo=input_fifo, output_fifo=output_fifo, diff --git a/pym/_emerge/EbuildIpcDaemon.py b/pym/_emerge/EbuildIpcDaemon.py index 5f3d2ed01..68c68d28d 100644 --- a/pym/_emerge/EbuildIpcDaemon.py +++ b/pym/_emerge/EbuildIpcDaemon.py @@ -59,7 +59,6 @@ class EbuildIpcDaemon(FifoIpcDaemon): if reply_hook is not None: reply_hook() - self._unregister_if_appropriate(event) return self._registered def _send_reply(self, reply): diff --git a/pym/_emerge/actions.py b/pym/_emerge/actions.py index 7acc9e11d..fb692c363 100644 --- a/pym/_emerge/actions.py +++ b/pym/_emerge/actions.py @@ -33,6 +33,7 @@ from portage.output import blue, bold, colorize, create_color_func, darkgreen, \ red, yellow good = create_color_func("GOOD") bad = create_color_func("BAD") +from portage.package.ebuild._ipc.QueryCommand import QueryCommand from portage.sets import load_default_config, SETPREFIX from portage.sets.base import InternalPackageSet from portage.util import cmp_sort_key, writemsg, \ @@ -2774,6 +2775,7 @@ def load_emerge_config(trees=None): mtimedbfile = os.path.join(os.path.sep, settings['ROOT'], portage.CACHE_PATH, "mtimedb") mtimedb = portage.MtimeDB(mtimedbfile) portage.output._init(config_root=settings['PORTAGE_CONFIGROOT']) + QueryCommand._db = trees return settings, trees, mtimedb def chk_updated_cfg_files(target_root, config_protect): -- cgit v1.2.3-1-g7c22