From 0e333003df7f8557efd6e6e0ff5c08b885e82511 Mon Sep 17 00:00:00 2001
From: psykose <alice@ayaya.dev>
Date: Thu, 1 Jun 2023 07:29:59 +0000
Subject: [PATCH] abuild: downgrade binfmt-registration error to a warning

strictly speaking, it is possible for an x86_64 cpu to run 32-bit
userspace binaries without qemu emulation. it is also possible for an
aarch64 cpu to run armhf/armv7 binaries (as long as the cpu implements
it, most do). rather than check for every possible combination of when
this is allowed (host cpu + emulated target, does cpu support it, ...),
just downgrade this case to a warning, to permit non-emulated use.

ref https://gitlab.alpinelinux.org/alpine/abuild/-/merge_requests/117#note_255174
---
 abuild.in | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/abuild.in b/abuild.in
index d7663b31..78631b8c 100755
--- a/abuild.in
+++ b/abuild.in
@@ -2463,8 +2463,9 @@ rootbld() {
 
 	if ! [ $CBUILD_ARCH = "$(apk --print-arch)" ]; then
 		# cross-building, so check for binfmt registration
-		if ! [ -f "/proc/sys/fs/binfmt_misc/qemu-$(rootbld_qemu_arch)" ]; then
-			die "rootbld: binfmt registration missing for $(rootbld_qemu_arch) binaries"
+		local qarch="$(rootbld_qemu_arch)"
+		if ! [ -f "/proc/sys/fs/binfmt_misc/$qarch" ]; then
+			warning "rootbld: binfmt registration missing for $qarch binaries"
 		fi
 		# TODO: it's not safe to mix a cache dir between architectures,
 		# so we have to use something other than /etc/apk/cache
-- 
GitLab