diff options
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/mysql-functions | 74 |
1 files changed, 52 insertions, 22 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions index e7d5b14..5b83b34 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -836,35 +836,65 @@ mysql_cleanup() { mysql_run_query 'unimportant' } -# TODO: we do not need to wait for makedepends, as long as _any_ -# available package provides the makedepends - # mysql_query_has_pending_dependencies builder-architecture.id `build_assignment`.`id` # print a mysql query giving whether dependencies are pending mysql_query_has_pending_dependencies() { + # we have pending dependencies ... printf 'EXISTS (' - printf 'SELECT 1 FROM `binary_packages_in_repositories` as `todos_bpir`' - mysql_join_binary_packages_in_repositories_binary_packages 'todos_bpir' 'todos' - printf ' JOIN `architecture_compatibilities` AS `todo_ac`' - printf ' ON `todos`.`architecture`=`todo_ac`.`runs_on`' + printf 'SELECT 1' + printf ' FROM `binary_packages` AS `todos`' + mysql_join_binary_packages_binary_packages_in_repositories 'todos' 'todo_bpirs' + printf ' AND `todo_bpirs`.`repository`=%s' \ + "${repository_ids__any_build_list}" + # ... if any dependency ... mysql_join_binary_packages_dependencies 'todos' 'l_deps' + mysql_join_dependencies_versions 'l_deps' 'l_dep_vs' mysql_join_dependencies_dependency_types 'l_deps' 'l_dep_ts' - mysql_join_dependencies_install_target_providers_with_versions 'l_deps' 'l_itps' - mysql_join_install_target_providers_binary_packages 'l_itps' 'deps' - printf ' JOIN `architecture_compatibilities` AS `dep_ac`' - printf ' ON `deps`.`architecture`=`dep_ac`.`runs_on`' - mysql_join_binary_packages_binary_packages_in_repositories 'deps' 'deps_bpir' - printf ' WHERE' - printf ' `%s`.`repository`=%s AND' \ - 'deps_bpir' "${repository_ids__any_build_list}" \ - 'todos_bpir' "${repository_ids__any_build_list}" - printf ' `l_dep_ts`.`relevant_for_building` AND ' - printf ' `deps`.`build_assignment`!=`todos`.`build_assignment` AND' - printf ' `todos`.`build_assignment`=%s' \ + # ... is relevant for building ... + printf ' AND `l_dep_ts`.`relevant_for_building`' + printf ' WHERE `todos`.`build_assignment`=%s' \ "$2" - printf ' AND `%s`.`runs_on`=%s' \ - 'todo_ac' "$1" \ - 'dep_ac' "$1" + printf ' AND IF(' + # ... and if (a) relevant for binary_packages ... + printf '`l_dep_ts`.`relevant_for_binary_packages`,' + # ... has some unbuilt provider ... + printf 'EXISTS (' + printf 'SELECT 1' + printf ' FROM `install_target_providers` AS `l_itps`' + mysql_join_install_target_providers_versions 'l_itps' 'l_itp_vs' + mysql_join_install_target_providers_binary_packages 'l_itps' 'dep_bp' + mysql_join_binary_packages_binary_packages_in_repositories 'dep_bp' 'dep_bpir' + printf ' AND `dep_bpir`.`repository`=%s' \ + "${repository_ids__any_build_list}" + printf ' JOIN `architecture_compatibilities`' + printf ' ON `architecture_compatibilities`.`built_for`=`dep_bp`.`architecture`' + printf ' AND `architecture_compatibilities`.`runs_on`=%s' \ + "$1" + printf ' AND `architecture_compatibilities`.`fully_compatible`' + printf ' WHERE `l_itps`.`install_target`=`l_deps`.`depending_on`' + # version is irelevant: either the package is built and we don't + # care or the package is not built and we don't know + printf '),' + # ... or (b) not relevant for binary_packages (e.g. a makedepends) has + # no built provider + printf 'NOT EXISTS (' + printf 'SELECT 1' + printf ' FROM `install_target_providers` AS `l_itps`' + mysql_join_install_target_providers_versions 'l_itps' 'l_itp_vs' + mysql_join_install_target_providers_binary_packages 'l_itps' 'dep_bp' + mysql_join_binary_packages_binary_packages_in_repositories 'dep_bp' 'dep_bpir' + mysql_join_binary_packages_in_repositories_repositories 'dep_bpir' 'dep_r' + printf ' AND `dep_r`.`is_on_master_mirror`' + printf ' AND `dep_r`.`architecture`=%s' \ + "$1" + printf ' WHERE `l_itps`.`install_target`=`l_deps`.`depending_on`' + printf ' AND ' + mysql_query_ordering_correct \ + '`l_dep_vs`.`order`' \ + '`l_itp_vs`.`order`' \ + '`l_deps`.`version_relation`' + printf ')' + printf ')' printf ')' } |