From 859b08df6ab6ef357cc0c46555874538b1e00fb1 Mon Sep 17 00:00:00 2001 From: InsanePrawn Date: Tue, 16 Aug 2022 03:24:49 +0200 Subject: [PATCH] packages.build_enable_qemu(): fixup for usage without wrapper, drop buildchroot requirement --- packages/__init__.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/__init__.py b/packages/__init__.py index 56ed3c7..4bb195e 100644 --- a/packages/__init__.py +++ b/packages/__init__.py @@ -710,14 +710,16 @@ def build_enable_qemu_binfmt(arch: Arch, repo: dict[str, Pkgbuild] = None): if arch not in ARCHES: raise Exception(f'Unknown architecture "{arch}". Choices: {", ".join(ARCHES)}') logging.info('Installing qemu-user (building if necessary)') + native = config.runtime['arch'] + if arch == native: + return enforce_wrap() if not repo: repo = discover_packages() - native = config.runtime['arch'] + # build qemu-user, binfmt, crossdirect - chroot = setup_build_chroot(native) build_packages_by_paths( - ['cross/' + pkg for pkg in CROSSDIRECT_PKGS], + CROSSDIRECT_PKGS, native, repo, try_download=True, @@ -725,7 +727,9 @@ def build_enable_qemu_binfmt(arch: Arch, repo: dict[str, Pkgbuild] = None): enable_crossdirect=False, enable_ccache=False, ) - run_root_cmd(['pacman', '-Syy', '--noconfirm', '--needed', '--config', os.path.join(chroot.path, 'etc/pacman.conf')] + QEMU_BINFMT_PKGS) + crossrepo = get_kupfer_local(native, in_chroot=False, scan=True).repos['cross'].packages + pkgfiles = [os.path.join(crossrepo[pkg].resolved_url.split('file://')[1]) for pkg in QEMU_BINFMT_PKGS] # type: ignore + run_root_cmd(['pacman', '-U', '--noconfirm', '--needed'] + pkgfiles) if arch != native: binfmt_register(arch)