Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin/db-update
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2021-04-20 09:51:29 +0200
committerErich Eckner <git@eckner.net>2021-04-20 09:51:29 +0200
commit0a48f43bfc019906d284d61625cd41e3841d86f7 (patch)
tree1d274546696dd693634f62713521f83dd6430610 /bin/db-update
parente4034b869bb0ba97de7e027f9bac5c3eff742845 (diff)
bin/db-update: -s/--stuck new
Diffstat (limited to 'bin/db-update')
-rwxr-xr-xbin/db-update31
1 files changed, 29 insertions, 2 deletions
diff --git a/bin/db-update b/bin/db-update
index 59badd4..196527e 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -52,13 +52,16 @@ usage() {
>&2 echo ' Move forward any package which replaces no package whose'
>&2 echo ' dependencies are all available somewhere.'
>&2 echo ' Note, that this _may_ move _less_ packages.'
+ >&2 echo ' -s|--stuck:'
+ >&2 echo ' Force movement of every package, that is stuck for too'
+ >&2 echo ' long, and move nothing else.'
>&2 echo ' -w|--wait:'
>&2 echo ' If necessary, wait for lock blocking.'
[ -z "$1" ] && exit 1 || exit "$1"
}
eval set -- "$(
- getopt -o ef:hino:pw \
+ getopt -o ef:hino:psw \
--long everything \
--long force: \
--long help \
@@ -66,6 +69,7 @@ eval set -- "$(
--long no-action \
--long only: \
--long progressive \
+ --long stuck \
--long wait \
-n "$(basename "$0")" -- "$@" || \
echo usage
@@ -77,6 +81,7 @@ no_action_flag=''
progressive=false
force_pkgs=''
force_every_pkg=false
+force_stuck_pkgs=false
only=''
while true
@@ -116,6 +121,9 @@ do
>&2 echo 'Do not use this option, it is currently broken.'
exit 42
;;
+ -s|--stuck)
+ force_stuck_pkgs=true
+ ;;
-w|--wait)
block_flag=''
;;
@@ -143,6 +151,8 @@ ${progressive} \
&& number_of_force_flags=$((number_of_force_flags+1))
${force_every_pkg} \
&& number_of_force_flags=$((number_of_force_flags+1))
+${force_stuck_pkgs} \
+&& number_of_force_flags=$((number_of_force_flags+1))
if [ ${number_of_force_flags} -gt 1 ]; then
>&2 echo 'db-update: conflicting arguments'
@@ -310,7 +320,8 @@ mysql_query_update_replaced_bpir() {
# repository_moves, because only repositories with the same
# architectures should be listed there.
if [ -n "${force_pkgs}" ] || \
- ${force_every_pkg}; then
+ ${force_every_pkg} || \
+ ${force_stuck_pkgs}; then
printf 'DROP TEMPORARY TABLE IF EXISTS `%s_bpir`;\n' \
'moveable' 'replaced'
printf 'CREATE TEMPORARY TABLE `replaced_bpir` (`id` BIGINT, `replaced_by` BIGINT, UNIQUE KEY (`id`));\n'
@@ -337,6 +348,22 @@ mysql_query_update_replaced_bpir() {
printf 'from_base64("%s"),' \
${force_pkgs} | \
sed 's/,$/);\n/'
+ elif ${force_stuck_pkgs}; then
+ printf ' WHERE `binary_packages_in_repositories`.`last_moved` < DATE_SUB(NOW(),INTERVAL '
+ # shellcheck disable=SC2154
+ case "${source_stability_id}" in
+ "${repository_stability_ids__testing}")
+ printf '%s.5' "$((max_testing_duration+2))"
+ ;;
+ "${repository_stability_ids__staging}")
+ printf '2.5'
+ ;;
+ *)
+ >&2 printf 'unknown source stability id: %s\n' "${source_stability_id}"
+ printf '1000000'
+ ;;
+ esac
+ printf ' day);\n'
else # ${force_every_pkg}
printf ';\n'
fi