pmb.build.init: fix apk wrapper for x86 on x86_64 (MR 2247)

Only install the abuild-apk wrapper if cpu emulation is required. This
fixes building for x86 on x86_64.

Fix for:
  >>> postmarketos-base-ui-gnome: Analyzing dependencies...
  /usr/local/bin/abuild-apk: line 11: /native/usr/bin/abuild-apk: not found

Fixes: c5ca06d5 ("pmb: only enable abuild-apk wrapper for buildroot (MR 2246)")
This commit is contained in:
Oliver Smith 2024-02-06 20:03:50 +00:00
parent 54a616621f
commit a890b2cd26
No known key found for this signature in database
GPG key ID: 5AE7F5513E0885CB

View file

@ -10,6 +10,7 @@ import pmb.config
import pmb.chroot
import pmb.chroot.apk
import pmb.helpers.run
import pmb.parse.arch
def init_abuild_minimal(args, suffix="native"):
@ -61,7 +62,8 @@ def init(args, suffix="native"):
apk_arch = pmb.parse.arch.from_chroot_suffix(args, suffix)
# Add apk wrapper that runs native apk and lies about arch
if suffix.startswith("buildroot_") and not os.path.exists(chroot + "/usr/local/bin/abuild-apk"):
if pmb.parse.arch.cpu_emulation_required(apk_arch) and \
not os.path.exists(chroot + "/usr/local/bin/abuild-apk"):
with open(chroot + "/tmp/apk_wrapper.sh", "w") as handle:
content = f"""
#!/bin/sh