From 2f286d42cd0ec48260374d38a3f3636d86d87de8 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Tue, 26 Jun 2018 13:06:46 +0200 Subject: bin/why-dont-you: partially reimplement why-dont-you stabilize/unstage --- bin/why-dont-you | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) (limited to 'bin') diff --git a/bin/why-dont-you b/bin/why-dont-you index b05f98e..0efb1dc 100755 --- a/bin/why-dont-you +++ b/bin/why-dont-you @@ -175,7 +175,66 @@ case "${action}" in 'stabilize'|'unstage') - printf 'Sry, "why-dont-you %s" is unavailable, until someone recodes it to look into the database.\n' "${action}" + if [ "${action}" = 'stabilize' ]; then + # shellcheck disable=SC2154 + from_stability=${repository_stability_ids__testing} + # shellcheck disable=SC2016 + test_filter='`binary_packages`.`is_tested`' + else + # shellcheck disable=SC2154 + from_stability=${repository_stability_ids__staging} + test_filter='1' + fi + + for pkgname in "$@"; do + infos=$( + # shellcheck disable=SC2016 + { + printf 'SELECT' + printf ' `binary_packages_in_repositories`.`id`,' + printf ' IF(%s,1,0),' "${test_filter}" + printf ' IF(`binary_packages`.`has_issues`,1,0)' + printf ' FROM `binary_packages_in_repositories`' + mysql_join_binary_packages_in_repositories_repositories + mysql_join_binary_packages_in_repositories_binary_packages + printf ' WHERE `repositories`.`stability`=%s' \ + "${from_stability}" + printf ' AND `binary_packages`.`pkgname`=from_base64("%s")' \ + "$( + printf '%s' "${pkgname}" | \ + base64 -w0 + )" + } | \ + mysql_run_query | \ + tr '\t' ' ' + ) + if [ -z "${infos}" ]; then + printf 'Cannot find "%s"\n' \ + "${pkgname}" + continue + fi + # bpir="${infos%% *}" + infos="${infos#* }" + if [ "${infos% *}" = '0' ]; then + printf '"%s" is not tested.\n' \ + "${pkgname}" + continue + fi + infos="${infos#* }" + if [ "${infos}" = '1' ]; then + printf 'There are unresolved bugs reported against "%s".\n' \ + "${pkgname}" + continue + fi + + # TODO: `calculate_maximal_moveable_set` should return a list of + # `links` between unmoveable packages, which should then be + # evaluated here + + printf '"%s" might be %sd (but evaluation of that is not yet completely implemented!).\n' \ + "${pkgname}" \ + "${action}" + done ;; -- cgit v1.2.3