1 |
commit: 67d7a937df16cc7194986cc5dcc33ec3f6947847 |
2 |
Author: Matt Turner <mattst88 <AT> gentoo <DOT> org> |
3 |
AuthorDate: Wed Oct 28 21:59:17 2020 +0000 |
4 |
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Oct 28 22:08:47 2020 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=67d7a937 |
7 |
|
8 |
catalyst: Switch to using snakeoil's Namespace context |
9 |
|
10 |
This will allow us to run only parts of the build in a new namespace. |
11 |
|
12 |
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org> |
13 |
|
14 |
catalyst/main.py | 18 +++++++++--------- |
15 |
1 file changed, 9 insertions(+), 9 deletions(-) |
16 |
|
17 |
diff --git a/catalyst/main.py b/catalyst/main.py |
18 |
index 543895c6..f4d3b7d7 100644 |
19 |
--- a/catalyst/main.py |
20 |
+++ b/catalyst/main.py |
21 |
@@ -7,7 +7,7 @@ import textwrap |
22 |
|
23 |
import toml |
24 |
|
25 |
-from snakeoil.process import namespaces |
26 |
+from snakeoil.contexts import Namespace |
27 |
|
28 |
from DeComp.definitions import (COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS, |
29 |
CONTENTS_DEFINITIONS) |
30 |
@@ -356,15 +356,15 @@ def _main(parser, opts): |
31 |
# use pid & user namespaces, but snakeoil's namespace module has signal |
32 |
# transfer issues (CTRL+C doesn't propagate), and user namespaces need |
33 |
# more work due to Gentoo build process (uses sudo/root/portage). |
34 |
- namespaces.simple_unshare( |
35 |
- mount=True, uts=True, ipc=True, pid=False, net=False, user=False, |
36 |
- hostname='catalyst') |
37 |
+ with Namespace(mount=True, uts=True, ipc=True, net=False, pid=False, |
38 |
+ user=False, hostname='catalyst'): |
39 |
+ # everything is setup, so the build is a go |
40 |
+ try: |
41 |
+ success = build_target(addlargs) |
42 |
+ except KeyboardInterrupt: |
43 |
+ success = False |
44 |
+ log.critical('Catalyst build aborted due to user interrupt (Ctrl-C)') |
45 |
|
46 |
- # everything is setup, so the build is a go |
47 |
- try: |
48 |
- success = build_target(addlargs) |
49 |
- except KeyboardInterrupt: |
50 |
- log.critical('Catalyst build aborted due to user interrupt (Ctrl-C)') |
51 |
if not success: |
52 |
sys.exit(2) |
53 |
sys.exit(0) |