summaryrefslogtreecommitdiff
path: root/bin/sanity-check
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2017-10-10 10:22:29 +0200
committerErich Eckner <git@eckner.net>2017-10-10 10:22:29 +0200
commitbbf4339a3bd6c188861b74c4fdd3f3ffa2aa5b5e (patch)
tree526a70fd647c7af0fb6b58879f00a60be0274fbc /bin/sanity-check
parentac149ed01c5fc6d36a9f14cb7b3ed0127fd4490b (diff)
downloadbuilder-bbf4339a3bd6c188861b74c4fdd3f3ffa2aa5b5e.tar.xz
bin/sanity-check: check git repositories
Diffstat (limited to 'bin/sanity-check')
-rwxr-xr-xbin/sanity-check28
1 files changed, 27 insertions, 1 deletions
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 ] || \