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-<arch> binary wasn't added to
the chroot.
This commit is contained in:
Clayton Craft 2021-07-28 15:14:11 -07:00
parent 8447629f3c
commit db12e987d0
No known key found for this signature in database
GPG Key ID: 7A3461CA187CEA54
1 changed files with 6 additions and 1 deletions

View File

@ -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-<arch> 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