From db12e987d0fb7c5ead6ba205188ff91bb083fe8f Mon Sep 17 00:00:00 2001 From: Clayton Craft Date: Wed, 28 Jul 2021 15:14:11 -0700 Subject: [PATCH] pmb/chroot/binfmt: always install qemu- binary (MR 2088) gitlab runners seem to be registering binfmt now (?), so this fixes an issue where register() might return immediately because the OS (or ??) took care of registration, but the qemu- binary wasn't added to the chroot. --- pmb/chroot/binfmt.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/pmb/chroot/binfmt.py b/pmb/chroot/binfmt.py index c6cd270b..4328e372 100644 --- a/pmb/chroot/binfmt.py +++ b/pmb/chroot/binfmt.py @@ -18,10 +18,15 @@ def register(args, arch): Get arch, magic, mask. """ arch_qemu = pmb.parse.arch.alpine_to_qemu(arch) + + # always make sure the qemu- binary is installed, since registering + # may happen outside of this method (e.g. by OS) + if f"qemu-{arch_qemu}" not in pmb.chroot.apk.installed(args): + pmb.chroot.apk.install(args, ["qemu-" + arch_qemu]) + if is_registered(arch_qemu): return pmb.helpers.other.check_binfmt_misc(args) - pmb.chroot.apk.install(args, ["qemu-" + arch_qemu]) # Don't continue if the actions from check_binfmt_misc caused the OS to # automatically register the target arch