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:
Diffstat (limited to 'lib/mysql-functions')
-rwxr-xr-xlib/mysql-functions59
1 files changed, 40 insertions, 19 deletions
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'
}