diff options
author | 2021-01-18 11:52:20 -0500 | |
---|---|---|
committer | 2021-01-23 11:22:22 -0500 | |
commit | 87b0588ab4f77e413c250a4a3e357624ec41c374 (patch) | |
tree | 7e9041b881342a60b58fc533f58455a857031b7b /catalyst/base | |
parent | catalyst: Deduplicate the common build_sequence steps (diff) | |
download | catalyst-87b0588ab4f77e413c250a4a3e357624ec41c374.tar.gz catalyst-87b0588ab4f77e413c250a4a3e357624ec41c374.tar.bz2 catalyst-87b0588ab4f77e413c250a4a3e357624ec41c374.zip |
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@gentoo.org>
Diffstat (limited to 'catalyst/base')
-rw-r--r-- | catalyst/base/stagebase.py | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py index 40b60af3..676206ff 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 @@ -95,6 +95,9 @@ class StageBase(TargetBase, ClearBase, GenBase): self.chroot_setup, self.setup_environment, ] + if 'enter-chroot' in self.settings['options']: + self.build_sequence.append(self.enter_chroot) + self.finish_sequence = [] self.set_valid_build_kernel_vars(addlargs) @@ -1326,6 +1329,17 @@ class StageBase(TargetBase, ClearBase, GenBase): log.debug('setup_environment(); env = %r', self.env) + def enter_chroot(self): + 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() |