public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/portage:master commit in: pym/portage/util/_async/, pym/_emerge/, pym/portage/_emirrordist/
@ 2018-04-29  4:38 Zac Medico
  0 siblings, 0 replies; only message in thread
From: Zac Medico @ 2018-04-29  4:38 UTC (permalink / raw
  To: gentoo-commits

commit:     f01f504fc8d4ea7442379482889b1cee4be0fcf4
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 29 01:28:42 2018 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Apr 29 04:31:45 2018 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=f01f504f

AsynchronousTask: remove unused _wait() methods (bug 653856)

Remove _wait() and _waitpid_loop() methods which are unused since
AsynchronousTask.wait() now uses run_until_complete(self.async_wait())
instead. Also remove the iteration method from SchedulerInterface,
since there are no more consumers.

Bug: https://bugs.gentoo.org/653856

 pym/_emerge/AbstractEbuildProcess.py            | 27 ------------
 pym/_emerge/AbstractPollTask.py                 |  8 +---
 pym/_emerge/AsynchronousLock.py                 |  9 ----
 pym/_emerge/AsynchronousTask.py                 |  6 ---
 pym/_emerge/CompositeTask.py                    | 48 +--------------------
 pym/_emerge/FifoIpcDaemon.py                    | 13 +-----
 pym/_emerge/PipeReader.py                       |  7 ----
 pym/_emerge/SpawnProcess.py                     | 12 +-----
 pym/_emerge/SubProcess.py                       | 56 +------------------------
 pym/portage/_emirrordist/MirrorDistTask.py      |  7 ----
 pym/portage/util/_async/AsyncScheduler.py       | 25 +----------
 pym/portage/util/_async/AsyncTaskFuture.py      |  8 ----
 pym/portage/util/_async/PipeLogger.py           |  7 ----
 pym/portage/util/_async/PipeReaderBlockingIO.py | 10 -----
 pym/portage/util/_async/SchedulerInterface.py   |  1 -
 15 files changed, 6 insertions(+), 238 deletions(-)

diff --git a/pym/_emerge/AbstractEbuildProcess.py b/pym/_emerge/AbstractEbuildProcess.py
index b10aa4bfa..03c834912 100644
--- a/pym/_emerge/AbstractEbuildProcess.py
+++ b/pym/_emerge/AbstractEbuildProcess.py
@@ -386,33 +386,6 @@ class AbstractEbuildProcess(SpawnProcess):
 					if not self.cancelled:
 						self._unexpected_exit()
 
-	def _wait(self):
-		"""
-		Override _wait to unlock self._build_dir if necessary. Normally, it
-		should already be unlocked, so this functions only as a failsafe.
-		Execution of the failsafe code will automatically become a fatal
-		error at the same time as event loop recursion is disabled.
-		"""
-		# SpawnProcess._wait() requires the pid, so wait here for the
-		# pid to become available.
-		while self._start_future is not None:
-			self.scheduler.run_until_complete(self._start_future)
-
-		SpawnProcess._wait(self)
-
-		if self._build_dir is not None:
-			self._build_dir_unlock = self._build_dir.async_unlock()
-			# Unlock only once.
-			self._build_dir = None
-
-		if not (self._build_dir_unlock is None or
-			self._build_dir_unlock.done()):
-			# This will automatically become a fatal error at the same
-			# time as event loop recursion is disabled.
-			self.scheduler.run_until_complete(self._build_dir_unlock)
-
-		return self.returncode
-
 	def _async_wait(self):
 		"""
 		Override _async_wait to asynchronously unlock self._build_dir

diff --git a/pym/_emerge/AbstractPollTask.py b/pym/_emerge/AbstractPollTask.py
index 0aac97be5..0ce3594b4 100644
--- a/pym/_emerge/AbstractPollTask.py
+++ b/pym/_emerge/AbstractPollTask.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import array
@@ -136,12 +136,6 @@ class AbstractPollTask(AsynchronousTask):
 				self.returncode = self.returncode or os.EX_OK
 				self._async_wait()
 
-	def _wait(self):
-		if self.returncode is not None:
-			return self.returncode
-		self._wait_loop()
-		return self.returncode
-
 	def _wait_loop(self, timeout=None):
 		loop = getattr(self.scheduler, '_asyncio_wrapper', self.scheduler)
 		tasks = [self.async_wait()]

diff --git a/pym/_emerge/AsynchronousLock.py b/pym/_emerge/AsynchronousLock.py
index 2019adaab..c5991bcff 100644
--- a/pym/_emerge/AsynchronousLock.py
+++ b/pym/_emerge/AsynchronousLock.py
@@ -82,15 +82,6 @@ class AsynchronousLock(AsynchronousTask):
 			self._imp.poll()
 		return self.returncode
 
-	def _wait(self):
-		"""
-		Deprecated. Use _async_wait() instead.
-		"""
-		if self.returncode is not None:
-			return self.returncode
-		self.returncode = self._imp.wait()
-		return self.returncode
-
 	def async_unlock(self):
 		"""
 		Release the lock asynchronously. Release notification is available

diff --git a/pym/_emerge/AsynchronousTask.py b/pym/_emerge/AsynchronousTask.py
index 246895d71..cf6e6dc44 100644
--- a/pym/_emerge/AsynchronousTask.py
+++ b/pym/_emerge/AsynchronousTask.py
@@ -84,12 +84,6 @@ class AsynchronousTask(SlotObject):
 		self._wait_hook()
 		return self.returncode
 
-	def _wait(self):
-		"""
-		Deprecated. Use _async_wait() instead.
-		"""
-		return self.returncode
-
 	def _async_wait(self):
 		"""
 		For cases where _start exits synchronously, this method is a

diff --git a/pym/_emerge/CompositeTask.py b/pym/_emerge/CompositeTask.py
index 113e5935f..4662f0cf5 100644
--- a/pym/_emerge/CompositeTask.py
+++ b/pym/_emerge/CompositeTask.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2012 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from _emerge.AsynchronousTask import AsynchronousTask
@@ -47,52 +47,6 @@ class CompositeTask(AsynchronousTask):
 
 		return self.returncode
 
-	def _wait(self):
-
-		prev = None
-		while True:
-			task = self._current_task
-			if task is None:
-				# don't wait for the same task more than once
-				break
-			if task is self._TASK_QUEUED:
-				if self.cancelled:
-					self.returncode = 1
-					self._current_task = None
-					break
-				else:
-					while not self._task_queued_wait():
-						self.scheduler.iteration()
-					if self.returncode is not None:
-						break
-					elif self.cancelled:
-						self.returncode = 1
-						self._current_task = None
-						break
-					else:
-						# try this again with new _current_task value
-						continue
-			if task is prev:
-				if self.returncode is not None:
-					# This is expected if we're being
-					# called from the task's exit listener
-					# after it's been cancelled.
-					break
-				# Before the task.wait() method returned, an exit
-				# listener should have set self._current_task to either
-				# a different task or None. Something is wrong.
-				raise AssertionError("self._current_task has not " + \
-					"changed since calling wait", self, task)
-
-			# This triggers less recursion than calling task.wait().
-			waiter = self.scheduler.create_future()
-			task.addExitListener(waiter.set_result)
-			while not waiter.done():
-				self.scheduler.iteration()
-			prev = task
-
-		return self.returncode
-
 	def _assert_current(self, task):
 		"""
 		Raises an AssertionError if the given task is not the

diff --git a/pym/_emerge/FifoIpcDaemon.py b/pym/_emerge/FifoIpcDaemon.py
index 6efdc11b4..3676e98da 100644
--- a/pym/_emerge/FifoIpcDaemon.py
+++ b/pym/_emerge/FifoIpcDaemon.py
@@ -1,4 +1,4 @@
-# Copyright 2010-2013 Gentoo Foundation
+# Copyright 2010-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import sys
@@ -81,17 +81,6 @@ class FifoIpcDaemon(AbstractPollTask):
 		# notify exit listeners
 		self._async_wait()
 
-	def _wait(self):
-		"""
-		Deprecated. Use _async_wait() instead.
-		"""
-		if self.returncode is not None:
-			return self.returncode
-		self._wait_loop()
-		if self.returncode is None:
-			self.returncode = os.EX_OK
-		return self.returncode
-
 	def _input_handler(self, fd, event):
 		raise NotImplementedError(self)
 

diff --git a/pym/_emerge/PipeReader.py b/pym/_emerge/PipeReader.py
index eabf9f40b..267d0cea1 100644
--- a/pym/_emerge/PipeReader.py
+++ b/pym/_emerge/PipeReader.py
@@ -52,13 +52,6 @@ class PipeReader(AbstractPollTask):
 		if self.returncode is None:
 			self.returncode = self._cancelled_returncode
 
-	def _wait(self):
-		if self.returncode is not None:
-			return self.returncode
-		self._wait_loop()
-		self.returncode = os.EX_OK
-		return self.returncode
-
 	def getvalue(self):
 		"""Retrieve the entire contents"""
 		return b''.join(self._read_data)

diff --git a/pym/_emerge/SpawnProcess.py b/pym/_emerge/SpawnProcess.py
index 7326254ca..78eb5e9c0 100644
--- a/pym/_emerge/SpawnProcess.py
+++ b/pym/_emerge/SpawnProcess.py
@@ -1,4 +1,4 @@
-# Copyright 2008-2013 Gentoo Foundation
+# Copyright 2008-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 try:
@@ -172,16 +172,6 @@ class SpawnProcess(SubProcess):
 		self._pipe_logger = None
 		self._async_waitpid()
 
-	def _waitpid_loop(self):
-		SubProcess._waitpid_loop(self)
-
-		pipe_logger = self._pipe_logger
-		if pipe_logger is not None:
-			self._pipe_logger = None
-			pipe_logger.removeExitListener(self._pipe_logger_exit)
-			pipe_logger.cancel()
-			pipe_logger.wait()
-
 	def _set_returncode(self, wait_retval):
 		SubProcess._set_returncode(self, wait_retval)
 		self._cgroup_cleanup()

diff --git a/pym/_emerge/SubProcess.py b/pym/_emerge/SubProcess.py
index 13cf9d361..3939de3ed 100644
--- a/pym/_emerge/SubProcess.py
+++ b/pym/_emerge/SubProcess.py
@@ -1,4 +1,4 @@
-# Copyright 1999-2013 Gentoo Foundation
+# Copyright 1999-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 import logging
@@ -61,48 +61,6 @@ class SubProcess(AbstractPollTask):
 		return self.pid is not None and \
 			self.returncode is None
 
-	def _wait(self):
-		"""
-		Deprecated. Use _async_wait() instead.
-		"""
-		if self.returncode is not None:
-			return self.returncode
-
-		if self._registered:
-			if self.cancelled:
-				self._wait_loop(timeout=self._cancel_timeout)
-				if self._registered:
-					try:
-						os.kill(self.pid, signal.SIGKILL)
-					except OSError as e:
-						if e.errno == errno.EPERM:
-							# Reported with hardened kernel (bug #358211).
-							writemsg_level(
-								"!!! kill: (%i) - Operation not permitted\n" %
-								(self.pid,), level=logging.ERROR,
-								noiselevel=-1)
-						elif e.errno != errno.ESRCH:
-							raise
-						del e
-					self._wait_loop(timeout=self._cancel_timeout)
-					if self._registered:
-						self._orphan_process_warn()
-			else:
-				self._wait_loop()
-
-			if self.returncode is not None:
-				return self.returncode
-
-		if not isinstance(self.pid, int):
-			# Get debug info for bug #403697.
-			raise AssertionError(
-				"%s: pid is non-integer: %s" %
-				(self.__class__.__name__, repr(self.pid)))
-
-		self._waitpid_loop()
-
-		return self.returncode
-
 	def _async_waitpid(self):
 		"""
 		Wait for exit status of self.pid asynchronously, and then
@@ -122,18 +80,6 @@ class SubProcess(AbstractPollTask):
 		self._set_returncode((pid, condition))
 		self._async_wait()
 
-	def _waitpid_loop(self):
-		"""
-		Deprecated. Use _async_waitpid() instead.
-		"""
-		source_id = self.scheduler.child_watch_add(
-			self.pid, self._waitpid_cb)
-		try:
-			while self.returncode is None:
-				self.scheduler.iteration()
-		finally:
-			self.scheduler.source_remove(source_id)
-
 	def _waitpid_cb(self, pid, condition, user_data=None):
 		if pid != self.pid:
 			raise AssertionError("expected pid %s, got %s" % (self.pid, pid))

diff --git a/pym/portage/_emirrordist/MirrorDistTask.py b/pym/portage/_emirrordist/MirrorDistTask.py
index b8cde0af4..8eb3081c6 100644
--- a/pym/portage/_emirrordist/MirrorDistTask.py
+++ b/pym/portage/_emirrordist/MirrorDistTask.py
@@ -241,13 +241,6 @@ class MirrorDistTask(CompositeTask):
 		else:
 			self._async_wait()
 
-	def _wait(self):
-		"""
-		Deprecated. Use _async_wait() instead.
-		"""
-		CompositeTask._wait(self)
-		self._cleanup()
-
 	def _async_wait(self):
 		"""
 		Override _async_wait to call self._cleanup().

diff --git a/pym/portage/util/_async/AsyncScheduler.py b/pym/portage/util/_async/AsyncScheduler.py
index 2ddbaa885..90e803eba 100644
--- a/pym/portage/util/_async/AsyncScheduler.py
+++ b/pym/portage/util/_async/AsyncScheduler.py
@@ -1,4 +1,4 @@
-# Copyright 2012-2013 Gentoo Foundation
+# Copyright 2012-2018 Gentoo Foundation
 # Distributed under the terms of the GNU General Public License v2
 
 from portage import os
@@ -96,26 +96,3 @@ class AsyncScheduler(AsynchronousTask, PollScheduler):
 		"""
 		self._cleanup()
 		super(AsyncScheduler, self)._async_wait()
-
-	def _wait(self):
-		"""
-		Deprecated. Use _async_wait() instead.
-		"""
-		# Loop while there are jobs to be scheduled.
-		while self._keep_scheduling():
-			self._event_loop.iteration()
-
-		# Clean shutdown of previously scheduled jobs. In the
-		# case of termination, this allows for basic cleanup
-		# such as flushing of buffered output to logs.
-		while self._is_work_scheduled():
-			self._event_loop.iteration()
-
-		self._cleanup()
-
-		if self._error_count > 0:
-			self.returncode = 1
-		else:
-			self.returncode = os.EX_OK 
-
-		return self.returncode

diff --git a/pym/portage/util/_async/AsyncTaskFuture.py b/pym/portage/util/_async/AsyncTaskFuture.py
index cdc842b05..581f5ea66 100644
--- a/pym/portage/util/_async/AsyncTaskFuture.py
+++ b/pym/portage/util/_async/AsyncTaskFuture.py
@@ -29,11 +29,3 @@ class AsyncTaskFuture(AsynchronousTask):
 		else:
 			self.returncode = 1
 		self._async_wait()
-
-	def _wait(self):
-		"""
-		Deprecated. Use _async_wait() instead.
-		"""
-		if self.returncode is None:
-			self.scheduler.run_until_complete(self.future)
-		return self.returncode

diff --git a/pym/portage/util/_async/PipeLogger.py b/pym/portage/util/_async/PipeLogger.py
index ed1202edf..02de74b16 100644
--- a/pym/portage/util/_async/PipeLogger.py
+++ b/pym/portage/util/_async/PipeLogger.py
@@ -66,13 +66,6 @@ class PipeLogger(AbstractPollTask):
 		if self.returncode is None:
 			self.returncode = self._cancelled_returncode
 
-	def _wait(self):
-		if self.returncode is not None:
-			return self.returncode
-		self._wait_loop()
-		self.returncode = os.EX_OK
-		return self.returncode
-
 	def _output_handler(self, fd, event):
 
 		background = self.background

diff --git a/pym/portage/util/_async/PipeReaderBlockingIO.py b/pym/portage/util/_async/PipeReaderBlockingIO.py
index 0727d2c6a..6933c9216 100644
--- a/pym/portage/util/_async/PipeReaderBlockingIO.py
+++ b/pym/portage/util/_async/PipeReaderBlockingIO.py
@@ -72,16 +72,6 @@ class PipeReaderBlockingIO(AbstractPollTask):
 			self.returncode = self._cancelled_returncode
 		self._async_wait()
 
-	def _wait(self):
-		"""
-		Deprecated. Use _async_wait() instead.
-		"""
-		if self.returncode is not None:
-			return self.returncode
-		self._wait_loop()
-		self.returncode = os.EX_OK
-		return self.returncode
-
 	def getvalue(self):
 		"""Retrieve the entire contents"""
 		with self._thread_rlock:

diff --git a/pym/portage/util/_async/SchedulerInterface.py b/pym/portage/util/_async/SchedulerInterface.py
index acacf7c31..be118ae0e 100644
--- a/pym/portage/util/_async/SchedulerInterface.py
+++ b/pym/portage/util/_async/SchedulerInterface.py
@@ -15,7 +15,6 @@ class SchedulerInterface(SlotObject):
 		"IO_NVAL", "IO_OUT", "IO_PRI",
 		"child_watch_add",
 		"io_add_watch",
-		"iteration",
 		"source_remove",
 		"timeout_add",
 


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-04-29  4:38 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-04-29  4:38 [gentoo-commits] proj/portage:master commit in: pym/portage/util/_async/, pym/_emerge/, pym/portage/_emirrordist/ Zac Medico

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox