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 9C8E3138359 for ; Wed, 28 Oct 2020 22:00:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id C90C1E082B; Wed, 28 Oct 2020 22:00:46 +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 AAC52E082B for ; Wed, 28 Oct 2020 22:00:46 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (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 42A58335D7B for ; Wed, 28 Oct 2020 22:00:45 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 958193BC for ; Wed, 28 Oct 2020 22:00:43 +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: <1603922357.717f5703011109971fc9d64f94a0ae9cbbbecb53.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: 717f5703011109971fc9d64f94a0ae9cbbbecb53 X-VCS-Branch: pending/mattst88 Date: Wed, 28 Oct 2020 22:00:43 +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: bb2383f7-c6be-4597-80c7-0300858ca5bc X-Archives-Hash: f3b9809de6261b296646e7c224800d8f commit: 717f5703011109971fc9d64f94a0ae9cbbbecb53 Author: Matt Turner gentoo org> AuthorDate: Wed Oct 28 21:59:17 2020 +0000 Commit: Matt Turner gentoo org> CommitDate: Wed Oct 28 21:59:17 2020 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=717f5703 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 | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/catalyst/main.py b/catalyst/main.py index 543895c6..f870ab40 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,14 @@ 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: + 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)