* [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, doc/, catalyst/
@ 2021-01-18 18:24 Matt Turner
0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2021-01-18 18:24 UTC (permalink / raw
To: gentoo-commits
commit: 38bf69c851c337a90afa809b9b828667ccad5380
Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Mon Jan 18 16:52:20 2021 +0000
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Mon Jan 18 18:12:39 2021 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=38bf69c8
catalyst: Add option to enter the chroot before building
With --enter-chroot, after the mounts and environment are set up,
catalyst will drop you into a shell inside the chroot. Useful for
hacking or debugging.
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
catalyst/base/stagebase.py | 17 ++++++++++++++++-
catalyst/main.py | 4 ++++
doc/catalyst.1.txt | 3 +++
3 files changed, 23 insertions(+), 1 deletion(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index dfa4680d..669d8546 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
@@ -94,6 +94,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
self.bind,
self.chroot_setup,
self.setup_environment,
+ self.enter_chroot,
]
self.finish_sequence = []
@@ -1326,6 +1327,20 @@ 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")
+ try:
+ cmd([chroot, self.settings['chroot_path'], bash, '-l'],
+ env=self.env)
+ except CatalystError:
+ pass
+
def run(self):
self.chroot_lock.write_lock()
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..217fc86a 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, doc/, catalyst/
@ 2022-01-30 23:07 Matt Turner
0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2022-01-30 23:07 UTC (permalink / raw
To: gentoo-commits
commit: 91cedd2f94909500a97a9a70ee262170b222b668
Author: Matt Turner <mattst88 <AT> gentoo <DOT> org>
AuthorDate: Sun Jan 30 20:22:43 2022 +0000
Commit: Matt Turner <mattst88 <AT> gentoo <DOT> org>
CommitDate: Sun Jan 30 23:07:00 2022 +0000
URL: https://gitweb.gentoo.org/proj/catalyst.git/commit/?id=91cedd2f
catalyst: Switch to tomli
The Python community is coalescing around tomli, and tomli is likely to
be integrated into the standard library per PEP680.
Signed-off-by: Matt Turner <mattst88 <AT> gentoo.org>
catalyst/base/stagebase.py | 4 ++--
catalyst/main.py | 5 +++--
doc/make_subarch_table_guidexml.py | 5 +++--
3 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index 4a1b4eb6..ad96beb7 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -10,7 +10,7 @@ from pathlib import Path
import fasteners
import libmount
-import toml
+import tomli
from snakeoil import fileutils
from snakeoil.osutils import pjoin
@@ -124,7 +124,7 @@ class StageBase(TargetBase, ClearBase, GenBase):
name = x[:-len('.toml')]
with open(arch_dir + x) as file:
- arch_config = toml.load(file)
+ arch_config = tomli.load(file)
# Search for a subarchitecture in each arch in the arch_config
for arch in [x for x in arch_config if x.startswith(name) and host in arch_config[x]]:
diff --git a/catalyst/main.py b/catalyst/main.py
index 0de1040f..e51be9d1 100644
--- a/catalyst/main.py
+++ b/catalyst/main.py
@@ -6,7 +6,7 @@ import os
import sys
import textwrap
-import toml
+import tomli
from DeComp.definitions import (COMPRESS_DEFINITIONS, DECOMPRESS_DEFINITIONS,
CONTENTS_DEFINITIONS)
@@ -35,7 +35,8 @@ def parse_config(config_files):
for config_file in config_files:
log.notice('Loading configuration file: %s', config_file)
try:
- config = toml.load(config_file)
+ with open(config_file) as f:
+ config = tomli.load(f)
for key in config:
if key not in valid_config_file_values:
log.critical("Unknown option '%s' in config file %s",
diff --git a/doc/make_subarch_table_guidexml.py b/doc/make_subarch_table_guidexml.py
index 67ed3ccc..3c03f90c 100755
--- a/doc/make_subarch_table_guidexml.py
+++ b/doc/make_subarch_table_guidexml.py
@@ -5,7 +5,7 @@
import pathlib
import sys
import textwrap
-import toml
+import tomli
def write_guidexml(arch_to_subarch):
@@ -40,7 +40,8 @@ def main(_argv):
p = pathlib.Path('arch')
for file in p.glob('*.toml'):
- data = toml.load(file)
+ with file.open('rb') as f:
+ data = tomli.load(f)
for arch in [x for x in data if x != 'setarch']:
arch_to_subarch.update({arch: list(data[arch].keys())})
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2022-01-30 23:07 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-30 23:07 [gentoo-commits] proj/catalyst:wip/mattst88 commit in: catalyst/base/, doc/, catalyst/ Matt Turner
-- strict thread matches above, loose matches on Subject: below --
2021-01-18 18:24 Matt Turner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox