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 08:29:42 +0200
committerErich Eckner <git@eckner.net>2021-04-20 08:29:42 +0200
commit4fa1b905b97a2188c5b710e1f8825d8726a08143 (patch)
tree895f03d522b36c79287c7e3d0fd34fffa9b6b096 /bin/db-update
parent3bab794e189d477733cbd8587d943c1be16b8333 (diff)
bin/db-update: -e should not need arguments - we have -o for filtering
Diffstat (limited to 'bin/db-update')
-rwxr-xr-xbin/db-update54
1 files changed, 18 insertions, 36 deletions
diff --git a/bin/db-update b/bin/db-update
index 9fbc544..19bd084 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -27,9 +27,8 @@ usage() {
>&2 echo ' move possible packages from staging to testing.'
>&2 echo ''
>&2 echo 'possible options:'
- >&2 echo ' -e|--everything $arch/$repo:'
- >&2 echo ' Force movement of every package in the given repo and'
- >&2 echo ' move nothing else.'
+ >&2 echo ' -e|--everything:'
+ >&2 echo ' Force movement of every package and move nothing else.'
>&2 echo ' -f|--force $arch/$repo/$pkgname:'
>&2 echo ' Force movement of given package and move nothing else.'
>&2 echo ' -h|--help:'
@@ -59,8 +58,8 @@ usage() {
}
eval set -- "$(
- getopt -o e:f:hino:pw \
- --long everything: \
+ getopt -o ef:hino:pw \
+ --long everything \
--long force: \
--long help \
--long ignore-insanity \
@@ -77,12 +76,15 @@ ignore_insanity=false
no_action_flag=''
progressive=false
force_pkgs=''
-force_every_pkgs=''
+force_every_pkg=false
only=''
while true
do
case "$1" in
+ -e|--everything)
+ force_every_pkg=true
+ ;;
-f|--force)
shift
force_pkgs=$(
@@ -91,14 +93,6 @@ do
printf '\n%s' "${force_pkgs}"
)
;;
- -e|--everything)
- shift
- force_every_pkgs=$(
- printf '%s' "$1" | \
- base64 -w0
- printf '\n%s' "${force_every_pkgs}"
- )
- ;;
-h|--help)
usage 0
;;
@@ -142,20 +136,15 @@ if [ $# -ne 0 ]; then
usage
fi
-if ${progressive} && \
- [ -n "${force_pkgs}" ]; then
- >&2 echo 'db-update: conflicting arguments'
- usage
-fi
+number_of_force_flags=0
+${progressive} \
+&& number_of_force_flags=$((number_of_force_flags+1))
+[ -n "${force_pkgs}" ] \
+&& number_of_force_flags=$((number_of_force_flags+1))
+${force_every_pkg} \
+&& number_of_force_flags=$((number_of_force_flags+1))
-if ${progressive} && \
- [ -n "${force_every_pkgs}" ]; then
- >&2 echo 'db-update: conflicting arguments'
- usage
-fi
-
-if [ -n "${force_pkgs}" ] && \
- [ -n "${force_every_pkgs}" ]; then
+if [ ${number_of_force_flags} -gt 1 ]; then
>&2 echo 'db-update: conflicting arguments'
usage
fi
@@ -321,7 +310,7 @@ mysql_query_update_replaced_bpir() {
# repository_moves, because only repositories with the same
# architectures should be listed there.
if [ -n "${force_pkgs}" ] || \
- [ -n "${force_every_pkgs}" ]; then
+ ${force_every_pkg}; 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'
@@ -349,14 +338,7 @@ mysql_query_update_replaced_bpir() {
${force_pkgs} | \
sed 's/,$/);\n/'
else
- printf ' WHERE CONCAT('
- printf '`architectures`.`name`,"/",'
- printf '`repositories`.`name`'
- printf ') IN ('
- # shellcheck disable=SC2086
- printf 'from_base64("%s"),' \
- ${force_every_pkgs} | \
- sed 's/,$/);\n/'
+ printf ';\n'
fi
printf 'DELETE `moveable_bpir`'
printf ' FROM `moveable_bpir`'