Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rwxr-xr-xlib/common-functions12
-rwxr-xr-xlib/mysql-functions59
2 files changed, 48 insertions, 23 deletions
diff --git a/lib/common-functions b/lib/common-functions
index cd938f8..dba56b7 100755
--- a/lib/common-functions
+++ b/lib/common-functions
@@ -94,7 +94,8 @@ find_git_repository_to_package_repository() {
repository=$(
# shellcheck disable=SC2016
{
- printf 'SELECT `git_repositories`.`name` FROM `git_repositories`'
+ printf 'SELECT `git_repositories`.`name`'
+ printf ' FROM `git_repositories`'
mysql_join_git_repositories_upstream_repositories
printf ' WHERE `upstream_repositories`.`name`=from_base64("%s");\n' \
"$(printf '%s' "$1" | base64 -w0)"
@@ -168,7 +169,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 ' JOIN `binary_packages` AS `o_bp` ON `d_bp`.`pkgname`=`o_bp`.`pkgname`'
+ 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'
mysql_join_binary_packages_in_repositories_repositories 'o_bpir' 'o_r'
printf ' AND `o_r`.`is_on_master_mirror`'
@@ -243,8 +245,10 @@ remove_old_package_versions() {
printf 'CREATE TEMPORARY TABLE `del` (`id` BIGINT NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`));\n'
printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `del` (`id`);\n' \
"${tmp_dir}/db-removes"
- printf 'DELETE `binary_packages_in_repositories` FROM `binary_packages_in_repositories`'
- printf ' JOIN `del` ON `binary_packages_in_repositories`.`id`=`del`.`id`;\n'
+ printf 'DELETE `binary_packages_in_repositories`'
+ printf ' FROM `binary_packages_in_repositories`'
+ printf ' JOIN `del`'
+ printf ' ON `binary_packages_in_repositories`.`id`=`del`.`id`;\n'
mysql_query_and_delete_unneeded_binary_packages
} | \
mysql_run_query | \
diff --git a/lib/mysql-functions b/lib/mysql-functions
index a97202b..e0a22ac 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -642,7 +642,8 @@ mysql_sanity_check() {
"${repository_stability_ids__virtual}"
printf 'SELECT DISTINCT CONCAT("split-package with differing sub_pkgrels on the build-list: ",`a`.`pkgname`)'
printf ' FROM `binary_packages` AS `a`'
- printf ' JOIN `binary_packages` AS `b` ON `a`.`build_assignment`=`b`.`build_assignment`'
+ printf ' JOIN `binary_packages` AS `b`'
+ printf ' ON `a`.`build_assignment`=`b`.`build_assignment`'
mysql_join_binary_packages_binary_packages_in_repositories 'a' 'a_bir'
mysql_join_binary_packages_binary_packages_in_repositories 'b' 'b_bir'
printf ' WHERE `a`.`sub_pkgrel`!=`b`.`sub_pkgrel`'
@@ -732,12 +733,14 @@ mysql_sanity_check() {
printf ' FROM `binary_packages`'
mysql_join_binary_packages_architectures
printf ' WHERE NOT EXISTS ('
- printf 'SELECT 1 FROM `binary_packages_in_repositories`'
+ printf 'SELECT 1'
+ printf ' FROM `binary_packages_in_repositories`'
mysql_join_binary_packages_in_repositories_repositories
printf ' WHERE NOT `repositories`.`is_on_master_mirror`'
printf ' AND `binary_packages_in_repositories`.`package`=`binary_packages`.`id`'
printf ') OR EXISTS ('
- printf 'SELECT 1 FROM `binary_packages_in_repositories`'
+ printf 'SELECT 1'
+ printf ' FROM `binary_packages_in_repositories`'
mysql_join_binary_packages_in_repositories_repositories
printf ' WHERE `repositories`.`is_on_master_mirror`'
printf ' AND `binary_packages_in_repositories`.`package`=`binary_packages`.`id`'
@@ -796,7 +799,8 @@ mysql_find_build_assignment_loops() {
printf ' AND ('
printf '`dependency_types`.`relevant_for_binary_packages`'
printf ' OR NOT EXISTS ('
- printf 'SELECT 1 FROM `binary_packages_in_repositories` AS `subst_bpir`'
+ printf 'SELECT 1'
+ printf ' FROM `binary_packages_in_repositories` AS `subst_bpir`'
mysql_join_binary_packages_in_repositories_repositories 'subst_bpir' 'subst_r'
printf ' AND `subst_r`.`is_on_master_mirror`'
mysql_join_binary_packages_in_repositories_binary_packages 'subst_bpir' 'subst_bp'
@@ -876,7 +880,8 @@ mysql_cleanup() {
printf 'FROM `binary_packages`'
printf ' WHERE `binary_packages`.`sha512sum` IS NULL'
printf ' AND NOT EXISTS ('
- printf 'SELECT 1 FROM `binary_packages_in_repositories` '
+ printf 'SELECT 1'
+ printf ' FROM `binary_packages_in_repositories` '
printf 'WHERE `binary_packages_in_repositories`.`package`=`binary_packages`.`id`'
printf ');\n'
# remove build_assignments w/o binary_package
@@ -884,7 +889,8 @@ mysql_cleanup() {
"${operator}"
printf 'WHERE NOT EXISTS '
printf '('
- printf 'SELECT 1 FROM `binary_packages` '
+ printf 'SELECT 1'
+ printf ' FROM `binary_packages` '
printf 'WHERE `binary_packages`.`build_assignment`=`build_assignments`.`id`'
printf ');\n'
# remove failed_builds with unbroken build_assignments
@@ -902,14 +908,16 @@ mysql_cleanup() {
"${operator}"
printf 'WHERE NOT EXISTS '
printf '('
- printf 'SELECT 1 FROM `build_assignments` '
+ printf 'SELECT 1'
+ printf ' FROM `build_assignments` '
printf 'WHERE `build_assignments`.`package_source`=`package_sources`.`id`'
printf ');\n'
# remove jobs from build slaves that are not on the build-list
if [ "${operator}" = 'DELETE' ]; then
printf 'UPDATE `binary_packages_in_repositories`'
else
- printf 'SELECT COUNT(DISTINCT `build_slaves`.`id`) FROM `binary_packages_in_repositories`'
+ printf 'SELECT COUNT(DISTINCT `build_slaves`.`id`)'
+ printf ' FROM `binary_packages_in_repositories`'
fi
mysql_join_binary_packages_in_repositories_binary_packages
printf ' AND `binary_packages_in_repositories`.`repository`=%s' \
@@ -926,11 +934,13 @@ mysql_cleanup() {
printf 'UPDATE `build_slaves`'
printf ' SET `build_slaves`.`currently_building`=NULL'
else
- printf 'SELECT COUNT(1) FROM `build_slaves`'
+ printf 'SELECT COUNT(1)'
+ printf ' FROM `build_slaves`'
fi
printf ' WHERE `build_slaves`.`currently_building` IS NOT NULL'
printf ' AND TIMEDIFF(NOW(),('
- printf 'SELECT MAX(`ssh_log`.`date`) FROM `ssh_log`'
+ printf 'SELECT MAX(`ssh_log`.`date`)'
+ printf ' FROM `ssh_log`'
printf ' WHERE `ssh_log`.`build_slave`=`build_slaves`.`id`'
printf ')) > "1:00:00";\n'
# remove `last_action`, `trials` and `logged_lines` from buildslaves without an assignment
@@ -940,7 +950,8 @@ mysql_cleanup() {
printf ' `build_slaves`.`logged_lines`=NULL,'
printf ' `build_slaves`.`trials`=NULL'
else
- printf 'SELECT COUNT(1) FROM `build_slaves`'
+ printf 'SELECT COUNT(1)'
+ printf ' FROM `build_slaves`'
fi
printf ' WHERE `build_slaves`.`currently_building` IS NULL'
printf ' AND (`build_slaves`.`last_action` IS NOT NULL'
@@ -953,8 +964,12 @@ mysql_cleanup() {
printf 'INSERT IGNORE INTO `ps`(`old_p`)'
printf ' SELECT `build_assignments`.`priority`'
printf ' FROM `build_assignments`;\n'
- printf 'INSERT INTO `ps_%s`(`old_p`) SELECT `ps`.`old_p` FROM `ps`;\n' \
- '2' '3'
+ for copy in '2' '3'; do
+ printf 'INSERT INTO `ps_%s`(`old_p`)' \
+ "${copy}"
+ printf ' SELECT `ps`.`old_p`'
+ printf ' FROM `ps`;\n'
+ done
printf 'UPDATE `ps`'
printf ' LEFT JOIN ('
printf 'SELECT'
@@ -1049,7 +1064,8 @@ mysql_query_has_pending_dependencies() {
# print a mysql query giving whether the package is part of a loop
mysql_query_is_part_of_loop() {
printf 'EXISTS ('
- printf 'SELECT 1 FROM `build_dependency_loops`'
+ printf 'SELECT 1'
+ printf ' FROM `build_dependency_loops`'
printf ' WHERE `build_dependency_loops`.`build_assignment`=%s' \
"$1"
printf ')'
@@ -1227,13 +1243,15 @@ mysql_retrieve_static_information() {
printf '"architecture_ids__",'
printf '`architectures`.`name`,"=",'
printf '`architectures`.`id`'
- printf '),"-","_") FROM `architectures`;\n'
+ printf '),"-","_")'
+ printf ' FROM `architectures`;\n'
printf 'SELECT REPLACE(CONCAT('
printf '"repository_ids__",'
printf '`architectures`.`name`,"_",'
printf '`repositories`.`name`,"=",'
printf '`repositories`.`id`'
- printf '),"-","_") FROM `repositories`'
+ printf '),"-","_")'
+ printf ' FROM `repositories`'
mysql_join_repositories_architectures
printf ';\n'
printf 'SELECT CONCAT('
@@ -1269,12 +1287,15 @@ mysql_query_and_delete_unneeded_binary_packages() {
printf ') FROM `binary_packages`'
mysql_join_binary_packages_architectures
printf ' WHERE NOT EXISTS ('
- printf 'SELECT 1 FROM `binary_packages_in_repositories`'
+ printf 'SELECT 1'
+ printf ' 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 'DELETE `binary_packages`'
+ printf ' FROM `binary_packages`'
printf ' WHERE NOT EXISTS ('
- printf 'SELECT 1 FROM `binary_packages_in_repositories`'
+ printf 'SELECT 1'
+ printf ' FROM `binary_packages_in_repositories`'
printf ' WHERE `binary_packages_in_repositories`.`package`=`binary_packages`.`id`'
printf ');\n'
}