commit: 67d7a937df16cc7194986cc5dcc33ec3f6947847
Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Wed Oct 28 21:59:17 2020 +0000
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Wed Oct 28 22:08:47 2020 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=67d7a937
catalyst: Switch to using snakeoil's Namespace context
This will allow us to run only parts of the build in a new namespace.
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
catalyst/main.py | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/catalyst/main.py b/catalyst/main.py
index 543895c6..f4d3b7d7 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -7,7 +7,7 @@ import textwrap
import toml
-from snakeoil.process import namespaces
+from snakeoil.contexts import Namespace
from DeComp.definitions import (COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS,
CONTENTS_DEFINITIONS)
@@ -356,15 +356,15 @@ def _main(parser, opts):
# use pid & user namespaces, but snakeoil's namespace module has signal
# transfer issues (CTRL+C doesn't propagate), and user namespaces need
# more work due to Gentoo build process (uses sudo/root/portage).
- namespaces.simple_unshare(
- mount=True, uts=True, ipc=True, pid=False, net=False, user=False,
- hostname='catalyst')
+ with Namespace(mount=True, uts=True, ipc=True, net=False, pid=False,
+ user=False, hostname='catalyst'):
+ # everything is setup, so the build is a go
+ try:
+ success = build_target(addlargs)
+ except KeyboardInterrupt:
+ success = False
+ log.critical('Catalyst build aborted due to user interrupt
(Ctrl-C)')
- # everything is setup, so the build is a go
- try:
- success = build_target(addlargs)
- except KeyboardInterrupt:
- log.critical('Catalyst build aborted due to user interrupt (Ctrl-C)')
if not success:
sys.exit(2)
sys.exit(0)