From 3a92880a3011e29422902a01f3f23fa39aa4497f Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 23 Jun 2017 13:28:38 +0200 Subject: bin/sanity-check: basic build-list check new --- bin/sanity-check | 41 +++++++++++++++++++++++++++++++++++++++-- 1 file changed, 39 insertions(+), 2 deletions(-) (limited to 'bin/sanity-check') 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 ;; -- cgit v1.2.3-54-g00ecf