From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 65E76138359 for ; Wed, 28 Oct 2020 22:08:59 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8043BE07D8; Wed, 28 Oct 2020 22:08:58 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 63D0DE07D8 for ; Wed, 28 Oct 2020 22:08:58 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3A15233BE68 for ; Wed, 28 Oct 2020 22:08:57 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 8CABA3B5 for ; Wed, 28 Oct 2020 22:08:55 +0000 (UTC) From: "Matt Turner" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Matt Turner" Message-ID: <1603922927.67d7a937df16cc7194986cc5dcc33ec3f6947847.mattst88@gentoo> Subject: [gentoo-commits] proj/catalyst:pending/mattst88 commit in: catalyst/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/main.py X-VCS-Directories: catalyst/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: 67d7a937df16cc7194986cc5dcc33ec3f6947847 X-VCS-Branch: pending/mattst88 Date: Wed, 28 Oct 2020 22:08:55 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: 1953db40-a02d-49f5-ab1b-e5c2413e4137 X-Archives-Hash: c45122eff3979df4ae36df8606044d9b commit: 67d7a937df16cc7194986cc5dcc33ec3f6947847 Author: Matt Turner gentoo org> AuthorDate: Wed Oct 28 21:59:17 2020 +0000 Commit: Matt Turner gentoo 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 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)