From 9e9e0d7dcdc77e261bc5d944c2121cef493b3e2b Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 19 Apr 2024 14:36:07 +0200 Subject: ARCH detection and check --- mockit | 38 ++++++++++++++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/mockit b/mockit index 6c855a2..b99ed6a 100755 --- a/mockit +++ b/mockit @@ -1,10 +1,14 @@ #!/bin/bash if [ "$2" = "" ]; then - echo usage SRPM distro [ min_ver [, max_ver [, mock_options ]]] + echo -e "\nusage: $0 [ options ] SRPM distro [ min_ver [, max_ver [, mock_options ]]]\n" + echo -e "\t--nobase | --scl only build SCL packages" + echo -e "\t--noscl | --base only build base packages" + echo -e "\t--redis store build command in redis queue\n" exit 0 fi +# Script options BUILD_BASE=1 BUILD_SCLS=1 REDIS=0 @@ -28,6 +32,7 @@ SRPM=$1 DIST=$2 shift 2 +# PHP version build range if [ "$1" = "" ]; then MIN=0 else @@ -35,13 +40,39 @@ else shift fi if [ "$1" = "" ]; then - MAX=999 + MAX=99 else MAX=$1 shift fi +# ARCH detection and check +if [ "$(uname -m)" = "x86_64" ]; then + SUF=x +else + SUF=a +fi +case $DIST in + *x) + if [ $SUF != x ]; then + echo "Not an x86_64 builder" + exit 1 + fi + ;; + *a) + if [ $SUF != a ]; then + echo "Not an aarch64 builder" + exit 1 + fi + ;; + *) + DIST=$DIST$SUF + ;; +esac + +# SRPM abolute path case $DIST in + *x) mocketc=/home/rpmbuild/SPECS/remirepo/tools/mock srpmdir=/home/rpmbuild/site/rpms/SRPMS @@ -61,6 +92,7 @@ elif [ ! -f $SRPM ]; then exit 1 fi +# PHP version matrix echo mockit $SRPM $DIST $MIN $MAX $@ case $DIST in fc38x|fc39x|fc39a|fc40x|fc40a|el9x|el9a) @@ -87,6 +119,7 @@ esac ID=${QUEUE:-$PPID} +# Build base/modules [ $BUILD_BASE -ge 1 ] && for i in $LST do if [ 0$i -ge $MIN -a 0$i -le $MAX ]; then @@ -99,6 +132,7 @@ do fi fi done +# Build Software Collections [ $BUILD_SCLS -ge 1 ] && for i in $SCL do if [ 0$i -ge $MIN -a 0$i -le $MAX ]; then -- cgit