summaryrefslogtreecommitdiff
path: root/lib/mysql-functions
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mysql-functions')
-rwxr-xr-xlib/mysql-functions20
1 files changed, 18 insertions, 2 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 023de74..abda6fc 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -678,6 +678,8 @@ mysql_sanity_check() {
mysql_package_name_query
printf ') FROM `binary_packages`'
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
mysql_join_binary_packages_binary_packages_in_repositories
mysql_join_binary_packages_in_repositories_repositories
printf ' WHERE `repositories`.`is_on_master_mirror`'
@@ -717,6 +719,8 @@ mysql_sanity_check() {
printf ') FROM `binary_packages_in_repositories`'
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
mysql_join_binary_packages_in_repositories_repositories
mysql_join_repositories_architectures '' 'r_a'
printf ' WHERE `repositories`.`is_on_master_mirror`'
@@ -751,6 +755,8 @@ mysql_sanity_check() {
mysql_package_name_query
printf ' FROM `binary_packages`'
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
printf ' WHERE NOT EXISTS ('
printf 'SELECT 1'
printf ' FROM `binary_packages_in_repositories`'
@@ -1233,19 +1239,26 @@ mysql_query_select_pkgbase_and_revision() {
mysql_join_package_sources_upstream_repositories
}
-# mysql_package_name_query [binary_packages] [architectures]
+# mysql_package_name_query [binary_packages] [architectures] [compressions]
# print a mysql query of the full name of a package file
mysql_package_name_query() {
local bp_name="${1:-binary_packages}"
local a_name="${2:-architectures}"
+ local c_name="${3:-compressions}"
printf 'CONCAT('
printf '`%s`.`pkgname`,"-",' "${bp_name}"
printf 'IF(`%s`.`epoch`=0,"",CONCAT(`%s`.`epoch`,":")),' "${bp_name}" "${bp_name}"
printf '`%s`.`pkgver`,"-",' "${bp_name}"
printf '`%s`.`pkgrel`,' "${bp_name}"
printf 'IF(`%s`.`sub_pkgrel_omitted`,"",CONCAT(".",`%s`.`sub_pkgrel`)),"-",' "${bp_name}" "${bp_name}"
- printf '`%s`.`name`,".pkg.tar.xz"' "${a_name}"
+ printf '`%s`.`name`,".pkg."' "${a_name}"
+# TODO: do we really want to define the default compression this way?
+ printf 'IF('
+ printf '`%s`.`suffix` IS NULL,' "${c_name}"
+ printf '"tar.xz"'
+ printf '`%s`.`suffix`' "${c_name}"
+ printf ')'
printf ')'
}
@@ -1284,6 +1297,7 @@ for link in \
\
'binary_packages:architecture:architectures' \
'binary_packages:build_assignment:build_assignments' \
+ 'binary_packages:compression:compressions' \
\
'binary_packages_in_repositories:package:binary_packages' \
'binary_packages_in_repositories:repository:repositories' \
@@ -1443,6 +1457,8 @@ mysql_query_and_delete_unneeded_binary_packages() {
mysql_package_name_query
printf ') FROM `binary_packages`'
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
printf ' WHERE NOT EXISTS ('
printf 'SELECT 1'
printf ' FROM `binary_packages_in_repositories`'