index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | bin/db-update | 32 |
diff --git a/bin/db-update b/bin/db-update index 7ea2474..5fc7af3 100755 --- a/bin/db-update +++ b/bin/db-update @@ -22,8 +22,8 @@ usage() { >&2 echo ' move possible packages from staging to testing.' >&2 echo '' >&2 echo 'possible options:' - >&2 echo ' -f|--force $package-id:' - >&2 echo ' Force movement of package with given id 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:' >&2 echo ' Show this help and exit.' >&2 echo ' -i|--ignore-insanity:' @@ -55,17 +55,17 @@ block_flag='-n' ignore_insanity=false no_action=false progressive=false -force_ids='' +force_pkgs='' while true do case "$1" in -f|--force) shift - force_ids=$( + force_pkgs=$( printf '%s' "$1" | \ base64 -w0 - printf '\n%s' "${force_ids}" + printf '\n%s' "${force_pkgs}" ) ;; -h|--help) @@ -101,7 +101,7 @@ if [ $# -ne 0 ]; then fi if ${progressive} && \ - [ -n "${force_ids}" ]; then + [ -n "${force_pkgs}" ]; then >&2 echo 'db-update: conflicting arguments' usage fi @@ -171,17 +171,27 @@ for source_stability in \ # are for the same architecture if we joined them via # repository_moves, because only repositories with the same # architectures should be listed there. - if [ -n "${force_ids}" ]; then + if [ -n "${force_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' printf 'CREATE TEMPORARY TABLE `moveable_bpir` (`id` BIGINT, `to_repository` MEDIUMINT, UNIQUE KEY (`id`));\n' printf 'INSERT IGNORE INTO `moveable_bpir` (`id`,`to_repository`)' - printf ' VALUES' + printf ' SELECT ' + printf '`binary_packages_in_repositories`.`id`,NULL' + printf ' FROM `binary_packages_in_repositories`' + mysql_join_binary_packages_in_repositories_repositories + mysql_join_repositories_architectures + mysql_join_binary_packages_in_repositories_binary_packages + printf ' WHERE CONCAT(' + printf '`architectures`.`name`,"/",' + printf '`repositories`.`name`,"/",' + printf '`binary_packages`.`pkgname`' + printf ') IN (' # shellcheck disable=SC2086 - printf '(from_base64("%s"),NULL),' \ - ${force_ids} | \ - sed 's/,$/;\n/' + printf 'from_base64("%s"),' \ + ${force_pkgs} | \ + sed 's/,$/);\n/' printf 'DELETE `moveable_bpir` FROM `moveable_bpir`' printf ' JOIN `binary_packages_in_repositories` ON `binary_packages_in_repositories`.`id`=`moveable_bpir`.`id`' mysql_join_binary_packages_in_repositories_binary_packages |