Commit 5b531f1e authored by Vitaly Lipatov's avatar Vitaly Lipatov

rpmbs: improve task and subtask handling

parent f34bf628
......@@ -256,14 +256,22 @@ if [ -n "$UPLOADNOW" ] && is_gear $SPECDIR ; then
# assure we have only specs or src.rpm
LISTNAMES=$(repodirs_to_specs $LISTNAMES)
NUMSPECS=$(estrlist count $LISTNAMES)
# if more then one spec, use common task
if [ $NUMSPECS -gt 1 ] && [ -z "$PREPARETASK" ] ; then
PREPARETASK=internal
# FIXME: no pocket support on git.eter task new?
showcmd ssh $GEARHOST task new $BINARYREPO
TASKNUMBER=$(ssh $GEARHOST task new $BINARYREPO | head -n1) || fatal
[ -n "$TASKNUMBER" ] || fatal "Can't get task number from $GEARHOST"
if [ -n "$PREPARETASK" ] ; then
if [ -z "$TASKNUMBER" ] ; then
showcmd "ssh $GEARHOST task ls"
TASKNUMBER="$(ssh $GEARHOST task ls | head -n1 | sed -e "s|^#\([0-9]*\) .*|\1|g")" || fatal
# hack "
fi
else
NUMSPECS=$(estrlist count $LISTNAMES)
# if more then one spec, use common task
if [ $NUMSPECS -gt 1 ] ; then
PREPARETASK=internal
# FIXME: no pocket support on git.eter task new?
showcmd ssh $GEARHOST task new $BINARYREPO
TASKNUMBER=$(ssh $GEARHOST task new $BINARYREPO | head -n1) || fatal
[ -n "$TASKNUMBER" ] || fatal "Can't get task number from $GEARHOST"
fi
fi
for ln in $LISTNAMES ; do
......@@ -300,6 +308,14 @@ if [ -n "$UPLOADNOW" ] && is_gear $SPECDIR ; then
echo "Run build $PROJECTNAME at $GEARHOST"
# FIXME: tee hangup during first call with ssh ControlMaster
if [ -n "$PREPARETASK" ] ; then
showcmd "GIT_ALT=$GEARHOST girar-show $TASKNUMBER@"
SUBTASK="$(GIT_ALT=$GEARHOST girar-show $TASKNUMBER@ | grep "/$PROJECTNAME.git" | sed -e "s|.*#\([0-9]*\) .*|\1|g")"
# hack "
if [ -n "$SUBTASK" ] && ! echo "$TASKNUMBER" | grep -q " " ; then
info "$PROJECTNAME already in task as subtask $SUBTASK, replacing"
docmd ssh $GEARHOST task delsub $TASKNUMBER $SUBTASK
TASKNUMBER="$TASKNUMBER $SUBTASK"
fi
docmd ssh $GEARHOST task add $TASKNUMBER repo $PROJECTNAME $TAG 2>&1 | tee $RPMDIR/uploaded.log.tmp
else
docmd ssh $GEARHOST build $(usearg -b $BINARYREPO sisyphus) $(usearg -p $POCKET) $PROJECTNAME $TAG 2>&1 | tee $RPMDIR/uploaded.log.tmp
......@@ -314,6 +330,13 @@ if [ -n "$UPLOADNOW" ] && is_gear $SPECDIR ; then
cd - >/dev/null
done
if [ -n "$TASKNUMBER" ] ; then
# TODO: separate TASKNUMBER and SUBTASKNUMBER
RTASKNUMBER=$(echo "$TASKNUMBER" | sed -e "s| .*||g")
showcmd "GIT_ALT=$GEARHOST girar-show $RTASKNUMBER@"
GIT_ALT=$GEARHOST girar-show "$RTASKNUMBER@"
fi
# if more then one spec, use common task
if [ "$PREPARETASK" = "internal" ] ; then
docmd ssh $GEARHOST task run $TASKNUMBER
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment