Hash :
bec74f31
Author :
Thomas de Grivel
Date :
2023-02-14T13:49:15
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 60 61 62 63 64 65 66 67 68 69
#!/bin/sh
set -e
. ~/shpkg/etc/shpkg/profile
. ~/shpkg/share/shpkg/shpkg.subr
shpkg_lock shpkg_ci.lock
logs2html () (
cd ~/"www/log/${SHPKG_TARGET}/txt"
for F in "${SHPKG_REPO}".*.log; do
if [ "$F" -nt "../html/$F.html" ]; then
verbose 1 ansi2html "$F"
fi
done
verbose 1 mv ~/www/log/"${SHPKG_TARGET}"/txt/*.html ~/www/log/"${SHPKG_TARGET}"/html/ || true
)
main () {
verbose 2 shpkg_config
SHPKG_CI_STATUS=0
if ! [ -d ~/"www/log/${SHPKG_TARGET}/txt" ]; then
verbose 1 mkdir -p ~/"www/log/${SHPKG_TARGET}/txt"
fi
if ! [ -d ~/"www/log/${SHPKG_TARGET}/html" ]; then
verbose 1 mkdir -p ~/"www/log/${SHPKG_TARGET}/html"
fi
for SHPKG_REPO; do
SHPKG_REPO_DIR="$(shpkg_dir "${SHPKG_REPO}")"
if [ "x${SHPKG_REPO_DIR}" = "x" ]; then
err 1 "shpkg_ci: unknown repo: $SHPKG_REPO"
fi
shpkg_tag_log "${SHPKG_REPO}.ci.log"
# first bootstrap
if ! [ -d ~/"shpkg_${SHPKG_REPO}" ]; then
( verbose 2 shpkg_bootstrap ~/"shpkg_${SHPKG_REPO}"; )
else
# check upgrade
( . ~/"shpkg_${SHPKG_REPO}/etc/shpkg/profile"
if ! verbose 2 shpkg upgrade "${SHPKG_REPO}"; then
SHPKG_CI_STATUS=10
fi; )
if verbose 1 cp -p ~/"shpkg_${SHPKG_REPO}/var/log/shpkg/tags/${SHPKG_REPO}".*.log ~/"www/log/${SHPKG_TARGET}/txt"; then
verbose 2 logs2html
fi
fi
( verbose 2 shpkg_bootstrap -f ~/"shpkg_${SHPKG_REPO}"; )
( . ~/"shpkg_${SHPKG_REPO}/etc/shpkg/profile"
if ! verbose 2 shpkg install "${SHPKG_REPO}"; then
SHPKG_CI_STATUS=10
fi; )
SHPKG_CI_COPY=No
if verbose 1 cp -p ~/"shpkg_${SHPKG_REPO}/var/log/shpkg/tags/${SHPKG_REPO}".*.log ~/"www/log/${SHPKG_TARGET}/txt"; then
SHPKG_CI_COPY=Yes
fi
if verbose 1 cp -p ~/"shpkg/var/log/shpkg/tags/${SHPKG_REPO}.ci.log" ~/"www/log/${SHPKG_TARGET}/txt"; then
SHPKG_CI_COPY=Yes
fi
if [ "x${SHPKG_CI_COPY}" = "xYes" ]; then
verbose 2 logs2html
fi
done
}
shpkg_log shpkg_ci main "$@"
exit ${SHPKG_CI_STATUS}