From bbf4339a3bd6c188861b74c4fdd3f3ffa2aa5b5e Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 10 Oct 2017 10:22:29 +0200 Subject: bin/sanity-check: check git repositories --- bin/sanity-check | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/bin/sanity-check b/bin/sanity-check index 34c4df0..5ea844a 100755 --- a/bin/sanity-check +++ b/bin/sanity-check @@ -62,13 +62,39 @@ tmp_dir=$(mktemp -d) trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT if [ $# -eq 0 ]; then - set -- build-list repos package-database state-files + set -- git-repositories build-list repos package-database state-files fi while [ $# -gt 0 ]; do case "$1" in + git-repositories) + + [ ${silence} -gt 0 ] || \ + >&2 printf 'checking git repositories ...' + + for repo in ${repo_names}; do + eval 'repo_path="${repo_paths__'"${repo}"'}"' + repo_revision=$( + cat "${work_dir}/${repo}.revision" + ) + if ! git -C "${repo_path}" archive "${repo_revision}" -- | \ + tar -t > /dev/null; then + if [ ${silence} -le 1 ]; then + echo + printf 'The repository %s (%s) cannot archive the current revision %s.\n' \ + "${repo}" "${repo_path}" "${repo_revision}" + fi + i_am_insane + fi + done + + [ ${silence} -gt 0 ] || \ + >&2 echo ' passed.' + + ;; + build-list) [ ${silence} -gt 0 ] || \ -- cgit v1.2.3