Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-13 14:09:43 +0200
committerErich Eckner <git@eckner.net>2018-09-13 14:09:43 +0200
commit24850d103f396ee5faff5eb4b6e0c53a7b589249 (patch)
tree6ab619327542b2ad78e7942e73a54a9a5f5f84b2
parent501bc41303280811927a330720665a2c41fd9074 (diff)
lib/mysql-functions: mysql_query_ordering_correct() new
-rwxr-xr-xlib/mysql-functions65
1 files changed, 32 insertions, 33 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index c5ffa78..3874b3a 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -1014,26 +1014,14 @@ done
# mysql_join_dependencies_install_target_providers_with_versions() also
# join via `versions`
mysql_join_install_target_providers_dependencies_with_versions() {
- local relation
mysql_join_install_target_providers_dependencies "$1" "$2"
mysql_join_install_target_providers_versions "$1" "${1:-install_target_providers}_versions"
mysql_join_dependencies_versions "$2" "${2:-dependencies}_versions"
- printf ' AND ('
- for relation in '<' '<=' '>' '>=' '='; do
- printf '('
- printf '`%s`.`version_relation`="%s"' \
- "${2:-dependencies}" \
- "${relation}"
- printf ' AND `%s`.`order`%s`%s`.`order`' \
- "${1:-install_target_providers}_versions" \
- "${relation}" \
- "${2:-dependencies}_versions"
- printf ') OR '
- done | \
- sed '
- s/ OR $//
- '
- printf ')'
+ printf ' AND '
+ mysql_query_ordering_correct \
+ '`'"${2:-dependencies}_versions"'`.`order`' \
+ '`'"${1:-install_target_providers}_versions"'`.`order`' \
+ '`'"${2:-dependencies}"'`.`version_relation`'
}
mysql_join_dependencies_install_target_providers_with_versions() {
@@ -1041,22 +1029,11 @@ mysql_join_dependencies_install_target_providers_with_versions() {
mysql_join_dependencies_install_target_providers "$1" "$2"
mysql_join_install_target_providers_versions "$2" "${2:-install_target_providers}_versions"
mysql_join_dependencies_versions "$1" "${1:-dependencies}_versions"
- printf ' AND ('
- for relation in '<' '<=' '>' '>=' '='; do
- printf '('
- printf '`%s`.`version_relation`="%s"' \
- "${1:-dependencies}" \
- "${relation}"
- printf ' AND `%s`.`order`%s`%s`.`order`' \
- "${2:-install_target_providers}_versions" \
- "${relation}" \
- "${1:-dependencies}_versions"
- printf ') OR '
- done | \
- sed '
- s/ OR $//
- '
- printf ')'
+ printf ' AND '
+ mysql_query_ordering_correct \
+ '`'"${2:-dependencies}_versions"'`.`order`' \
+ '`'"${1:-install_target_providers}_versions"'`.`order`' \
+ '`'"${2:-dependencies}"'`.`version_relation`'
}
# mysql_retrieve_static_information
@@ -1256,3 +1233,25 @@ mysql_query_remove_old_binary_packages_from_build_list() {
printf ')'
printf ');\n'
}
+
+# mysql_query_ordering_correct dependency.version.order install_target_provider.version.order dependency.version_relation
+# print a query yielding wether the ordering is correct
+mysql_query_ordering_correct() {
+ local relation
+ printf '('
+ for relation in '<' '<=' '>' '>=' '='; do
+ printf '('
+ printf '%s="%s"' \
+ "${3}" \
+ "${relation}"
+ printf ' AND %s%s%s' \
+ "${2}" \
+ "${relation}" \
+ "${1}"
+ printf ') OR '
+ done | \
+ sed '
+ s/ OR $//
+ '
+ printf ')'
+}