Hash :
375a0093
Author :
Thomas de Grivel
Date :
2023-02-15T15:16:01
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
#!/bin/sh
set -e
# shpkg
: ${SHPKG_DIR:=~/shpkg}
. "${SHPKG_DIR}/etc/shpkg/profile"
. "${SHPKG_DIR}/share/shpkg/shpkg.subr"
verbose 2 shpkg_config
verbose 2 shpkg_lock shpkg_ci_mux.lock
# Configuration
: ${SHPKG_CI_DIR:=${SHPKG_DIR}/ci}
shpkg_ci_remote () {
verbose 1 ssh "$1" sh -c "\"shpkg/bin/shpkg_ci '$2'\""
if [ "x$2" == "x--clean" ]; then
rm -rf "${SHPKG_CI_DIR}"
else
if [ "x$2" != "x--upgrade" ]; then
verbose 1 rsync -a "$1":shpkg/ci/. "${SHPKG_CI_DIR}/"
fi
fi
}
main () {
SHPKG_REPO="$1"
shift
for SHPKG_CI_MUX_HOST; do
shpkg_ci_remote "${SHPKG_CI_MUX_HOST}" "${SHPKG_REPO}" &
done
for SHPKG_CI_MUX_HOST; do
wait
done
if [ "x${SHPKG_REPO}" == "x--upgrade" ] ||
[ "x${SHPKG_REPO}" == "x--clean" ]; then
exit
fi
( cd "${SHPKG_CI_DIR}/status" &&
for S in $(ls */*/*.status | cut -d / -f 3 | sort -u); do
{
if grep -q running */*/"$S"; then
echo running
elif grep -q ko */*/"$S"; then
echo ko
else
echo ok
fi
} > "${SHPKG_CI_DIR}/status/$S"
done; )
}
shpkg_log shpkg_ci_mux main "$@"