Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/strict-bashism-check
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-03-14 10:52:58 +0100
committerErich Eckner <git@eckner.net>2018-03-14 10:52:58 +0100
commit254ba8ac7e63d024da55f459a9d9d76c65e8d3ce (patch)
tree05a9387bb63ccbd1f310460d1d899b83eee2553f /bin/strict-bashism-check
parent73409ac0d623289da164be28c78286434ab4706e (diff)
bin/strict-bashism-check: add some check for "mysql buildmaster"
Diffstat (limited to 'bin/strict-bashism-check')
-rwxr-xr-xbin/strict-bashism-check21
1 files changed, 16 insertions, 5 deletions
diff --git a/bin/strict-bashism-check b/bin/strict-bashism-check
index fa073b8..1d7c2be 100755
--- a/bin/strict-bashism-check
+++ b/bin/strict-bashism-check
@@ -49,14 +49,27 @@ trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
git archive "${tree}" | \
tar -C "${tmp_dir}" -x
+if ! cd "${tmp_dir}"; then
+ echo 'Cannot cd.'
+ exit 1
+fi
+
errors=$(
- cd "${tmp_dir}" || \
- echo 'Cannot cd.'
find bin conf lib -type f -not -executable -not -name '.gitignore'
)
if [ -n "${errors}" ]; then
- >&2 echo 'Non-executable files found in bin/ or conf/:'
+ >&2 echo 'Non-executable files found in bin/, conf/ or lib/:'
+ >&2 echo "${errors}"
+ exit 1
+fi
+
+errors=$(
+ grep -r '\(\s\|^\)mysql buildmaster\($\|\s\)' bin lib conf
+)
+
+if [ -n "${errors}" ]; then
+ >&2 echo 'Style error: call "mysql_run_query" instead of "mysql buildmaster":'
>&2 echo "${errors}"
exit 1
fi
@@ -74,8 +87,6 @@ fi
if which shellcheck >/dev/null 2>&1; then
errors=$(
- cd "${tmp_dir}" || \
- echo 'Cannot cd.'
shellcheck -x bin/* conf/* 2>&1
)