summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-10 08:37:07 +0200
committerErich Eckner <git@eckner.net>2018-09-10 08:37:07 +0200
commit1c608353d51ad59d9fafbc71067c988ce7a584d1 (patch)
tree034e7a506757041efb124711f0310581296ca373 /bin
parent53052b9a9dc8ccfa69f6d9a847714d3d3fb26d6d (diff)
downloadbuilder-1c608353d51ad59d9fafbc71067c988ce7a584d1.tar.xz
bin/sanity-check: print immediately to stderr
Diffstat (limited to 'bin')
-rwxr-xr-xbin/sanity-check96
1 files changed, 48 insertions, 48 deletions
diff --git a/bin/sanity-check b/bin/sanity-check
index 1069e17..8baa7cf 100755
--- a/bin/sanity-check
+++ b/bin/sanity-check
@@ -29,8 +29,8 @@ i_am_insane() {
fi
echo 'build master is insane' > \
"${work_dir}/build-master-sanity"
- echo 'SANITY CHECK FAILED' >> \
- "${tmp_dir}/messages"
+ echo 'SANITY CHECK FAILED' | \
+ tee -a "${tmp_dir}/messages" >&2
exit_code=1
}
@@ -137,8 +137,8 @@ while [ $# -gt 0 ]; do
git-repositories)
[ ${silence} -gt 0 ] || \
- printf 'checking git repositories ...' >> \
- "${tmp_dir}/messages"
+ printf 'checking git repositories ...' | \
+ tee -a "${tmp_dir}/messages" >&2
for repo in ${repo_names}; do
eval 'repo_path="${repo_paths__'"${repo}"'}"'
@@ -154,31 +154,31 @@ while [ $# -gt 0 ]; do
if ! obj_type=$(git -C "${repo_path}" cat-file -t "${repo_revision}" 2>/dev/null); then
if [ ${silence} -le 1 ]; then
printf '\nThe repository %s (%s) does not know the current revision %s.\n' \
- "${repo}" "${repo_path}" "${repo_revision}" >> \
- "${tmp_dir}/messages"
+ "${repo}" "${repo_path}" "${repo_revision}" | \
+ tee -a "${tmp_dir}/messages" >&2
fi
i_am_insane
elif [ "${obj_type}" != 'commit' ]; then
if [ ${silence} -le 1 ]; then
printf '\nThe repository %s (%s) knows the current revision %s, but it is not a commit, but a %s.\n' \
- "${repo}" "${repo_path}" "${repo_revision}" "${obj_type}" >> \
- "${tmp_dir}/messages"
+ "${repo}" "${repo_path}" "${repo_revision}" "${obj_type}" | \
+ tee -a "${tmp_dir}/messages" >&2
fi
i_am_insane
fi
done
[ ${silence} -gt 0 ] || \
- echo ' passed.' >> \
- "${tmp_dir}/messages"
+ echo ' passed.' | \
+ tee -a "${tmp_dir}/messages" >&2
;;
build-list)
[ ${silence} -gt 0 ] || \
- printf 'checking build-list ...' >> \
- "${tmp_dir}/messages"
+ printf 'checking build-list ...' | \
+ tee -a "${tmp_dir}/messages" >&2
errors=$(
# shellcheck disable=SC2016
@@ -202,8 +202,8 @@ while [ $# -gt 0 ]; do
if [ -n "${errors}" ]; then
if [ ${silence} -le 1 ]; then
printf '\nThe following packages have duplicate build orders:\n%s\n' \
- "${errors}" >> \
- "${tmp_dir}/messages"
+ "${errors}" | \
+ tee -a "${tmp_dir}/messages" >&2
fi
i_am_insane
fi
@@ -225,23 +225,23 @@ while [ $# -gt 0 ]; do
if [ -n "${errors}" ]; then
if [ ${silence} -le 1 ]; then
printf '\nThe following packages appear on the build- and deletion-list:\n%s\n' \
- "${errors}" >> \
- "${tmp_dir}/messages"
+ "${errors}" | \
+ tee -a "${tmp_dir}/messages" >&2
fi
i_am_insane
fi
[ ${silence} -gt 0 ] || \
- echo ' passed.' >> \
- "${tmp_dir}/messages"
+ echo ' passed.' | \
+ tee -a "${tmp_dir}/messages" >&2
;;
repos)
[ ${silence} -gt 0 ] || \
- printf 'checking repos on master mirror ...' >> \
- "${tmp_dir}/messages"
+ printf 'checking repos on master mirror ...' | \
+ tee -a "${tmp_dir}/messages" >&2
errors=$(
{
@@ -258,15 +258,15 @@ while [ $# -gt 0 ]; do
if [ -n "${errors}" ]; then
if [ ${silence} -le 1 ]; then
printf '\nThe following repos are missing or obsolete on the mirror:\n%s\n' \
- "${errors}" >> \
- "${tmp_dir}/messages"
+ "${errors}" | \
+ tee -a "${tmp_dir}/messages" >&2
fi
i_am_insane
fi
[ ${silence} -gt 0 ] || \
- echo ' passed.' >> \
- "${tmp_dir}/messages"
+ echo ' passed.' | \
+ tee -a "${tmp_dir}/messages" >&2
;;
@@ -276,8 +276,8 @@ while [ $# -gt 0 ]; do
for repo in ${repos}; do
[ ${silence} -gt 0 ] || \
- printf 'checking consistency of repository "%s/%s" on the master mirror ...' "${arch}" "${repo}" >> \
- "${tmp_dir}/messages"
+ printf 'checking consistency of repository "%s/%s" on the master mirror ...' "${arch}" "${repo}" | \
+ tee -a "${tmp_dir}/messages" >&2
packages=$(
ls_master_mirror "${arch}/${repo}" | \
@@ -300,8 +300,8 @@ while [ $# -gt 0 ]; do
if [ ${silence} -le 1 ]; then
printf '\nThe following packages in %s are missing a signature or vice versa:\n%s\n' \
"${repo}" \
- "${errors}" >> \
- "${tmp_dir}/messages"
+ "${errors}" | \
+ tee -a "${tmp_dir}/messages" >&2
fi
i_am_insane
fi
@@ -335,8 +335,8 @@ while [ $# -gt 0 ]; do
if [ ${silence} -le 1 ]; then
printf '\nThe following packages in %s are missing from the database or vice versa:\n%s\n' \
"${repo}" \
- "${errors}" >> \
- "${tmp_dir}/messages"
+ "${errors}" | \
+ tee -a "${tmp_dir}/messages" >&2
fi
i_am_insane
fi
@@ -364,8 +364,8 @@ while [ $# -gt 0 ]; do
if [ ${silence} -le 1 ]; then
printf '\nThe following packages in %s are missing from the file-database or vice versa:\n%s\n' \
"${repo}" \
- "${errors}" >> \
- "${tmp_dir}/messages"
+ "${errors}" | \
+ tee -a "${tmp_dir}/messages" >&2
fi
i_am_insane
fi
@@ -373,8 +373,8 @@ while [ $# -gt 0 ]; do
find "${tmp_dir:?}" -mindepth 1 \( -not -name 'messages' \) -delete
[ ${silence} -gt 0 ] || \
- echo ' passed.' >> \
- "${tmp_dir}/messages"
+ echo ' passed.' | \
+ tee -a "${tmp_dir}/messages" >&2
done
done
@@ -384,8 +384,8 @@ while [ $# -gt 0 ]; do
track-state)
[ ${silence} -gt 0 ] || \
- printf 'checking if all packages are tracked correctly ...' >> \
- "${tmp_dir}/messages"
+ printf 'checking if all packages are tracked correctly ...' | \
+ tee -a "${tmp_dir}/messages" >&2
errors=$(
{
@@ -419,23 +419,23 @@ while [ $# -gt 0 ]; do
if [ -n "${errors}" ]; then
if [ ${silence} -le 1 ]; then
printf '\nThe following packages from the master mirror are not tracked in the database or vice versa:\n%s\n' \
- "${errors}" >> \
- "${tmp_dir}/messages"
+ "${errors}" | \
+ tee -a "${tmp_dir}/messages" >&2
fi
i_am_insane
fi
[ ${silence} -gt 0 ] || \
- echo ' passed.' >> \
- "${tmp_dir}/messages"
+ echo ' passed.' | \
+ tee -a "${tmp_dir}/messages" >&2
;;
mysql)
[ ${silence} -gt 0 ] || \
- printf 'checking mysql-sanity ...' >> \
- "${tmp_dir}/messages"
+ printf 'checking mysql-sanity ...' | \
+ tee -a "${tmp_dir}/messages" >&2
mysql_sanity_check | \
sed '
@@ -463,8 +463,8 @@ while [ $# -gt 0 ]; do
if [ ${silence} -le 1 ]; then
printf '\nThere is something wrong with the database:\n'
cat "${webserver_directory}/mysql-sanity.html"
- fi >> \
- "${tmp_dir}/messages"
+ fi | \
+ tee -a "${tmp_dir}/messages" >&2
i_am_insane
fi
@@ -487,14 +487,14 @@ while [ $# -gt 0 ]; do
if [ ${silence} -le 1 ]; then
printf '\nThere are pending mysql queries:\n%s\n' \
"${errors}"
- fi >> \
- "${tmp_dir}/messages"
+ fi | \
+ tee -a "${tmp_dir}/messages" >&2
i_am_insane
fi
[ ${silence} -gt 0 ] || \
- echo ' passed.' >> \
- "${tmp_dir}/messages"
+ echo ' passed.' | \
+ tee -a "${tmp_dir}/messages" >&2
;;