Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-10-17 10:19:56 +0200
committerErich Eckner <git@eckner.net>2019-10-17 10:19:56 +0200
commit95aa99618adf4f55d1a61f8e9fab56c7960a84e4 (patch)
treef321bdfa38dbd02a64018d58c5c6a1ba856452c0 /lib
parent9ec94e507ffde2b21b95b1107d6812f83bebc104 (diff)
lib/mysql-functions: mysql_package_name_query(): take compression suffix from database, default to "tar.xz" for now
Diffstat (limited to 'lib')
-rwxr-xr-xlib/common-functions4
-rwxr-xr-xlib/mysql-functions20
2 files changed, 21 insertions, 3 deletions
diff --git a/lib/common-functions b/lib/common-functions
index 30b80a2..729cc46 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -163,7 +163,7 @@ remove_old_package_versions() {
printf '`d_bp`.`pkgname`,'
printf 'CONCAT(`d_ra`.`name`,"/",'
printf '`d_r`.`name`,"/",'
- mysql_package_name_query 'd_bp' 'd_bpa'
+ mysql_package_name_query 'd_bp' 'd_bpa' 'd_bpc'
printf ')'
printf ' FROM `binary_packages_in_repositories` AS `d_bpir`'
mysql_join_binary_packages_in_repositories_binary_packages 'd_bpir' 'd_bp'
@@ -171,6 +171,8 @@ remove_old_package_versions() {
printf ' AND `d_r`.`is_on_master_mirror`'
mysql_join_repositories_architectures 'd_r' 'd_ra'
mysql_join_binary_packages_architectures 'd_bp' 'd_bpa'
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions 'd_bp' 'd_bpc'
printf ' JOIN `binary_packages` AS `o_bp`'
printf ' ON `d_bp`.`pkgname`=`o_bp`.`pkgname`'
mysql_join_binary_packages_binary_packages_in_repositories 'o_bp' 'o_bpir'
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`'