summaryrefslogtreecommitdiff
path: root/bin/sanity-check
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-06-23 13:28:38 +0200
committerErich Eckner <git@eckner.net>2017-06-23 13:28:38 +0200
commit3a92880a3011e29422902a01f3f23fa39aa4497f (patch)
tree054bed1d26e2eb60bbac07b3cfcdc5521b725f5f /bin/sanity-check
parent0d87c7936d80abbc271bbd2ef813136ccdf03736 (diff)
downloadbuilder-3a92880a3011e29422902a01f3f23fa39aa4497f.tar.xz
bin/sanity-check: basic build-list check new
Diffstat (limited to 'bin/sanity-check')
-rwxr-xr-xbin/sanity-check41
1 files changed, 39 insertions, 2 deletions
diff --git a/bin/sanity-check b/bin/sanity-check
index 5395466..4700ed9 100755
--- a/bin/sanity-check
+++ b/bin/sanity-check
@@ -54,13 +54,50 @@ tmp_dir="$(mktemp -d)"
trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
if [ $# -eq 0 ]; then
- set -- repos package-database state-files
+ set -- build-list repos package-database state-files
fi
while [ $# -gt 0 ]; do
case "$1" in
+ build-list)
+
+ [ ${silence} -gt 0 ] || \
+ >&2 printf 'sanity-check: checking build-list ...'
+
+ errors="$(
+ grep -vn '^\S\+ [0-9a-f]\{40\} [0-9a-f]\{40\} \S\+$\|^break_loops$' "${work_dir}/build-list"
+ )" || true
+ if [ -n "${errors}" ]; then
+ if [ ${silence} -le 1 ]; then
+ echo
+ echo "The following build orders are wrongly formatted:"
+ echo "${errors}"
+ fi
+ exit 1
+ fi
+
+ errors="$(
+ grep -vxF 'break_loops' "${work_dir}/build-list" | \
+ awk '{print $1}' | \
+ sort | \
+ uniq -d
+ )"
+ if [ -n "${errors}" ]; then
+ if [ ${silence} -le 1 ]; then
+ echo
+ echo "The following packages have duplicate build orders:"
+ echo "${errors}"
+ fi
+ exit 1
+ fi
+
+ [ ${silence} -gt 0 ] || \
+ >&2 echo ' passed.'
+
+ ;;
+
repos)
[ ${silence} -gt 0 ] || \
@@ -218,7 +255,7 @@ while [ $# -gt 0 ]; do
*)
[ ${silence} -gt 1 ] || \
- >&2 printf 'sanity-check: unknown check "%s".' "$1"
+ >&2 printf 'sanity-check: unknown check "%s".\n' "$1"
exit 2
;;