mirror of
https://gitlab.com/kupfer/kupferbootstrap.git
synced 2025-02-23 05:35:44 -05:00
chroot.run_cmd(): don't blindly import outer env into chroot, avoiding a bunch of spam.
This commit is contained in:
parent
5eda60c14d
commit
4e4e12b6b9
1 changed files with 10 additions and 6 deletions
|
@ -7,11 +7,11 @@ from shlex import quote as shell_quote
|
||||||
from typing import Protocol, Union, Optional, Mapping
|
from typing import Protocol, Union, Optional, Mapping
|
||||||
from uuid import uuid4
|
from uuid import uuid4
|
||||||
|
|
||||||
|
from config import config
|
||||||
|
from constants import Arch, CHROOT_PATHS, GCC_HOSTSPECS
|
||||||
|
from distro.distro import get_base_distro, get_kupfer_local, RepoInfo
|
||||||
from exec.cmd import run_root_cmd, generate_env_cmd, flatten_shell_script, wrap_in_bash
|
from exec.cmd import run_root_cmd, generate_env_cmd, flatten_shell_script, wrap_in_bash
|
||||||
from exec.file import makedir, root_makedir, root_write_file, write_file
|
from exec.file import makedir, root_makedir, root_write_file, write_file
|
||||||
from config import config
|
|
||||||
from constants import Arch, CHROOT_PATHS
|
|
||||||
from distro.distro import get_base_distro, get_kupfer_local, RepoInfo
|
|
||||||
from generator import generate_makepkg_conf
|
from generator import generate_makepkg_conf
|
||||||
from utils import mount, umount, check_findmnt, log_or_exception
|
from utils import mount, umount, check_findmnt, log_or_exception
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ class Chroot(AbstractChroot):
|
||||||
self,
|
self,
|
||||||
script: Union[str, list[str]],
|
script: Union[str, list[str]],
|
||||||
inner_env: dict[str, str] = {},
|
inner_env: dict[str, str] = {},
|
||||||
outer_env: dict[str, str] = os.environ.copy() | {'QEMU_LD_PREFIX': '/usr/aarch64-linux-gnu'},
|
outer_env: dict[str, str] = {},
|
||||||
attach_tty: bool = False,
|
attach_tty: bool = False,
|
||||||
capture_output: bool = False,
|
capture_output: bool = False,
|
||||||
cwd: Optional[str] = None,
|
cwd: Optional[str] = None,
|
||||||
|
@ -227,8 +227,12 @@ class Chroot(AbstractChroot):
|
||||||
if not self.active and fail_inactive:
|
if not self.active and fail_inactive:
|
||||||
raise Exception(f'Chroot {self.name} is inactive, not running command! Hint: pass `fail_inactive=False`')
|
raise Exception(f'Chroot {self.name} is inactive, not running command! Hint: pass `fail_inactive=False`')
|
||||||
if outer_env is None:
|
if outer_env is None:
|
||||||
outer_env = os.environ.copy()
|
outer_env = {}
|
||||||
env_cmd = generate_env_cmd(inner_env)
|
native = config.runtime['arch']
|
||||||
|
if self.arch != native and 'QEMU_LD_PREFIX' not in outer_env:
|
||||||
|
outer_env = dict(outer_env) # copy dict for modification
|
||||||
|
outer_env |= {'QEMU_LD_PREFIX': f'/usr/{GCC_HOSTSPECS[native][self.arch]}'}
|
||||||
|
env_cmd = generate_env_cmd(inner_env) if inner_env else []
|
||||||
|
|
||||||
if not isinstance(script, str) and isinstance(script, list):
|
if not isinstance(script, str) and isinstance(script, list):
|
||||||
script = flatten_shell_script(script, shell_quote_items=False, wrap_in_shell_quote=False)
|
script = flatten_shell_script(script, shell_quote_items=False, wrap_in_shell_quote=False)
|
||||||
|
|
Loading…
Add table
Reference in a new issue