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 8E98F13835A for ; Mon, 18 Jan 2021 16:56:05 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id CF757E07F1; Mon, 18 Jan 2021 16:56:04 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 9F5CBE07F1 for ; Mon, 18 Jan 2021 16:56:04 +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 AC933340FE1 for ; Mon, 18 Jan 2021 16:56:03 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 5F1654A2 for ; Mon, 18 Jan 2021 16:56:02 +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: <1610988929.ed6a5aa4fca3180b9ae97ac031e1e11a2619fa89.mattst88@gentoo> Subject: [gentoo-commits] proj/catalyst:wip/mattst88 commit in: doc/, catalyst/, catalyst/base/ X-VCS-Repository: proj/catalyst X-VCS-Files: catalyst/base/stagebase.py catalyst/main.py doc/catalyst.1.txt X-VCS-Directories: catalyst/base/ catalyst/ doc/ X-VCS-Committer: mattst88 X-VCS-Committer-Name: Matt Turner X-VCS-Revision: ed6a5aa4fca3180b9ae97ac031e1e11a2619fa89 X-VCS-Branch: wip/mattst88 Date: Mon, 18 Jan 2021 16:56:02 +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: 3c6122d8-a1ec-4f59-8a10-915dc996a1f2 X-Archives-Hash: c2a0eeb3495f3dbd8e4f577025c6fbdc commit: ed6a5aa4fca3180b9ae97ac031e1e11a2619fa89 Author: Matt Turner gentoo org> AuthorDate: Mon Jan 18 16:52:20 2021 +0000 Commit: Matt Turner gentoo org> CommitDate: Mon Jan 18 16:55:29 2021 +0000 URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=ed6a5aa4 catalyst: Add option to enter the chroot before building Can be very useful for hacking or debugging. Signed-off-by: Matt Turner gentoo.org> catalyst/base/stagebase.py | 14 +++++++++++++- catalyst/main.py | 4 ++++ doc/catalyst.1.txt | 3 +++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index a3100723..caed2d7e 100644 --- a/catalyst/base/stagebase.py +++ b/catalyst/base/stagebase.py @@ -20,7 +20,7 @@ from catalyst import log from catalyst.context import namespace from catalyst.defaults import (confdefaults, MOUNT_DEFAULTS, PORT_LOGDIR_CLEAN) from catalyst.support import (CatalystError, file_locate, normpath, - cmd, read_makeconf, get_repo_name, ismount, + cmd, command, read_makeconf, get_repo_name, file_check, sanitize_name) from catalyst.base.targetbase import TargetBase from catalyst.base.clearbase import ClearBase @@ -77,6 +77,7 @@ class StageBase(TargetBase, ClearBase, GenBase): self.bind, self.chroot_setup, self.setup_environment, + self.enter_chroot, ] self.finish_sequence = [] @@ -1309,6 +1310,17 @@ class StageBase(TargetBase, ClearBase, GenBase): log.debug('setup_environment(); env = %r', self.env) + def enter_chroot(self): + if 'enter-chroot' not in self.settings['options']: + return + + chroot = command('chroot') + bash = command('bash') + + log.notice("Entering chroot") + cmd([chroot, self.settings['chroot_path'], bash, '-l'], + env=self.env) + @staticmethod def run_sequence(sequence): for func in sequence: diff --git a/catalyst/main.py b/catalyst/main.py index 48daf004..b0d9015f 100644 --- a/catalyst/main.py +++ b/catalyst/main.py @@ -120,6 +120,8 @@ def get_parser(): parser.add_argument('-V', '--version', action='version', version=get_version(), help='display version information') + parser.add_argument('--enter-chroot', default=False, action='store_true', + help='Enter chroot before starting the build') group = parser.add_argument_group('Program output options') group.add_argument('-d', '--debug', @@ -293,6 +295,8 @@ def _main(parser, opts): options.append('purgetmponly') if opts.clear_autoresume: options.append('clear-autoresume') + if opts.enter_chroot: + options.append('enter-chroot') # Make sure we have some work before moving further. if not myspecfile and not mycmdline: diff --git a/doc/catalyst.1.txt b/doc/catalyst.1.txt index 90d5a24b..6f948d23 100644 --- a/doc/catalyst.1.txt +++ b/doc/catalyst.1.txt @@ -39,6 +39,9 @@ configuration file is installed at '/etc/catalyst/catalyst.conf'. *-d*:: Enable debugging mode +*--enter-chroot*:: +Enter the chroot before starting the build + *--fetchonly*:: *-F*:: This tells *catalyst* to only fetch distfiles for the given packages without