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-06-04 12:00:30 +0200
committerErich Eckner <git@eckner.net>2018-06-04 12:00:30 +0200
commitc43c80543417c803000bcca55ad1c93b6f212e11 (patch)
tree2efedd7e80058d6fe15b8ce366e37526d2973afb /lib/mysql-functions
parentfaa9172fa760425f05cce8b5d346f944bfc5b5fd (diff)
lib/mysql-functions, lib/common-functions: mysql_query_and_delete_unneeded_binary_packages() new
Diffstat (limited to 'lib/mysql-functions')
-rwxr-xr-xlib/mysql-functions20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 2670c9b..6ff541c 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -1040,6 +1040,7 @@ for link in \
'gpg_keys:owner:persons' \
\
'install_target_providers:package:binary_packages' \
+ 'install_target_providers:package package:binary_packages_in_repositories' \
'install_target_providers:install_target:install_targets' \
'install_target_providers:install_target depending_on:dependencies' \
\
@@ -1104,3 +1105,22 @@ mysql_retrieve_static_information() {
mysql_run_query
)"
}
+
+# mysql_query_and_delete_unneeded_binary_packages
+# print a query which lists and deletes binary_packages which are not
+# linked from binary_packages_in_repositories
+mysql_query_and_delete_unneeded_binary_packages() {
+ printf 'SELECT CONCAT("pool/",'
+ mysql_package_name_query
+ printf ') FROM `binary_packages`'
+ mysql_join_binary_packages_architectures
+ printf ' WHERE NOT EXISTS ('
+ printf 'SELECT 1 FROM `binary_packages_in_repositories`'
+ printf ' WHERE `binary_packages_in_repositories`.`package`=`binary_packages`.`id`'
+ printf ');\n'
+ printf 'DELETE `binary_packages` FROM `binary_packages`'
+ printf ' WHERE NOT EXISTS ('
+ printf 'SELECT 1 FROM `binary_packages_in_repositories`'
+ printf ' WHERE `binary_packages_in_repositories`.`package`=`binary_packages`.`id`'
+ printf ');\n'
+}