Last active
February 10, 2019 14:26
-
-
Save Anachron/99a5102bced07ce645674df826345d0a to your computer and use it in GitHub Desktop.
xbuilders: Print build status of xbps builders
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env sh | |
if test "$#" -eq 0 && test -z "${NOCOLOR}" && test -z "${XB_COLORIZE}"; then | |
export XB_COLORIZE=1 | |
"${0}" \ | |
| sed -e 's|\b\(0\)\b|\\033\[0\;2m\1\\033\[0m|g' \ | |
| sed -e 's|\b\([1-9]\)\b|\\033\[0\;32m\1\\033\[0m|g' \ | |
| sed -e 's|\b\([0-9]\{2\}\)\b|\\033\[0\;31m\1\\033\[0m|g' >/tmp/xbf | |
printf '%b\n' "$(cat /tmp/xbf)" | |
rm -f /tmp/xbf | |
exit | |
fi | |
if test "$#" -gt 0; then | |
builder="${1}" | |
binf=$(curl -s "https://build.voidlinux.org/json/builders/${builder}_builder") | |
#printf '%s\n' "${binf}" | jq; exit | |
curb=$(printf '%s\n' "${binf}" | jq '.currentBuilds[]') | |
penb=$(printf '%s\n' "${binf}" | jq '.pendingBuilds') | |
#printf '%s|%s\n' "${curb}" "${penb}"; exit | |
cbi=$(curl -s "https://build.voidlinux.org/json/builders/${builder}_builder/builds/${curb}") | |
clog=$(printf '%s\n' "${cbi}" | jq '.sourceStamps[0].changes[] | .comments') | |
printf 'Builder: %s\n\nCurrent:\n%s\n\nPending: %s\n' "${builder}" "${clog}" "${penb}" | |
else | |
stat=$(curl -s "https://build.voidlinux.org/json/builders") | |
bld=$(printf '%s' "${stat}" | grep -o '"[a-z0-9\_-]*builder"' | sort -u) | |
for b in ${bld}; do | |
penb=$(printf '%s' "${stat}" | jq ".[${b}] | {pendingBuilds}[] | length") | |
curb=$(printf '%s' "${stat}" | jq ".[${b}] | {currentBuilds}[] | length") | |
b=$(printf '%s' "${b}" | tr -d '"' | sed 's|\_builder||g') | |
test -z "${h}" && h=1 && printf 'Name Cur. Pen.\n' | |
printf '%s %b %b\n' "${b}" "${curb}" "${penb}" | |
done | column -t | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Example: