Chroot.run_cmd(): add cwd
param, convert packages.setup_sources() to use run_cmd() for makepkg
This commit is contained in:
parent
6be94271a2
commit
49e6bf740f
2 changed files with 6 additions and 9 deletions
|
@ -311,6 +311,7 @@ class Chroot:
|
|||
outer_env: dict[str, str] = os.environ.copy() | {'QEMU_LD_PREFIX': '/usr/aarch64-linux-gnu'},
|
||||
attach_tty: str = False,
|
||||
capture_output: str = False,
|
||||
cwd: str = None,
|
||||
fail_inactive: bool = True) -> subprocess.CompletedProcess:
|
||||
if not self.active and fail_inactive:
|
||||
raise Exception(f'Chroot {self.name} is inactive, not running command! Hint: pass `fail_inactive=False`')
|
||||
|
@ -326,6 +327,8 @@ class Chroot:
|
|||
|
||||
if not isinstance(script, str) and isinstance(script, list):
|
||||
script = ' '.join(script)
|
||||
if cwd:
|
||||
script = f"cd {shell_quote(cwd)} && ( {script} )"
|
||||
cmd = ['chroot', self.path] + env_cmd + [
|
||||
'/bin/bash',
|
||||
'-c',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue