Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 654276 - sys-apps/portage: migrate to asyncio AbstractChildWatcher.add_child_handler interface
Summary: sys-apps/portage: migrate to asyncio AbstractChildWatcher.add_child_handler i...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 591760
  Show dependency tree
 
Reported: 2018-04-29 06:25 UTC by Zac Medico
Modified: 2018-09-24 02:50 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2018-04-29 06:25:47 UTC
SubProcess subclasses currently override the SubProcess._set_returncode method and perform cleanup there, however it will be better if this cleanup code is moved to the _async_wait method, since _set_returncode expects an os.waitpid return value which is inconveniently different from the returncode that is passed to AbstractChildWatcher.add_child_handler callbacks. This commit demonstrates how I've moved PopenProcess over to the add_child_handler interface:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=be800bf0153a28ce034277d103a2021f93ac8b2e
Comment 1 Larry the Git Cow gentoo-dev 2018-04-29 21:29:17 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=b530e4e67b843837093e545cf81fd4ab8336d2c2

commit b530e4e67b843837093e545cf81fd4ab8336d2c2
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-04-29 21:09:59 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-04-29 21:26:37 +0000

    SubProcess: add_child_handler asyncio compat (bug 654276)
    
    Migrate to asyncio's AbstractChildWatcher.add_child_handler
    interface. Re-use PopenProcess code introduced in commit
    be800bf0153a28ce034277d103a2021f93ac8b2e. Also remove the
    child_watch_add method from SchedulerInterface, since there
    are no more consumers.
    
    Bug: https://bugs.gentoo.org/654276

 pym/_emerge/SubProcess.py                     | 58 ++++-----------------------
 pym/portage/util/_async/PopenProcess.py       | 20 ++-------
 pym/portage/util/_async/SchedulerInterface.py |  1 -
 3 files changed, 11 insertions(+), 68 deletions(-)

https://gitweb.gentoo.org/proj/portage.git/commit/?id=542c6e6c20a1d93a3a2af47c8de50eac3c891d5d

commit 542c6e6c20a1d93a3a2af47c8de50eac3c891d5d
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-04-29 20:48:23 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-04-29 21:26:37 +0000

    MergeProcess: fix deprecated _set_returncode (bug 654276)
    
    Move cleanup code from _set_returncode to _async_waitpid_cb,
    since _set_returncode expects an os.waitpid return value which
    is inconveniently different from the returncode that is passed to
    asyncio.AbstractChildWatcher.add_child_handler callbacks.
    
    Bug: https://bugs.gentoo.org/654276

 pym/portage/dbapi/_MergeProcess.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

https://gitweb.gentoo.org/proj/portage.git/commit/?id=9b013dc77de62604d151f82831ca3cd494788d5f

commit 9b013dc77de62604d151f82831ca3cd494788d5f
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-04-29 20:42:31 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-04-29 20:44:27 +0000

    EbuildMetadataPhase: fix deprecated _set_returncode (bug 654276)
    
    Move cleanup code from _set_returncode to _async_waitpid_cb,
    since _set_returncode expects an os.waitpid return value which
    is inconveniently different from the returncode that is passed to
    asyncio.AbstractChildWatcher.add_child_handler callbacks.
    
    Bug: https://bugs.gentoo.org/654276

 pym/_emerge/EbuildMetadataPhase.py | 17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

https://gitweb.gentoo.org/proj/portage.git/commit/?id=943bd29a388a7d113066bad660c9bfdb6fab0821

commit 943bd29a388a7d113066bad660c9bfdb6fab0821
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-04-29 20:35:37 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-04-29 20:35:37 +0000

    EbuildFetcher: fix deprecated _set_returncode (bug 654276)
    
    Move cleanup code from _set_returncode to _async_waitpid_cb,
    since _set_returncode expects an os.waitpid return value which
    is inconveniently different from the returncode that is passed to
    asyncio.AbstractChildWatcher.add_child_handler callbacks.
    
    Bug: https://bugs.gentoo.org/654276

 pym/_emerge/EbuildFetcher.py | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

https://gitweb.gentoo.org/proj/portage.git/commit/?id=6d6e7debbd768b399bba5a32156bd59bb18f737d

commit 6d6e7debbd768b399bba5a32156bd59bb18f737d
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-04-29 20:19:24 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-04-29 20:27:32 +0000

    BinpkgFetcher: fix deprecated _set_returncode (bug 654276)
    
    The _set_returncode method is deprecated because it expects
    an os.waitpid return value which is inconveniently
    different from the returncode that is passed to
    asyncio.AbstractChildWatcher.add_child_handler callbacks.
    
    Bug: https://bugs.gentoo.org/654276

 pym/_emerge/BinpkgFetcher.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

https://gitweb.gentoo.org/proj/portage.git/commit/?id=08f03935b92e8fcacf95c583e389f349f5db67b8

commit 08f03935b92e8fcacf95c583e389f349f5db67b8
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-04-29 19:09:00 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-04-29 20:27:32 +0000

    AbstractEbuildProcess: fix deprecated _set_returncode (bug 654276)
    
    Move cleanup code from _set_returncode to _async_waitpid_cb,
    since _set_returncode expects an os.waitpid return value which
    is inconveniently different from the returncode that is passed to
    asyncio.AbstractChildWatcher.add_child_handler callbacks.
    
    Bug: https://bugs.gentoo.org/654276

 pym/_emerge/AbstractEbuildProcess.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

https://gitweb.gentoo.org/proj/portage.git/commit/?id=22fbdd3bf7de43c3bb216cd2da0623cd24280499

commit 22fbdd3bf7de43c3bb216cd2da0623cd24280499
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-04-29 19:16:06 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-04-29 20:27:32 +0000

    SpawnProcess: fix deprecated _set_returncode (bug 654276)
    
    Move cleanup code from _set_returncode to _unregister, since
    _set_returncode expects an os.waitpid return value which is
    inconveniently different from the returncode that is passed to
    asyncio.AbstractChildWatcher.add_child_handler callbacks.
    
    Bug: https://bugs.gentoo.org/654276

 pym/_emerge/SpawnProcess.py | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

https://gitweb.gentoo.org/proj/portage.git/commit/?id=b2ba35d4704172e8ddbfa0c98900f4b6ed20416b

commit b2ba35d4704172e8ddbfa0c98900f4b6ed20416b
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-04-29 20:03:05 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-04-29 20:03:43 +0000

    AbstractPollTask: call _unregister in _async_wait (bug 654276)
    
    Subclasses of AbstractPollTask perform idempotent cleanup in
    the _unregister method, so it's useful for _async_wait to call it
    automatically. This allows for migration of various cleanup code from
    _set_returncode to _unregister, for the purposes of bug 654276.
    
    Bug: https://bugs.gentoo.org/654276

 pym/_emerge/AbstractPollTask.py | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)}
Comment 2 Zac Medico gentoo-dev 2018-09-24 02:50:53 UTC
Fixed in portage-2.3.32.