diff options
author | Erich Eckner <git@eckner.net> | 2018-03-01 19:03:27 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-03-01 19:03:27 +0100 |
commit | 9ef68780beab5634b7b322bcb731ba5c9aec0350 (patch) | |
tree | 9cc07e2b897c101f18c98c75ad0ba24d81c7029b /lib | |
parent | 48c7a60e79436c320627740c1cf5a7bc85a8fe96 (diff) | |
download | builder-9ef68780beab5634b7b322bcb731ba5c9aec0350.tar.xz |
lib/mysql-functions: mysql_run_query: only log if sane
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/mysql-functions | 42 |
1 files changed, 23 insertions, 19 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions index d8ffeb5..a84d74c 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -25,28 +25,32 @@ base64_encode_each() { # mysql_run_query # wrapper function to query mysql mysql_run_query() { - { - printf '%s %s: ' "$0" "${mysql_command} $*" - date - } \ - | tee -a "${work_dir}/mysql.stdin" \ - | tee -a "${work_dir}/mysql.stdout" \ - >> "${work_dir}/mysql.stderr" - tee -a "${work_dir}/mysql.stdin" \ - | ${mysql_command} "$@" \ - 2>> "${work_dir}/mysql.stderr" \ - | tee -a "${work_dir}/mysql.stdout" - for s in \ - "${work_dir}/mysql.stdin" \ - "${work_dir}/mysql.stdout" \ - "${work_dir}/mysql.stderr"; do + if [ -s "${work_dir}/build-master-sanity" ]; then + ${mysql_command} "$@" + else { - tail -n 10000 "$s" - printf '%s %s done: ' "$0" "${mysql_command} $*" + printf '%s %s: ' "$0" "${mysql_command} $*" date } \ - | sponge "$s" - done + | tee -a "${work_dir}/mysql.stdin" \ + | tee -a "${work_dir}/mysql.stdout" \ + >> "${work_dir}/mysql.stderr" + tee -a "${work_dir}/mysql.stdin" \ + | ${mysql_command} "$@" \ + 2>> "${work_dir}/mysql.stderr" \ + | tee -a "${work_dir}/mysql.stdout" + for s in \ + "${work_dir}/mysql.stdin" \ + "${work_dir}/mysql.stdout" \ + "${work_dir}/mysql.stderr"; do + { + tail -n 10000 "$s" + printf '%s %s done: ' "$0" "${mysql_command} $*" + date + } \ + | sponge "$s" + done + fi } # mysql_add_package_source $pkgbase $git_revision $mod_git_revision $upstream_package_repository |