Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/mysql-functions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mysql-functions')
-rwxr-xr-xlib/mysql-functions122
1 files changed, 122 insertions, 0 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index e4a22d1..52b3fc1 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -1083,6 +1083,128 @@ mysql_query_has_pending_dependencies() {
printf ')'
}
+# mysql_query_generate_packages_with_pending_dependencies
+# print the query to generate the temporary table
+# `packages_with_pending_dependencies`
+mysql_query_generate_packages_with_pending_dependencies() {
+ printf 'CREATE TEMPORARY TABLE `install_target_statuses`('
+ printf '`id` BIGINT NOT NULL,'
+ printf '`version_relation` VARCHAR(2) NOT NULL,'
+ printf '`version_order` BIGINT NOT NULL,'
+ printf '`builder_architecture` SMALLINT NOT NULL,'
+ printf '`exists_built` BIT NOT NULL,'
+ printf '`exists_unbuilt` BIT NOT NULL,'
+ printf 'UNIQUE KEY `content`(`id`,`builder_architecture`),'
+ printf 'KEY(`id`),'
+ printf 'KEY(`builder_architecture`)'
+ printf ');\n'
+
+ printf 'INSERT IGNORE INTO `install_target_statuses`('
+ printf '`id`,'
+ printf '`version_relation`,'
+ printf '`version_order`,'
+ printf '`builder_architecture`,'
+ printf '`exists_built`,'
+ printf '`exists_unbuilt`'
+ printf ') SELECT '
+ printf '`dependencies`.`%s`,' \
+ 'depending_on' \
+ 'version_relation'
+ printf '`versions`.`order`,'
+ printf '`architectures`.`id`,0,0'
+ printf ' FROM `dependencies`'
+ mysql_join_dependencies_versions
+ printf ' JOIN `architectures`;\n'
+
+ printf 'UPDATE `install_target_statuses`'
+ mysql_join_install_targets_install_target_providers 'install_target_statuses'
+ mysql_join_install_target_providers_versions
+ printf ' AND'
+ mysql_query_ordering_correct \
+ '`install_target_statuses`.`version_order`' \
+ '`versions`.`order`' \
+ '`install_target_statuses`.`version_relation`'
+ mysql_join_install_target_providers_binary_packages
+ printf ' AND ('
+ printf '`binary_packages`.`architecture`=`install_target_statuses`.`builder_architecture`'
+ printf ' OR `binary_packages`.`architecture`=%s' \
+ "${architecture_ids__any}"
+ printf ' OR `install_target_statuses`.`builder_architecture`=%s' \
+ "${architecture_ids__any}"
+ printf ')'
+ mysql_join_binary_packages_binary_packages_in_repositories
+ printf ' SET `install_target_statuses`.`exists_unbuilt`=1'
+ printf ' WHERE `binary_packages_in_repositories`.`repository`=%s;\n' \
+ "${repository_ids__any_build_list}"
+
+ printf 'UPDATE `install_target_statuses`'
+ mysql_join_install_targets_install_target_providers 'install_target_statuses'
+ mysql_join_install_target_providers_versions
+ printf ' AND'
+ mysql_query_ordering_correct \
+ '`install_target_statuses`.`version_order`' \
+ '`versions`.`order`' \
+ '`install_target_statuses`.`version_relation`'
+ mysql_join_install_target_providers_binary_packages
+ printf ' AND ('
+ printf '`binary_packages`.`architecture`=`install_target_statuses`.`builder_architecture`'
+ printf ' OR `binary_packages`.`architecture`=%s' \
+ "${architecture_ids__any}"
+ printf ' OR `install_target_statuses`.`builder_architecture`=%s' \
+ "${architecture_ids__any}"
+ printf ')'
+ mysql_join_binary_packages_binary_packages_in_repositories
+ mysql_join_binary_packages_in_repositories_repositories
+ printf ' SET `install_target_statuses`.`exists_built`=1'
+ printf ' WHERE `repositories`.`is_on_master_mirror`;\n'
+
+ printf 'CREATE TEMPORARY TABLE `packages_with_pending_dependencies`('
+ printf '`builder_architecture` SMALLINT NOT NULL,'
+ printf '`build_assignment` BIGINT NOT NULL,'
+ printf 'UNIQUE KEY `content`(`builder_architecture`,`build_assignment`),'
+ printf 'KEY(`builder_architecture`),'
+ printf 'KEY(`build_assignment`)'
+ printf ');\n'
+
+ printf 'INSERT IGNORE INTO `packages_with_pending_dependencies`('
+ printf '`builder_architecture`,'
+ printf '`build_assignment`'
+ printf ') SELECT'
+ printf ' `install_target_statuses`.`builder_architecture`,'
+ printf '`build_assignments`.`id`'
+ printf ' FROM `install_target_statuses`'
+ printf ' JOIN `install_targets`'
+ printf ' ON `install_targets`.`id`=`install_target_statuses`.`id`'
+ mysql_join_install_targets_dependencies
+ printf ' AND `dependencies`.`version_relation`=`install_target_statuses`.`version_relation`'
+ mysql_join_dependencies_versions
+ printf ' AND `versions`.`order`=`install_target_statuses`.`version_order`'
+ mysql_join_dependencies_dependency_types
+ printf ' AND `dependency_types`.`relevant_for_building`'
+ printf ' AND ('
+ printf 'NOT `install_target_statuses`.`exists_built`'
+ printf 'OR ('
+ printf '`install_target_statuses`.`exists_unbuilt`'
+ printf ' AND ('
+ printf '`dependency_types`.`relevant_for_binary_packages`'
+ printf ' OR `install_targets`.`name` LIKE "haskell-%%"'
+ printf ')'
+ printf ')'
+ printf ')'
+ mysql_join_dependencies_binary_packages
+ mysql_join_binary_packages_binary_packages_in_repositories
+ printf ' AND `binary_packages_in_repositories`.`repository`=%s' \
+ "${repository_ids__any_build_list}"
+ mysql_join_binary_packages_build_assignments
+ printf ' WHERE `build_assignments`.`architecture`=`install_target_statuses`.`builder_architecture`'
+ printf ' OR `build_assignments`.`architecture`=%s' \
+ "${architecture_ids__any}"
+ printf ' OR `install_target_statuses`.`builder_architecture`=%s' \
+ "${architecture_ids__any}"
+ printf ';\n'
+ printf 'DROP TEMPORARY TABLE `install_target_statuses`;\n'
+}
+
# mysql_query_is_part_of_loop `build_assignment`.`id`
# print a mysql query giving whether the package is part of a loop
mysql_query_is_part_of_loop() {