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