Gentoo Archives: gentoo-commits

From: Matt Turner <mattst88@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/
Date: Wed, 28 Oct 2020 22:00:47
Message-Id: 1603922357.717f5703011109971fc9d64f94a0ae9cbbbecb53.mattst88@gentoo
1 commit: 717f5703011109971fc9d64f94a0ae9cbbbecb53
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 21:59:17 2020 +0000
6 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=717f5703
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 | 17 ++++++++---------
15 1 file changed, 8 insertions(+), 9 deletions(-)
16
17 diff --git a/catalyst/main.py b/catalyst/main.py
18 index 543895c6..f870ab40 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,14 @@ 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 + log.critical('Catalyst build aborted due to user interrupt (Ctrl-C)')
44
45 - # everything is setup, so the build is a go
46 - try:
47 - success = build_target(addlargs)
48 - except KeyboardInterrupt:
49 - log.critical('Catalyst build aborted due to user interrupt (Ctrl-C)')
50 if not success:
51 sys.exit(2)
52 sys.exit(0)