Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib/mysql-functions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-12 16:02:11 +0200
committerErich Eckner <git@eckner.net>2018-09-12 16:02:11 +0200
commit73e2fb2155c4db5fe1dd82944b36cc0192a1564f (patch)
tree006260b558251e5694f917722ed181f7d5be6b8d /lib/mysql-functions
parent525dddfd2460e3a442fcb1af95e44f47bb69a369 (diff)
lib/mysql-functions: mysql_cleanup() now also removes virtual packages from binary_packages which are not linked by binary_packages_in_repositories
Diffstat (limited to 'lib/mysql-functions')
-rwxr-xr-xlib/mysql-functions16
1 files changed, 14 insertions, 2 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 17b34f6..bbf8816 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -743,16 +743,28 @@ mysql_cleanup() {
exit 2
fi
{
- # remove to-be-decided binary_packages and binary_packages_in_repositories
+ # remove to-be-decided binary_packages_in_repositories
printf '%s ' \
"${operator}"
if [ "${operator}" = 'DELETE' ]; then
- printf '`binary_packages`,`binary_packages_in_repositories` '
+ printf '`binary_packages_in_repositories` '
fi
printf 'FROM `binary_packages`'
mysql_join_binary_packages_binary_packages_in_repositories
printf ' WHERE `binary_packages_in_repositories`.`repository`=%s;\n' \
"${repository_ids__any_to_be_decided}"
+ # remove virtual binary_packages w/o binary_packages_in_repositories
+ printf '%s ' \
+ "${operator}"
+ if [ "${operator}" = 'DELETE' ]; then
+ printf '`binary_packages` '
+ fi
+ printf 'FROM `binary_packages`'
+ printf ' WHERE `binary_packages`.`sha512sum IS NULL'
+ printf ' AND NOT EXISTS ('
+ printf 'SELECT 1 FROM `binary_packages_in_repositories` '
+ printf 'WHERE `binary_packages_in_repositories`.`package`=`binary_packages`.`id`'
+ printf ');\n'
# remove build_assignments w/o binary_package
printf '%s FROM `build_assignments` ' \
"${operator}"