Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
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
parent9ec94e507ffde2b21b95b1107d6812f83bebc104 (diff)
lib/mysql-functions: mysql_package_name_query(): take compression suffix from database, default to "tar.xz" for now
-rwxr-xr-xbin/bootstrap-mysql2
-rwxr-xr-xbin/create-build-support-package6
-rwxr-xr-xbin/db-update4
-rwxr-xr-xbin/delete-packages6
-rwxr-xr-xbin/get-assignment2
-rwxr-xr-xbin/nit-picker10
-rwxr-xr-xbin/return-assignment4
-rwxr-xr-xbin/sanity-check2
-rwxr-xr-xbin/seed-build-list2
-rwxr-xr-xlib/common-functions4
-rwxr-xr-xlib/mysql-functions20
11 files changed, 58 insertions, 4 deletions
diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql
index 636ee60..38e6d8d 100755
--- a/bin/bootstrap-mysql
+++ b/bin/bootstrap-mysql
@@ -646,6 +646,8 @@ fi
mysql_join_binary_packages_in_repositories_repositories
mysql_join_repositories_architectures '' 'r_a'
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
printf ';\n'
printf 'INSERT INTO `knot_names_copy`'
diff --git a/bin/create-build-support-package b/bin/create-build-support-package
index 1d4ec66..3e9dd8d 100755
--- a/bin/create-build-support-package
+++ b/bin/create-build-support-package
@@ -127,6 +127,8 @@ if [ -n "${source_package}" ]; then
mysql_join_binary_packages_in_repositories_repositories
mysql_join_repositories_architectures '' 'r_a'
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
printf ' WHERE `repositories`.`is_on_master_mirror`'
printf ' AND `r_a`.`name`=from_base64("%s")' \
"$(
@@ -136,7 +138,7 @@ if [ -n "${source_package}" ]; then
printf ' AND '
mysql_package_name_query '' 'XX' \
| sed '
- s/,"-",`XX.*\.pkg\.tar\.xz"//
+ s/,"-",`XX.*\.`suffix`)//
'
printf '=from_base64("%s")' \
"$(
@@ -258,6 +260,8 @@ elif [ -n "${shim_package}" ]; then
printf 'SELECT DISTINCT `binary_packages`.`id`'
printf ' FROM `binary_packages`'
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
printf ' WHERE '
mysql_package_name_query \
| sed 's/pkgname`,"/\0-shim/'
diff --git a/bin/db-update b/bin/db-update
index fa87673..738f3d6 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -460,6 +460,8 @@ export TMPDIR="${tmp_dir}"
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_in_repositories_repositories
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
mysql_join_repositories_architectures '' 'r_a'
printf ' JOIN `repositories` AS `new_repo`'
printf ' ON `new_repo`.`id`=`moveable_bpir`.`to_repository`'
@@ -478,6 +480,8 @@ export TMPDIR="${tmp_dir}"
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_in_repositories_repositories
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
mysql_join_repositories_architectures '' 'r_a'
printf ';\n'
} | \
diff --git a/bin/delete-packages b/bin/delete-packages
index 9b5c7cd..2ce04d7 100755
--- a/bin/delete-packages
+++ b/bin/delete-packages
@@ -170,6 +170,8 @@ export TMPDIR="${tmp_dir}"
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_in_repositories_repositories
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
mysql_join_repositories_architectures '' 'r_a'
printf ' WHERE `repositories`.`name`="build-support"'
printf ' AND CONCAT(`r_a`.`name`," ",'
@@ -282,6 +284,8 @@ export TMPDIR="${tmp_dir}"
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_in_repositories_repositories
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
mysql_join_repositories_architectures '' 'r_a'
printf ';\n'
@@ -296,6 +300,8 @@ export TMPDIR="${tmp_dir}"
printf ' JOIN `binary_packages`'
printf ' ON `bp_to_delete`.`id`=`binary_packages`.`id`'
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
printf ';\n'
# we do not need the ids of the to-be-deleted binary_packages, because
diff --git a/bin/get-assignment b/bin/get-assignment
index b7cdb8a..6eaa5d9 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -47,6 +47,8 @@ hand_out_assignment() {
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
printf ' WHERE `binary_packages`.`build_assignment`=%s' \
"$1"
diff --git a/bin/nit-picker b/bin/nit-picker
index 7a2f785..7312348 100755
--- a/bin/nit-picker
+++ b/bin/nit-picker
@@ -128,6 +128,8 @@ while pgrep -x ii >/dev/null \
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`'
@@ -147,6 +149,8 @@ while pgrep -x ii >/dev/null \
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`'
@@ -246,6 +250,8 @@ while pgrep -x ii >/dev/null \
printf ' FROM `binary_packages`'
mysql_join_binary_packages_dependencies
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
mysql_join_dependencies_dependency_types
mysql_join_dependencies_versions
mysql_join_dependencies_install_targets
@@ -458,6 +464,8 @@ done
"${tmp_dir}/remove-those-dependencies"
printf 'SELECT `d`.`id` FROM `binary_packages`'
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
printf ' JOIN `rd`'
printf ' ON `rd`.`pf`='
mysql_package_name_query
@@ -529,6 +537,8 @@ done
printf '`ad`.`vr`'
printf ' FROM `binary_packages`'
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
printf ' JOIN `ad`'
printf ' ON `ad`.`pf`='
mysql_package_name_query
diff --git a/bin/return-assignment b/bin/return-assignment
index c8c6ecf..d9ba283 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -758,6 +758,8 @@ find . -maxdepth 1 -name '*.pkg.tar.xz' -printf '%f\n' > \
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
printf ' WHERE `binary_packages`.`build_assignment`=from_base64("%s")' \
"$(
@@ -820,6 +822,8 @@ fi
printf ' AND `binary_packages_in_repositories`.`repository`=%s' \
"${repository_ids__any_build_list}"
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
mysql_join_build_assignments_package_sources
mysql_join_package_sources_upstream_repositories
mysql_join_upstream_repositories_repository_moves
diff --git a/bin/sanity-check b/bin/sanity-check
index 75a4206..74b084e 100755
--- a/bin/sanity-check
+++ b/bin/sanity-check
@@ -469,6 +469,8 @@ while [ $# -gt 0 ]; do
mysql_join_binary_packages_in_repositories_repositories
printf ' AND `repositories`.`is_on_master_mirror`'
mysql_join_binary_packages_architectures
+ printf ' LEFT'
+ mysql_join_binary_packages_compressions
mysql_join_repositories_architectures '' 'r_a'
} | \
mysql_run_query | \
diff --git a/bin/seed-build-list b/bin/seed-build-list
index 4a8f9b5..cb8e647 100755
--- a/bin/seed-build-list
+++ b/bin/seed-build-list
@@ -235,6 +235,8 @@ if [ -s "${tmp_dir}/mirrors" ]; then
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`'
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`'