From 447bae0d3edc45dd8aa17137b526eb735733f755 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C4=90o=C3=A0n=20Tr=E1=BA=A7n=20C=C3=B4ng=20Danh?= Date: Mon, 23 Mar 2020 17:34:39 +0700 Subject: [PATCH] uname.sh: fix cross `uname -m` when XBPS_ARCH is reseted From commit cf6e6f14d3, (wrappers/uname: report correct machine type on ethereal, 2020-02-10). Some template use `env -i` to reset environment variable for building host's binary file, thus the wrapped `uname -m` reports empty strings. Fix it by falling back to the value reported by `/usr/bin/uname -m`. We don't expect people cross-compile from i686-ethereal-chroot on top of x86_64 machine, it was expected to use for travis to native compile i686 only. --- common/wrappers/uname.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/common/wrappers/uname.sh b/common/wrappers/uname.sh index 1f1846999eb..723e3c884a4 100644 --- a/common/wrappers/uname.sh +++ b/common/wrappers/uname.sh @@ -1,9 +1,13 @@ #!/bin/sh uname=$(/usr/bin/uname $@) +uname_m=$(/usr/bin/uname -m) +arch=${XBPS_ARCH%-musl} +# if XBPS_ARCH was reseted by `env -i` use original `/usr/bin/uname -m` +: ${arch:=$uname_m} rv=$? echo "$uname" | sed "s/\(^\| \)$(/usr/bin/uname -n)\($\| \)/\1void\2/" | - sed "s/$(/usr/bin/uname -m)/${XBPS_ARCH%-musl}/" + sed "s/$uname_m/$arch/" exit $rv