diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/mysql-functions | 94 |
1 files changed, 60 insertions, 34 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions index 2725f03..3006262 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -687,42 +687,68 @@ mysql_sanity_check() { mysql_find_build_assignment_loops() { new_loops=$( { - printf 'SELECT DISTINCT' - printf ' `packages_dependency`.`build_assignment`,' - printf '`packages_dependent`.`build_assignment`' - printf ' FROM `dependencies`' - mysql_join_dependencies_dependency_types - mysql_join_dependencies_install_target_providers_with_versions - mysql_join_install_target_providers_binary_packages '' 'packages_dependency' - mysql_join_dependencies_binary_packages '' 'packages_dependent' - mysql_join_binary_packages_binary_packages_in_repositories 'packages_dependency' 'packages_in_repository_dependency' - mysql_join_binary_packages_binary_packages_in_repositories 'packages_dependent' 'packages_in_repository_dependent' - printf ' WHERE `packages_in_repository_dependent`.`repository`=%s' \ - "${repository_ids__any_build_list}" - printf ' AND `packages_in_repository_dependency`.`repository`=%s' \ - "${repository_ids__any_build_list}" - printf ' AND `dependency_types`.`relevant_for_building`' - printf ' AND (' - printf '`dependency_types`.`relevant_for_binary_packages`' - printf ' OR NOT EXISTS (' - printf 'SELECT 1 FROM `binary_packages_in_repositories` AS `subst_bpir`' - mysql_join_binary_packages_in_repositories_repositories 'subst_bpir' 'subst_r' - printf ' AND `subst_r`.`is_on_master_mirror`' - mysql_join_binary_packages_in_repositories_install_target_providers 'subst_bpir' 'subst_itp' - mysql_join_install_target_providers_versions 'subst_itp' 'subst_itp_v' - printf ' WHERE `subst_itp`.`install_target`=`dependencies`.`depending_on`' - printf ' AND ' - mysql_query_ordering_correct \ - '`dependencies_versions`.`order`' \ - '`subst_itp_v`.`order`' \ - '`dependencies`.`version_relation`' - printf ')' - printf ');\n' + printf 'SELECT DISTINCT `architectures`.`id`' + printf ' FROM `architectures`' + printf ' WHERE `architectures`.`id`!=%s;\n' \ + "${architecture_ids__any}" } | \ mysql_run_query | \ - tr '\t' ' ' | \ - tsort 2>&1 >/dev/null | \ - sed 's/^tsort:\s*//' | \ + while read -r arch_id; do + { + printf 'SELECT DISTINCT' + printf ' `ncy_ba`.`id`,' + printf '`nt_ba`.`id`' + printf ' FROM `dependencies`' + mysql_join_dependencies_dependency_types + mysql_join_dependencies_install_target_providers_with_versions + mysql_join_install_target_providers_binary_packages '' 'ncy_bp' + mysql_join_dependencies_binary_packages '' 'nt_bp' + for which in 'ncy' 'nt'; do + mysql_join_binary_packages_binary_packages_in_repositories "${which}"'_bp' "${which}"'_bpir' + mysql_join_binary_packages_build_assignments "${which}"'_bp' "${which}"'_ba' + printf ' JOIN `architecture_compatibilities` AS `%s_ac`' \ + "${which}" + printf ' ON `%s_ac`.`built_for`=`%s_ba`.`architecture`' \ + "${which}" "${which}" + printf ' AND `%s_ac`.`runs_on`=%s' \ + "${which}" "${arch_id}" + printf ' AND `%s_ac`.`fully_compatible`' \ + "${which}" + done + printf ' WHERE `nt_bpir`.`repository`=%s' \ + "${repository_ids__any_build_list}" + printf ' AND `ncy_bpir`.`repository`=%s' \ + "${repository_ids__any_build_list}" + printf ' AND `dependency_types`.`relevant_for_building`' + printf ' AND (' + printf '`dependency_types`.`relevant_for_binary_packages`' + printf ' OR NOT EXISTS (' + printf 'SELECT 1 FROM `binary_packages_in_repositories` AS `subst_bpir`' + mysql_join_binary_packages_in_repositories_repositories 'subst_bpir' 'subst_r' + printf ' AND `subst_r`.`is_on_master_mirror`' + mysql_join_binary_packages_in_repositories_binary_packages 'subst_bpir' 'subst_bp' + mysql_join_binary_packages_build_assignments 'subst_bp' 'subst_ba' + printf ' JOIN `architecture_compatibilities` AS `subst_ac`' + printf ' ON `subst_ac`.`built_for`=`subst_ba`.`architecture`' + printf ' AND `subst_ac`.`runs_on`=%s' \ + "${arch_id}" + printf ' AND `subst_ac`.`fully_compatible`' + mysql_join_binary_packages_in_repositories_install_target_providers 'subst_bpir' 'subst_itp' + mysql_join_install_target_providers_versions 'subst_itp' 'subst_itp_v' + printf ' WHERE `subst_itp`.`install_target`=`dependencies`.`depending_on`' + printf ' AND ' + mysql_query_ordering_correct \ + '`dependencies_versions`.`order`' \ + '`subst_itp_v`.`order`' \ + '`dependencies`.`version_relation`' + printf ')' + printf ');\n' + } | \ + mysql_run_query | \ + tr '\t' ' ' | \ + tsort 2>&1 >/dev/null | \ + sed 's/^tsort:\s*//' + done | \ { loop=0 while read -r id; do |