about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPiraty <piraty1@inbox.ru>2020-09-22 11:56:38 +0200
committerLeah Neukirchen <leah@vuxu.org>2020-09-22 13:08:37 +0200
commitb57be870448b58d44bcd07b0ade631f96548aacc (patch)
treecfd9e11fbd6be259a7df52b717c87ca128aeed68
parent2e884539fb246221905f6945361c032feb4ad604 (diff)
downloadxtools-b57be870448b58d44bcd07b0ade631f96548aacc.tar.gz
xtools-b57be870448b58d44bcd07b0ade631f96548aacc.tar.xz
xtools-b57be870448b58d44bcd07b0ade631f96548aacc.zip
xgensum: handle packages unavailable for host arch
Detect if the package is unavailable for the host architecture and pick
the first supported arch.

Packages like bootloaders and kernels for arm boards obviously restrict
`archs=` which might exclude the host's architecture. Therefore xbps-src
couldn't fetch the distfiles without specifying `-a <arch>`.
-rwxr-xr-xxgensum9
1 files changed, 8 insertions, 1 deletions
diff --git a/xgensum b/xgensum
index 448c552..a55ab56 100755
--- a/xgensum
+++ b/xgensum
@@ -32,6 +32,13 @@ fi
 
 . "$template"
 
+# pick the first supported arch. This is required for packages unavailable for
+# the host arch
+FLAG_a=
+if ! "$XBPS_DISTDIR/xbps-src" show-avail $pkgname ; then
+	FLAG_a="-a $("$XBPS_DISTDIR/xbps-src" show $pkgname | sed -En -e 's/archs:[[:space:]]*([.*]*)/\1/p' | sed -e 's/\*$//' | grep -v -e '^~' | head -n1 )"
+fi
+
 # Try to source the build-style as well. This is required for R-cran packages.
 if [ -f "${XBPS_DISTDIR}/common/environment/build-style/${build_style}.sh"  ]; then
 	. "${XBPS_DISTDIR}/common/environment/build-style/${build_style}.sh"
@@ -50,7 +57,7 @@ if [ "$FLAG_f" = -f ]; then
 	"$XBPS_DISTDIR/xbps-src" $FLAG_h -I clean $pkgname
 fi
 
-"$XBPS_DISTDIR/xbps-src" $FLAG_h -I fetch $pkgname
+"$XBPS_DISTDIR/xbps-src" $FLAG_h $FLAG_a -I fetch $pkgname
 
 ret=0
 sums=""