Skip to content

Instantly share code, notes, and snippets.

@Anachron
Last active February 10, 2019 14:26
Show Gist options
  • Save Anachron/99a5102bced07ce645674df826345d0a to your computer and use it in GitHub Desktop.
Save Anachron/99a5102bced07ce645674df826345d0a to your computer and use it in GitHub Desktop.
xbuilders: Print build status of xbps builders
#!/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
@Anachron
Copy link
Author

Anachron commented Jan 25, 2019

Example:

Name                Cur.  Rem.
aarch64-musl        0     41
aarch64             0     42
armv6l-musl         0     42
armv6l              0     42
armv7l-musl         0     42
armv7l              0     42
cross-aarch64-musl  0     0
cross-aarch64       0     0
i686                0     42
x86_64-musl         0     42
x86_64              0     42

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment