From: Zac Medico Date: Thu, 22 Aug 2013 03:57:10 +0000 (-0700) Subject: doebuild.spawn: make args backward compatible X-Git-Tag: v2.2.1~3 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=6acaa421fbed2aa68ba0d576632f7e5fa8012205;p=portage.git doebuild.spawn: make args backward compatible Allow network and ipc by default, as before. Also, handle new FEATURES logic inside _doebuild_spawn instead of doebuild.spawn, so that ipc and networked arguments can be respected without need to consult FEATURES. --- diff --git a/pym/portage/package/ebuild/doebuild.py b/pym/portage/package/ebuild/doebuild.py index 2d26d2cbe..311f548a9 100644 --- a/pym/portage/package/ebuild/doebuild.py +++ b/pym/portage/package/ebuild/doebuild.py @@ -124,10 +124,11 @@ def _doebuild_spawn(phase, settings, actionmap=None, **kwargs): if phase in _unsandboxed_phases: kwargs['free'] = True - if phase in _ipc_phases: - kwargs['ipc'] = True - if phase in _networked_phases: - kwargs['networked'] = True + + kwargs['ipc'] = 'ipc-sandbox' not in settings.features or \ + phase in _ipc_phases + kwargs['networked'] = 'network-sandbox' not in settings.features or \ + phase in _networked_phases if phase == 'depend': kwargs['droppriv'] = 'userpriv' in settings.features @@ -1405,7 +1406,8 @@ def _validate_deps(mysettings, myroot, mydo, mydbapi): # XXX This would be to replace getstatusoutput completely. # XXX Issue: cannot block execution. Deadlock condition. -def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakeroot=0, networked=0, ipc=0, **keywords): +def spawn(mystring, mysettings, debug=False, free=False, droppriv=False, + sesandbox=False, fakeroot=False, networked=True, ipc=True, **keywords): """ Spawn a subprocess with extra portage-specific options. Optiosn include: @@ -1469,10 +1471,8 @@ def spawn(mystring, mysettings, debug=0, free=0, droppriv=0, sesandbox=0, fakero # Use Linux namespaces if available if uid == 0 and platform.system() == 'Linux': - if not networked and "network-sandbox" in features: - keywords['unshare_net'] = True - if not ipc and "ipc-sandbox" in features: - keywords['unshare_ipc'] = True + keywords['unshare_net'] = not networked + keywords['unshare_ipc'] = not ipc # TODO: Enable fakeroot to be used together with droppriv. The # fake ownership/permissions will have to be converted to real