From 9fc98148d850b35f9e47e33188639424dfa89e48 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 19 Apr 2024 11:47:03 +0200 Subject: add redis queue to mockit/mockrun --- mockit | 31 ++++++++++++++++++++++++++----- 1 file changed, 26 insertions(+), 5 deletions(-) (limited to 'mockit') diff --git a/mockit b/mockit index 783500b..907e79c 100755 --- a/mockit +++ b/mockit @@ -7,6 +7,7 @@ fi BUILD_BASE=1 BUILD_SCLS=1 +REDIS=0 if [ "$1" == "--nobase" -o "$1" == "--scl" ]; then BUILD_BASE=0 @@ -16,6 +17,12 @@ if [ "$1" == "--noscl" -o "$1" == "--base" ]; then BUILD_SCLS=0 shift fi +if [ "$1" == "--redis" ]; then + CHECK=$(redis-cli ping) + [ "$CHECK" = "PONG" ] || exit 1 + REDIS=1 + shift +fi SRPM=$1 DIST=$2 @@ -81,16 +88,30 @@ ID=${QUEUE:-$PPID} [ $BUILD_BASE -ge 1 ] && for i in $LST do if [ 0$i -ge $MIN -a 0$i -le $MAX ]; then - echo -n "$(date +%X) $i " - mock -q --configdir=$mocketc --uniqueext=$ID -r ${DIST}${i} rebuild $SRPM "$@" && echo " Ok." || echo " Error !" + CMD="mock -q --configdir=$mocketc -r ${DIST}${i} rebuild $SRPM $@" + if [ $REDIS -ge 1 ]; then + redis-cli sadd mock "$CMD" + else + echo -n "$(date +%X) $i " + $CMD --uniqueext=$ID && echo " Ok." || echo " Error !" + fi fi done [ $BUILD_SCLS -ge 1 ] && for i in $SCL do if [ 0$i -ge $MIN -a 0$i -le $MAX ]; then - echo -n "$(date +%X) scl$i " - mock -q --configdir=$mocketc --uniqueext=$ID -r ${DIST}scl${i} rebuild $SRPM "$@" && echo " Ok." || echo " Error !" + CMD="mock -q --configdir=$mocketc -r ${DIST}scl${i} rebuild $SRPM $@" + if [ $REDIS -ge 1 ]; then + redis-cli sadd mock "$CMD" + else + echo -n "$(date +%X) scl$i " + $CMD --uniqueext=$ID && echo " Ok." || echo " Error !" + fi fi done -date +%X +if [ $REDIS -ge 1 ]; then + echo "Queue size: " $(redis-cli scard mock) +else + date +%X +fi -- cgit