summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-04-07 09:10:15 +0200
committerErich Eckner <git@eckner.net>2021-04-07 09:10:15 +0200
commit661201a53dce2b2133228509a9f3cc5095ef00d1 (patch)
tree83730a18bef15fccc19b59f0147c04d80d4d3ca1 /lib
parent7a2755a6a254c6dbaec952f71b4e807b33ed186e (diff)
downloadbuilder-661201a53dce2b2133228509a9f3cc5095ef00d1.tar.xz
lib/mysql-functions: fail early, if mysql_retrieve_static_information() did not find an expected variable in the database
Diffstat (limited to 'lib')
-rwxr-xr-xlib/mysql-functions8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 1706c11..6a6a1e7 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -1440,6 +1440,7 @@ mysql_join_dependencies_install_target_providers_with_versions() {
# - ids of compressions -> $compression_ids__$compression
# - $package_compression_suffix_regex
mysql_retrieve_static_information() {
+ local found_something
eval "$(
{
printf 'SELECT CONCAT('
@@ -1514,8 +1515,15 @@ mysql_retrieve_static_information() {
printf '"\\""'
printf ') FROM `compressions`;\n'
} \
+ | sed '
+ s@^\(SELECT \)\(.*\)$@SELECT "found_something=false;"; \1"found_something=true; ",\2 SELECT "if ! ${found_something}; then >\&2 echo \\"Some variable was not found in the database.\\"; exit 1; fi;";@
+ ' \
| mysql_run_query
)"
+ if ! ${found_something}; then
+ >&2 echo 'No variables were found in the database.'
+ exit 1
+ fi
}
# mysql_query_and_delete_unneeded_binary_packages