1 |
On 7/29/19 3:28 PM, Ulrich Mueller wrote: |
2 |
>>>>>> On Mon, 29 Jul 2019, Zac Medico wrote: |
3 |
> |
4 |
>> This will enable network-sandbox for all of _networked_phases, but |
5 |
>> Michał only suggested to do it for src_unpack. |
6 |
> |
7 |
> Right. Patch v2 below. |
8 |
> |
9 |
> |
10 |
> From 6e929fac0a3f5f0bcfe85152c0931cb20d579881 Mon Sep 17 00:00:00 2001 |
11 |
> From: =?UTF-8?q?Ulrich=20M=C3=BCller?= <ulm@g.o> |
12 |
> Date: Mon, 29 Jul 2019 14:22:57 +0200 |
13 |
> Subject: [PATCH] doebuild.py: Override network-sandbox in unpack only for live |
14 |
> ebuilds. |
15 |
> MIME-Version: 1.0 |
16 |
> Content-Type: text/plain; charset=UTF-8 |
17 |
> Content-Transfer-Encoding: 8bit |
18 |
> |
19 |
> Suggested-by: Michał Górny <mgorny@g.o> |
20 |
> Signed-off-by: Ulrich Müller <ulm@g.o> |
21 |
> --- |
22 |
> lib/portage/package/ebuild/doebuild.py | 11 +++-------- |
23 |
> 1 file changed, 3 insertions(+), 8 deletions(-) |
24 |
> |
25 |
> diff --git a/lib/portage/package/ebuild/doebuild.py b/lib/portage/package/ebuild/doebuild.py |
26 |
> index 67867d33e..6f980f87d 100644 |
27 |
> --- a/lib/portage/package/ebuild/doebuild.py |
28 |
> +++ b/lib/portage/package/ebuild/doebuild.py |
29 |
> @@ -115,13 +115,6 @@ _ipc_phases = frozenset([ |
30 |
> _global_pid_phases = frozenset([ |
31 |
> 'config', 'depend', 'preinst', 'prerm', 'postinst', 'postrm']) |
32 |
> |
33 |
> -# phases in which networking access is allowed |
34 |
> -_networked_phases = frozenset([ |
35 |
> - # for VCS fetching |
36 |
> - "unpack", |
37 |
> - # + for network-bound IPC |
38 |
> -] + list(_ipc_phases)) |
39 |
> - |
40 |
> _phase_func_map = { |
41 |
> "config": "pkg_config", |
42 |
> "setup": "pkg_setup", |
43 |
> @@ -156,7 +149,9 @@ def _doebuild_spawn(phase, settings, actionmap=None, **kwargs): |
44 |
> phase in _ipc_phases |
45 |
> kwargs['mountns'] = 'mount-sandbox' in settings.features |
46 |
> kwargs['networked'] = 'network-sandbox' not in settings.features or \ |
47 |
> - phase in _networked_phases or \ |
48 |
> + (phase == 'unpack' and \ |
49 |
> + 'live' in settings.configdict['pkg'].get('PROPERTIES', '').split()) or \ |
50 |
> + phase in _ipc_phases or \ |
51 |
> 'network-sandbox' in settings['PORTAGE_RESTRICT'].split() |
52 |
> kwargs['pidns'] = ('pid-sandbox' in settings.features and |
53 |
> phase not in _global_pid_phases) |
54 |
> |
55 |
|
56 |
Looks good. Please merge. |
57 |
-- |
58 |
Thanks, |
59 |
Zac |