summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/delete-packages28
1 files changed, 19 insertions, 9 deletions
diff --git a/bin/delete-packages b/bin/delete-packages
index 0c1689f..103288a 100755
--- a/bin/delete-packages
+++ b/bin/delete-packages
@@ -24,9 +24,9 @@ usage() {
>&2 echo ' -b|--build-support $package-list:'
>&2 echo ' Only delete the matching packages from [build-support].'
>&2 echo ' conflicts -f; only accepted once'
- >&2 echo ' -f|--force $id:'
+ >&2 echo ' -f|--force $package:'
>&2 echo ' Only delete the selected packages (given by'
- >&2 echo ' `binary_packages_in_repositories`.`id`) - but delete'
+ >&2 echo ' $repo_arch/$repo/$pkgname) - but delete'
>&2 echo ' in any case. conflicts -b'
>&2 echo ' -h|--help:'
>&2 echo ' Show this help and exit.'
@@ -53,7 +53,7 @@ eval set -- "$(
block_flag='-n'
build_support=''
-force_ids=''
+force_packages=''
ignore_insanity=false
no_action=false
@@ -70,7 +70,7 @@ do
;;
-f|--force)
shift
- force_ids="${force_ids} $1"
+ force_packages="${force_packages} $1"
;;
-h|--help)
usage 0
@@ -97,7 +97,7 @@ do
done
if [ -n "${build_support}" ] && \
- [ -n "${force_ids}" ]; then
+ [ -n "${force_packages}" ]; then
>&2 echo 'Conflicting flags: -b & -f.'
usage
fi
@@ -142,15 +142,25 @@ export TMPDIR="${tmp_dir}"
{
printf 'CREATE TEMPORARY TABLE `bpir_to_delete` (`id` BIGINT, UNIQUE KEY (`id`));\n'
printf 'INSERT IGNORE INTO `bpir_to_delete`'
- if [ -n "${force_ids}" ]; then
- printf ' VALUES '
+ if [ -n "${force_packages}" ]; then
+ printf ' SELECT'
+ printf ' `binary_packages_in_repositories`.`id`'
+ printf ' FROM `binary_packages_in_repositories`'
+ mysql_join_binary_packages_in_repositories_binary_packages
+ mysql_join_binary_packages_in_repositories_repositories
+ mysql_join_repositories_architectures
+ printf ' WHERE CONCAT('
+ printf '`architectures`.`name`,"/",'
+ printf '`repositories`.`name`,"/",'
+ printf '`binary_packages`.`pkgname`'
+ printf ') IN ('
# shellcheck disable=SC2086
- printf '%s\n' ${force_ids} | \
+ printf '%s\n' ${force_packages} | \
base64_encode_each | \
sed '
s/^/(from_base64("/
s/$/")),/
- $ s/,$/;/
+ $ s/,$/);/
'
elif [ -n "${build_support}" ]; then
printf ' SELECT DISTINCT `binary_packages_in_repositories`.`id`'