index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | bin/why-dont-you | 127 |
diff --git a/bin/why-dont-you b/bin/why-dont-you index 31a3f63..d795050 100755 --- a/bin/why-dont-you +++ b/bin/why-dont-you @@ -178,11 +178,15 @@ case "${action}" in if [ "${action}" = 'stabilize' ]; then # shellcheck disable=SC2154 from_stability=${repository_stability_ids__testing} + # shellcheck disable=SC2154 + to_stability=${repository_stability_ids__stable} # shellcheck disable=SC2016 test_filter='`binary_packages`.`is_tested`' else # shellcheck disable=SC2154 from_stability=${repository_stability_ids__staging} + # shellcheck disable=SC2154 + to_stability=${repository_stability_ids__testing} test_filter='1' fi @@ -227,9 +231,126 @@ case "${action}" in continue fi - # TODO: `calculate_maximal_moveable_set` should return a list of - # `links` between binary_packages_in_repositories, which should - # then be evaluated here + # shellcheck disable=SC2016 + { + printf 'CREATE TEMPORARY TABLE `moveable_bpir` (`id` BIGINT, `to_repository` BIGINT, UNIQUE KEY `id`(`id`));\n' + printf 'CREATE TEMPORARY TABLE `replaceable_bpir` (`id` BIGINT, `replaced_by` BIGINT, UNIQUE KEY `id`(`id`));\n' + + for copy in '' '_copy'; do + printf 'CREATE TEMPORARY TABLE `knots%s` (' \ + "${copy}" + printf '`id` BIGINT NOT NULL AUTO_INCREMENT,' + printf ' `and` BIT,' + printf ' `content_id` BIGINT,' + printf ' `content_type` ENUM("bpir","it"),' + printf ' `reason_length` MEDIUMINT,' + printf ' UNIQUE KEY (`id`),' + printf ' UNIQUE KEY `content`(`content_id`,`content_type`));\n' + done + printf 'CREATE TEMPORARY TABLE `edges` (' + printf '`cause` BIGINT,' + printf ' `impact` BIGINT,' + printf ' `invert` BIT,' + printf ' UNIQUE KEY `content` (`cause`,`impact`));\n' + + printf 'INSERT IGNORE INTO `moveable_bpir` (`id`,`to_repository`)' + printf ' SELECT ' + printf '`binary_packages_in_repositories`.`id`,' + printf '`repository_moves`.`to_repository`' + printf ' FROM `binary_packages_in_repositories`' + mysql_join_binary_packages_in_repositories_repositories + mysql_join_binary_packages_in_repositories_binary_packages + mysql_join_binary_packages_build_assignments + mysql_join_build_assignments_package_sources + mysql_join_package_sources_upstream_repositories + mysql_join_upstream_repositories_repository_moves + printf ' AND `repository_moves`.`from_repository`=`repositories`.`id`' + printf ' WHERE `repositories`.`stability`=%s' \ + "${from_stability}" + printf ' AND %s' \ + "${test_filter}" + printf ' AND NOT `binary_packages`.`has_issues`;\n' + + printf 'INSERT IGNORE INTO `replaceable_bpir` (`id`,`replaced_by`)' + printf ' SELECT `binary_packages_in_repositories`.`id`,`r_bpir`.`id`' + printf ' FROM `moveable_bpir`' + printf ' JOIN `binary_packages_in_repositories` AS `r_bpir`' + printf ' ON `r_bpir`.`id`=`moveable_bpir`.`id`' + mysql_join_binary_packages_in_repositories_binary_packages 'r_bpir' 'r_bp' + printf ' JOIN `binary_packages`' + printf ' ON `binary_packages`.`pkgname`=`r_bp`.`pkgname`' + mysql_join_binary_packages_binary_packages_in_repositories + printf ' WHERE `binary_packages_in_repositories`.`repository`=`moveable_bpir`.`to_repository`;\n' + + # we generate a graph with bpir and it as knots + + printf 'INSERT INTO `knots` (`and`,`content_id`,`content_type`)' + printf ' SELECT 1,`moveable_bpir`.`id`,"bpir"' + printf ' FROM `moveable_bpir`;\n' + + printf 'INSERT INTO `knots` (`and`,`content_id`,`content_type`)' + printf ' SELECT 1,`binary_packages_in_repositories`.`id`,"bpir"' + printf ' FROM `binary_packages_in_repositories`' + mysql_join_binary_packages_in_repositories_repositories + printf ' WHERE `repositories`.`stability`=%s;\n' \ + "${to_stability}" + + printf 'INSERT INTO `knots` (`and`,`content_id`,`content_type`)' + printf ' SELECT 0,`install_targets`.`id`,"it"' + printf ' FROM `install_targets`;\n' + + # create copy + printf 'INSERT INTO `knots_copy` SELECT * FROM `knots`;\n' + + # "available" bpir requires available install_target + printf 'INSERT INTO `edges` (`cause`,`impact`,`invert`)' + printf ' SELECT DISTINCT `c`.`id`,`i`.`id`,0' + printf ' FROM `knots` AS `i`' + printf ' JOIN `binary_packages_in_repositories`' + printf ' ON `binary_packages_in_repositories`.`id`=`i`.`content_id`' + printf ' AND `i`.`content_type`="bpir"' + mysql_join_binary_packages_in_repositories_dependencies + mysql_join_dependencies_dependency_types + printf ' AND `dependency_types`.`relevant_for_binary_packages`' + printf ' JOIN `knots_copy` AS `c`' + printf ' ON `dependencies`.`depending_on`=`c`.`content_id`' + printf ' AND `c`.`content_type`="it";\n' + + # "available" install_target requires available bpir - but we + # only care about bpir being replaced or moved + for bpir in 'moveable' 'replaceable'; do + printf 'INSERT INTO `edges` (`cause`,`impact`,`invert`)' + printf ' SELECT DISTINCT `c`.`id`,`i`.`id`,0' + printf ' FROM `knots` AS `c`' + printf ' JOIN `binary_packages_in_repositories`' + printf ' ON `binary_packages_in_repositories`.`id`=`c`.`content_id`' + printf ' AND `c`.`content_type`="bpir"' + printf ' JOIN `%s_bpir`' \ + "${bpir}" + printf ' ON `%s_bpir`.`id`=`binary_packages_in_repositories`.`id`' \ + "${bpir}" + mysql_join_binary_packages_in_repositories_install_target_providers + printf ' JOIN `knots_copy` AS `i`' + printf ' ON `install_target_providers`.`install_target`=`i`.`content_id`' + printf ' AND `i`.`content_type`="it";\n' + done + + # additionally, "available" moveable_bpir requires matching + # replaceable_bpir unavailable + printf 'INSERT INTO `edges` (`cause`,`impact`,`invert`)' + printf ' SELECT `c`.`id`,`i`.`id`,1' + printf ' FROM `replaceable_bpir`' + printf ' JOIN `knots` AS `c`' + printf ' ON `c`.`content_id`=`replaceable_bpir`.`id`' + printf ' AND `c`.`content_type`="bpir"' + printf ' JOIN `knots_copy` AS `i`' + printf ' ON `i`.`content_id`=`replaceable_bpir`.`replaced_by`' + printf ' AND `i`.`content_type`="bpir";\n' + + # TODO: set knot values and evaluate graph + printf 'SELECT COUNT(1) FROM `%s`;\n' knots knots_copy edges + } | \ + mysql_run_query printf '"%s" might be %sd (but evaluation of that is not yet completely implemented!).\n' \ "${pkgname}" \ |