index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-01-14 11:54:00 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-01-14 11:54:00 +0100 |
commit | 954a72aa672feb577f62a7c1470f92bbc203bf92 (patch) | |
tree | 2ef3cb9c770c4c3cc8ee79972b8edd95c97357bb /bin | |
parent | ebd91ac0e957ad525ec62cd8fd12907446048911 (diff) |
-rwxr-xr-x | bin/seed-build-list | 157 |
diff --git a/bin/seed-build-list b/bin/seed-build-list index 9cb2732..33e493e 100755 --- a/bin/seed-build-list +++ b/bin/seed-build-list @@ -327,72 +327,115 @@ fi fi # auto-detect pkgbases if ${auto}; then -# TODO: there is some architecture logic missing here - printf 'SELECT DISTINCT "pkgbase",1,`package_sources`.`pkgbase`,`upstream_repositories`.`name` FROM (' - printf 'SELECT DISTINCT `binary_packages`.`id`,' - printf '`binary_packages`.`build_assignment`' - printf ' FROM (' - printf 'SELECT `binary_packages`.`pkgname`,' - printf 'MAX(`repositories`.`stability`) AS `stability`' - printf ' FROM `binary_packages`' - mysql_join_binary_packages_binary_packages_in_repositories - mysql_join_binary_packages_in_repositories_repositories - printf ' AND (' - printf '`repositories`.`is_on_master_mirror`' - # we need to take into account build-list items here, because - # they may make re-scheduling unnecessary - printf ' OR `repositories`.`name`="build-list"' - printf ') AND `repositories`.`name`!="build-support"' - # TODO: care about i486 and any here, too - if it is complete enough - # shellcheck disable=SC2154 - printf ' AND `binary_packages`.`architecture`=%s' \ - "${architecture_ids__i686}" - printf ' GROUP BY `binary_packages`.`pkgname`' - printf ') AS `least_stable`' - printf ' JOIN `binary_packages`' - printf ' ON `binary_packages`.`pkgname`=`least_stable`.`pkgname`' + # schedule any package, that: + # 1) is not on the build-list currently and + # 2) has some dependency which is not provided by any package which + # a) is also on the build-list or + # b) is the least stable package with that name and for that architecture + printf 'CREATE TEMPORARY TABLE `least_stable_bp%s`(`id` BIGINT, `is_on_build_list` BIT(1), PRIMARY KEY `id`(`id`));\n' \ + '' '_copy' + # add least-stable built packages + printf 'INSERT IGNORE INTO `least_stable_bp`(`id`,`is_on_build_list`)' + printf ' SELECT `binary_packages`.`id`,' + printf ' `bl_bpir`.`id` IS NOT NULL' + printf ' FROM `binary_packages`' + mysql_join_binary_packages_binary_packages_in_repositories + mysql_join_binary_packages_in_repositories_repositories + printf ' JOIN (' + printf 'SELECT `binary_packages`.`pkgname`,' + printf '`binary_packages`.`architecture`,' + printf 'MAX(`repositories`.`stability`) AS `stability`' + printf ' FROM `binary_packages`' mysql_join_binary_packages_binary_packages_in_repositories mysql_join_binary_packages_in_repositories_repositories - printf ' AND `repositories`.`stability`=`least_stable`.`stability`' - # now we can drop build-list items - printf ' AND `repositories`.`is_on_master_mirror`' - printf ') AS `binary_packages`' - mysql_join_binary_packages_build_assignments - mysql_join_build_assignments_package_sources - mysql_join_package_sources_upstream_repositories + printf ' WHERE `repositories`.`is_on_master_mirror`' + printf ' AND `repositories`.`name`!="build-support"' + printf ' GROUP BY CONCAT(' + printf '`binary_packages`.`pkgname`,"-",`binary_packages`.`architecture`' + printf ')' + printf ') AS `sub_q`' + printf ' ON `sub_q`.`pkgname`=`binary_packages`.`pkgname`' + printf ' AND `sub_q`.`architecture`=`binary_packages`.`architecture`' + printf ' AND `sub_q`.`stability`=`repositories`.`stability`' + printf ' LEFT JOIN (' + printf '`binary_packages` AS `bl_bp`' + mysql_join_binary_packages_binary_packages_in_repositories 'bl_bp' 'bl_bpir' + printf ' AND `bl_bpir`.`repository`=%s' \ + "${repository_ids__any_build_list}" + printf ')' + printf ' ON `bl_bp`.`pkgname`=`binary_packages`.`pkgname`' + printf ' AND (' + printf '`bl_bp`.`architecture`=`binary_packages`.`architecture`' + printf ' OR `bl_bp`.`architecture`=%s' \ + "${architecture_ids__any}" + printf ' OR `binary_packages`.`architecture`=%s' \ + "${architecture_ids__any}" + printf ');\n' + + # add all build-list packages + printf 'INSERT IGNORE INTO `least_stable_bp`(`id`,`is_on_build_list`)' + printf ' SELECT `binary_packages_in_repositories`.`package`,1' + printf ' FROM `binary_packages_in_repositories`' + printf ' WHERE `binary_packages_in_repositories`.`repository`=%s;\n' \ + "${repository_ids__any_build_list}" + + # this copy shall hold the install-target-providers + printf 'INSERT IGNORE INTO `least_stable_bp_copy`(`id`,`is_on_build_list`)' + printf ' SELECT `least_stable_bp`.`id`,' + printf '`least_stable_bp`.`is_on_build_list`' + printf ' FROM `least_stable_bp`;\n' + + # remove packages that should never be rescheduled + printf 'DELETE `least_stable_bp` FROM `least_stable_bp`' + printf ' JOIN `binary_packages`' + printf ' ON `binary_packages`.`id`=`least_stable_bp`.`id`' + # 1) + printf ' WHERE `least_stable_bp`.`is_on_build_list`' + # TODO: care about i486 and any here, too - if it is complete enough + # shellcheck disable=SC2154 + printf ' OR `binary_packages`.`architecture`!=%s;\n' \ + "${architecture_ids__i686}" + + printf 'SELECT DISTINCT "pkgbase",1,`package_sources`.`pkgbase`,`upstream_repositories`.`name`' + printf ' FROM `least_stable_bp`' + printf ' JOIN `binary_packages`' + printf ' ON `least_stable_bp`.`id`=`binary_packages`.`id`' mysql_join_binary_packages_dependencies mysql_join_dependencies_dependency_types printf ' AND `dependency_types`.`relevant_for_binary_packages`' - mysql_join_dependencies_install_target_providers_with_versions '' 'itp_dummy' + mysql_join_dependencies_versions '' 'd_v' + mysql_join_binary_packages_build_assignments + mysql_join_build_assignments_package_sources + mysql_join_package_sources_upstream_repositories # some dependencies are not provided by the least stable packages printf ' WHERE NOT EXISTS (' - printf 'SELECT 1 FROM `install_target_providers`' - mysql_join_install_target_providers_binary_packages '' 'subst_bp' - mysql_join_binary_packages_binary_packages_in_repositories 'subst_bp' 'subst_bir' - mysql_join_binary_packages_in_repositories_repositories 'subst_bir' 'subst_r' - printf ' AND `subst_r`.`name` NOT IN ("build-support","deletion-list","to-be-decided")' + printf 'SELECT 1' + printf ' FROM `least_stable_bp_copy`' + printf ' JOIN `binary_packages` AS `itp_bp`' + printf ' ON `least_stable_bp_copy`.`id`=`itp_bp`.`id`' + mysql_join_binary_packages_install_target_providers 'itp_bp' + mysql_join_install_target_providers_versions '' 'itp_v' + # must provide the right install_target printf ' WHERE `install_target_providers`.`install_target`=`dependencies`.`depending_on`' - # this is the least stable, built install_target_provider with that name - printf ' AND NOT EXISTS (' - printf 'SELECT 1 FROM `binary_packages` AS `ss_bp`' - mysql_join_binary_packages_binary_packages_in_repositories 'ss_bp' 'ss_bir' - mysql_join_binary_packages_in_repositories_repositories 'ss_bir' 'ss_r' - printf ' AND `ss_r`.`name` NOT IN ("build-list","build-support","deletion-list","to-be-decided")' - printf ' JOIN `repository_stability_relations` AS `ss_rsr`' - printf ' ON `ss_rsr`.`less_stable`=`ss_r`.`stability`' - printf ' WHERE `ss_bp`.`pkgname`=`subst_bp`.`pkgname`' - printf ' AND (' - printf '`ss_bp`.`architecture`=`subst_bp`.`architecture`' - printf ' OR `ss_bp`.`architecture`=%s' \ - "${architecture_ids__any}" - printf ' OR `subst_bp`.`architecture`=%s' \ - "${architecture_ids__any}" - printf ')' - printf ' AND `ss_bp`.`id`!=`subst_bp`.`id`' - printf ' AND `ss_rsr`.`more_stable`=`subst_r`.`stability`' + # must provide the right version + printf ' AND (' + mysql_query_ordering_correct \ + '`d_v`.`order`' \ + '`itp_v`.`order`' \ + '`dependencies`.`version_relation`' + # or be on the build-list + printf ' OR `least_stable_bp_copy`.`is_on_build_list`' + # must provide the right architecture + printf ') AND (' + printf '`itp_bp`.`architecture`=`binary_packages`.`architecture`' + printf ' OR `itp_bp`.`architecture`=%s' \ + "${architecture_ids__any}" + printf ' OR `binary_packages`.`architecture`=%s' \ + "${architecture_ids__any}" printf ')' - printf ')' - printf ';\n' + printf ');\n' + printf 'DROP TEMPORARY TABLE `least_stable_bp%s`;\n' \ + '' '_copy' fi } | \ mysql_run_query | \ |