summaryrefslogtreecommitdiff
path: root/bin/why-dont-you
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-06-26 13:06:46 +0200
committerErich Eckner <git@eckner.net>2018-06-26 13:06:46 +0200
commit2f286d42cd0ec48260374d38a3f3636d86d87de8 (patch)
treee157a7cb622e144c8738c73c5b4b8b9f05bea96e /bin/why-dont-you
parentb00f296cd53ac4eeddbb1400bbf19d80ee33eb20 (diff)
downloadbuilder-2f286d42cd0ec48260374d38a3f3636d86d87de8.tar.xz
bin/why-dont-you: partially reimplement why-dont-you stabilize/unstage
Diffstat (limited to 'bin/why-dont-you')
-rwxr-xr-xbin/why-dont-you61
1 files changed, 60 insertions, 1 deletions
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
;;