Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 475812

Summary: sys-apps/portage-2.2: portage.doebuild() with returnpid=False does not respect fd_pipes
Product: Portage Development Reporter: Fabio Erculiani (RETIRED) <lxnay>
Component: Core - External InteractionAssignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: major Keywords: InVCS
Priority: Normal    
Version: 2.2   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 472632    

Description Fabio Erculiani (RETIRED) gentoo-dev 2013-07-05 10:01:55 UTC
It looks like EbuildPhase._start_ebuild(), which gets called by _spawn_phase does use its own fd_pipes dict and the one passed to _spawn_phase isn't actually used.

This is quite a big problem for Sabayon Entropy because we are no longer able to log portage.doebuild() output and have users file proper and complete bug report info.

I would like to be able to tell Portage where to write its stuff through portage.doebuild() so that I can redirect the output to a log file (and write it to stdout/stderr myself).
Comment 1 Zac Medico gentoo-dev 2013-07-06 01:45:54 UTC
I've done some cleanup on the returnpid support, and updated the docstring to mention that fd_pipes parameter is only guaranteed to be respected when returnpid is True (otherwise all subprocesses simply inherit file descriptors from sys.__std* streams):

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1ac7623f580711d26a2b8e72547f2e6b5800b88e

I've also disabled the global spawned_pids list and made it so that it will not throw a ValueError if you try to remove a pid from the (always empty) list:

http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=898a57546953983b8888581bf888054163d9faa9
Comment 2 Zac Medico gentoo-dev 2013-07-06 02:05:33 UTC
I plan to add support for fd_pipes with returnpid=False, since it's preferable to use returnpid=False at least because it allows portage to do IPC with the ebuild process (for things like best/has_version and die calls).
Comment 3 Zac Medico gentoo-dev 2013-07-06 02:20:19 UTC
Some phases have important hooks that are built into the EbuildPhase class, and those hooks won't run in use call doebuild with returnpid=True. So, it seems like we should deprecate the returnpid parameter.
Comment 5 Zac Medico gentoo-dev 2013-07-07 20:59:54 UTC
This is fixed in 2.1.12.12 and 2.2.0_alpha187.