summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-01-17 15:24:40 +0100
committerErich Eckner <git@eckner.net>2019-01-17 15:24:40 +0100
commitc9f55c95cb382e22c41a310c1005e3de43379ae9 (patch)
tree38210b816af5645dad7fad10b1de6a32fe89c76b /bin
parent294c66ccc56ee6200b288585833cae1d1bfc3ea8 (diff)
downloadbuilder-c9f55c95cb382e22c41a310c1005e3de43379ae9.tar.xz
style: WHERE,ON,FROM,SELECT,JOIN should be on beginning of source lines
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bootstrap-mysql72
-rwxr-xr-xbin/build-master-status28
-rwxr-xr-xbin/check-db-structure6
-rwxr-xr-xbin/cleanup5
-rwxr-xr-xbin/copy-to-build-support3
-rwxr-xr-xbin/db-update60
-rwxr-xr-xbin/delete-packages30
-rwxr-xr-xbin/get-assignment9
-rwxr-xr-xbin/get-package-updates3
-rwxr-xr-xbin/interpret-mail9
-rwxr-xr-xbin/modify-package-state5
-rwxr-xr-xbin/return-assignment35
-rwxr-xr-xbin/sanity-check12
-rwxr-xr-xbin/seed-build-list24
-rwxr-xr-xbin/why-dont-you13
15 files changed, 211 insertions, 103 deletions
diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql
index 75043e6..823fb54 100755
--- a/bin/bootstrap-mysql
+++ b/bin/bootstrap-mysql
@@ -115,10 +115,12 @@ fi
printf 'INSERT IGNORE INTO `replaced_bpir` (`id`,`replaced_by`)'
printf ' SELECT `r_bpir`.`id`,`m_bpir`.`id`'
printf ' FROM `moveable_bpir`'
- printf ' JOIN `binary_packages_in_repositories` AS `m_bpir` ON `m_bpir`.`id`=`moveable_bpir`.`id`'
+ printf ' JOIN `binary_packages_in_repositories` AS `m_bpir`'
+ printf ' ON `m_bpir`.`id`=`moveable_bpir`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages 'm_bpir' 'm_bp'
# in all repositories more stable than its target repository
- printf ' JOIN `repositories` AS `m_to_r` ON `moveable_bpir`.`to_repository`=`m_to_r`.`id`'
+ printf ' JOIN `repositories` AS `m_to_r`'
+ printf ' ON `moveable_bpir`.`to_repository`=`m_to_r`.`id`'
printf ' JOIN `repository_stability_relations` AS `rsr`'
printf ' ON `rsr`.`less_stable`=`m_to_r`.`stability`'
printf ' JOIN `repositories` AS `r_r`'
@@ -145,7 +147,8 @@ fi
# only the least stable of equally named to-be-replaced packages is
# kept
- printf 'DELETE `replaced_bpir` FROM `replaced_bpir`'
+ printf 'DELETE `replaced_bpir`'
+ printf ' FROM `replaced_bpir`'
printf ' JOIN `binary_packages_in_repositories` AS `not_r_bpir`'
printf ' ON `not_r_bpir`.`id`=`replaced_bpir`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages 'not_r_bpir' 'not_r_bp'
@@ -163,7 +166,8 @@ fi
printf ' AND `rsr`.`more_stable`=`not_r_r`.`stability`;\n'
# now we delete all unreplaceable and unmoveable packages from the respective
- # list until no further changes are required
+ # list until no further changes are required, e.g. until all packages are
+ # moveable or replaceable respectively
printf 'REPEAT\n'
printf 'SET row_count_saved = 0;\n'
@@ -185,30 +189,37 @@ fi
printf ' FROM `replaced_bpir`'
printf ' RIGHT JOIN `moveable_bpir`'
printf ' ON `moveable_bpir`.`id`=`replaced_bpir`.`replaced_by`'
- printf ' JOIN `binary_packages_in_repositories` ON `binary_packages_in_repositories`.`id`=`moveable_bpir`.`id`'
- printf ' JOIN `repositories` AS `target_repositories` ON `moveable_bpir`.`to_repository`=`target_repositories`.`id`'
+ printf ' JOIN `binary_packages_in_repositories`'
+ printf ' ON `binary_packages_in_repositories`.`id`=`moveable_bpir`.`id`'
+ printf ' JOIN `repositories` AS `target_repositories`'
+ printf ' ON `moveable_bpir`.`to_repository`=`target_repositories`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_dependencies
mysql_join_dependencies_dependency_types
printf ' AND `dependency_types`.`relevant_for_binary_packages`'
# ... by a not-deleted, "more stable" package already in place or ...
printf ' WHERE NOT EXISTS ('
- printf 'SELECT 1 FROM `install_target_providers`'
+ printf 'SELECT 1'
+ printf ' FROM `install_target_providers`'
mysql_join_install_target_providers_binary_packages '' 'prov_bp'
mysql_join_binary_packages_binary_packages_in_repositories 'prov_bp' 'prov_bpir'
mysql_join_binary_packages_in_repositories_repositories 'prov_bpir' 'prov_r'
- printf ' JOIN `repository_stability_relations` ON `prov_r`.`stability`=`repository_stability_relations`.`more_stable`'
+ printf ' JOIN `repository_stability_relations`'
+ printf ' ON `prov_r`.`stability`=`repository_stability_relations`.`more_stable`'
printf ' WHERE `install_target_providers`.`install_target`=`dependencies`.`depending_on`'
printf ' AND `target_repositories`.`stability`=`repository_stability_relations`.`less_stable`'
printf ' AND NOT EXISTS ('
- printf 'SELECT 1 FROM `replaced_bpir_copy`'
+ printf 'SELECT 1'
+ printf ' FROM `replaced_bpir_copy`'
printf ' WHERE `replaced_bpir_copy`.`id`=`prov_bpir`.`id`'
printf ')'
# ... by a moved package
printf ') AND NOT EXISTS ('
- printf 'SELECT 1 FROM `install_target_providers`'
+ printf 'SELECT 1'
+ printf ' FROM `install_target_providers`'
mysql_join_install_target_providers_binary_packages_in_repositories '' 'itp_bpir'
- printf ' JOIN `moveable_bpir_copy` ON `moveable_bpir_copy`.`id`=`itp_bpir`.`id`'
+ printf ' JOIN `moveable_bpir_copy`'
+ printf ' ON `moveable_bpir_copy`.`id`=`itp_bpir`.`id`'
printf ' WHERE `install_target_providers`.`install_target`=`dependencies`.`depending_on`'
printf ');\n'
printf 'SET row_count_saved = row_count_saved + ROW_COUNT();\n'
@@ -243,16 +254,21 @@ fi
#
# However, in practice both should not happen.
#
- printf 'DELETE `replaced_bpir`,`moveable_bpir` FROM `replaced_bpir`'
- printf ' JOIN `moveable_bpir` ON `replaced_bpir`.`replaced_by`=`moveable_bpir`.`id`'
- printf ' JOIN `binary_packages_in_repositories` AS `repl_bpir` ON `repl_bpir`.`id`=`replaced_bpir`.`id`'
+ printf 'DELETE `replaced_bpir`,`moveable_bpir`'
+ printf ' FROM `replaced_bpir`'
+ printf ' JOIN `moveable_bpir`'
+ printf ' ON `replaced_bpir`.`replaced_by`=`moveable_bpir`.`id`'
+ printf ' JOIN `binary_packages_in_repositories` AS `repl_bpir`'
+ printf ' ON `repl_bpir`.`id`=`replaced_bpir`.`id`'
mysql_join_binary_packages_in_repositories_install_target_providers 'repl_bpir'
mysql_join_binary_packages_in_repositories_repositories 'repl_bpir' 'repl_r'
mysql_join_install_target_providers_dependencies_with_versions
printf ' AND NOT EXISTS ('
# dependencies of replaced packages don't matter
- printf 'SELECT 1 FROM `replaced_bpir_copy`'
- printf ' JOIN `binary_packages_in_repositories` AS `repl_bpir_copy` ON `repl_bpir_copy`.`id`=`replaced_bpir_copy`.`id`'
+ printf 'SELECT 1'
+ printf ' FROM `replaced_bpir_copy`'
+ printf ' JOIN `binary_packages_in_repositories` AS `repl_bpir_copy`'
+ printf ' ON `repl_bpir_copy`.`id`=`replaced_bpir_copy`.`id`'
mysql_join_binary_packages_in_repositories_repositories 'repl_bpir_copy' 'repl_r_copy'
printf ' WHERE `repl_bpir_copy`.`package`=`dependencies`.`dependent`'
printf ' AND `repl_r_copy`.`architecture`=`repl_r`.`architecture`'
@@ -274,7 +290,8 @@ fi
# no moved package ...
printf 'SELECT 1'
printf ' FROM `moveable_bpir_copy`'
- printf ' JOIN `binary_packages_in_repositories` AS `subst_bpir` ON `subst_bpir`.`id`=`moveable_bpir_copy`.`id`'
+ printf ' JOIN `binary_packages_in_repositories` AS `subst_bpir`'
+ printf ' ON `subst_bpir`.`id`=`moveable_bpir_copy`.`id`'
mysql_join_binary_packages_in_repositories_install_target_providers 'subst_bpir' 'subst_itp'
mysql_join_binary_packages_in_repositories_repositories 'subst_bpir' 'subst_r'
# ... provides the same
@@ -297,7 +314,8 @@ fi
# architectures are not less or more stable than each other)
printf ' AND NOT EXISTS ('
# ... and which is not replaced ...
- printf 'SELECT 1 FROM `replaced_bpir_copy2`'
+ printf 'SELECT 1'
+ printf ' FROM `replaced_bpir_copy2`'
printf ' WHERE `replaced_bpir_copy2`.`id`=`subst_bpir`.`id`'
printf ')'
# ... and provides the same
@@ -321,7 +339,8 @@ fi
done
# remove all packages of a blob, where some part cannot be moved
- printf 'DELETE `replaced_bpir`,`moveable_bpir` FROM `replaced_bpir`'
+ printf 'DELETE `replaced_bpir`,`moveable_bpir`'
+ printf ' FROM `replaced_bpir`'
printf ' RIGHT JOIN `moveable_bpir`'
printf ' ON `replaced_bpir`.`replaced_by`=`moveable_bpir`.`id`'
printf ' JOIN `binary_packages_in_repositories`'
@@ -335,7 +354,8 @@ fi
mysql_join_build_assignments_binary_packages 'bl_ba' 'bl_bp'
mysql_join_binary_packages_binary_packages_in_repositories 'bl_bp' 'bl_bpir'
printf ' WHERE NOT EXISTS ('
- printf 'SELECT 1 FROM `moveable_bpir_copy`'
+ printf 'SELECT 1'
+ printf ' FROM `moveable_bpir_copy`'
printf ' WHERE `moveable_bpir_copy`.`id`=`bl_bpir`.`id`'
printf ');\n'
printf 'SET row_count_saved = row_count_saved + ROW_COUNT();\n'
@@ -359,7 +379,8 @@ fi
done
done
- printf 'DELETE `replaced_bpir` FROM `replaced_bpir`'
+ printf 'DELETE `replaced_bpir`'
+ printf ' FROM `replaced_bpir`'
printf ' JOIN `moveable_bpir`'
printf ' ON `replaced_bpir`.`replaced_by`=`moveable_bpir`.`id`'
printf ' JOIN `binary_packages_in_repositories` AS `r_bpir`'
@@ -474,7 +495,8 @@ fi
printf 'SET row_count_saved = row_count_saved + ROW_COUNT();\n'
done
printf 'UNTIL (row_count_saved=0) OR EXISTS ('
- printf 'SELECT 1 FROM `knots`'
+ printf 'SELECT 1'
+ printf ' FROM `knots`'
printf ' WHERE `knots`.`reason_length` IS NOT NULL'
printf ' AND `knots`.`content_id`=`bpir`'
printf ' AND `knots`.`content_type`="bpir"'
@@ -488,7 +510,8 @@ fi
printf ' `knots_copy`.`active`=`knots`.`active`;\n'
printf 'IF NOT EXISTS ('
- printf 'SELECT 1 FROM `knots`'
+ printf 'SELECT 1'
+ printf ' FROM `knots`'
printf ' WHERE `knots`.`reason_length` IS NOT NULL'
printf ' AND `knots`.`content_id`=`bpir`'
printf ' AND `knots`.`content_type`="bpir"'
@@ -504,7 +527,8 @@ fi
printf 'END IF;\n'
printf 'IF ('
- printf 'SELECT `knots`.`active` FROM `knots`'
+ printf 'SELECT `knots`.`active`'
+ printf ' FROM `knots`'
printf ' WHERE `knots`.`reason_length` IS NOT NULL'
printf ' AND `knots`.`content_id`=`bpir`'
printf ' AND `knots`.`content_type`="bpir"'
diff --git a/bin/build-master-status b/bin/build-master-status
index 3605a02..cb18280 100755
--- a/bin/build-master-status
+++ b/bin/build-master-status
@@ -62,7 +62,8 @@ if [ -s "${tmp_dir}/todos" ]; then
done
printf 'UPDATE `todos`'
- printf ' JOIN `td` ON `todos`.`id`=`td`.`id`'
+ printf ' JOIN `td`'
+ printf ' ON `todos`.`id`=`td`.`id`'
printf ',`todos`.`%s`=`td`.`%s`' \
'file' 'file' \
'line' 'line' \
@@ -75,20 +76,25 @@ if [ -s "${tmp_dir}/todos" ]; then
printf ' FROM `td`'
printf ' WHERE `td`.`id` IS NULL;\n'
- printf 'DELETE FROM `todos` WHERE NOT EXISTS ('
- printf 'SELECT 1 FROM `td`'
- printf ' AND `td`.`%s`=`todos`.`%s`' \
- 'file' 'file' \
- 'line' 'line' \
- 'description' 'description' | \
- sed 's/^ AND / WHERE /'
+ printf 'DELETE FROM `todos`'
+ printf ' WHERE NOT EXISTS ('
+ printf 'SELECT 1'
+ printf ' FROM `td`'
+ printf ' AND `td`.`%s`=`todos`.`%s`' \
+ 'file' 'file' \
+ 'line' 'line' \
+ 'description' 'description' | \
+ sed 's/^ AND / WHERE /'
printf ');\n'
printf 'DROP TEMPORARY TABLE `td`;\n'
- printf 'DELETE FROM `todo_links` WHERE NOT EXISTS ('
- printf 'SELECT 1 FROM `todos` '
+ printf 'DELETE FROM `todo_links`'
+ printf ' WHERE NOT EXISTS ('
+ printf 'SELECT 1'
+ printf ' FROM `todos` '
printf 'WHERE `todos`.`id`=`todo_links`.`depending_on`'
printf ') OR NOT EXISTS ('
- printf 'SELECT 1 FROM `todos` '
+ printf 'SELECT 1'
+ printf ' FROM `todos` '
printf 'WHERE `todos`.`id`=`todo_links`.`dependent`'
printf ');\n'
} | \
diff --git a/bin/check-db-structure b/bin/check-db-structure
index afe01bd..1055b08 100755
--- a/bin/check-db-structure
+++ b/bin/check-db-structure
@@ -9,7 +9,11 @@
# shellcheck disable=SC2016
{
- printf 'SELECT `proc`.`name` FROM `mysql`.`proc` WHERE `proc`.`Db`="buildmaster"' | \
+ {
+ printf 'SELECT `proc`.`name`'
+ printf ' FROM `mysql`.`proc`'
+ printf ' WHERE `proc`.`Db`="buildmaster"'
+ } | \
mysql_run_query | \
while read -r procedure; do
printf 'SHOW CREATE PROCEDURE `%s`;\n' "${procedure}"
diff --git a/bin/cleanup b/bin/cleanup
index 56d88cb..64f0689 100755
--- a/bin/cleanup
+++ b/bin/cleanup
@@ -24,7 +24,10 @@ fi
{
find "${build_log_directory}/error" -maxdepth 1 -type f -printf 'file %f\n'
# shellcheck disable=SC2016
- printf 'SELECT "mysql",`failed_builds`.`log_file` FROM `failed_builds`;\n' | \
+ {
+ printf 'SELECT "mysql",`failed_builds`.`log_file`'
+ printf ' FROM `failed_builds`;\n'
+ } | \
mysql_run_query | \
tr '\t' ' '
} | \
diff --git a/bin/copy-to-build-support b/bin/copy-to-build-support
index 28c904d..c1d5cfb 100755
--- a/bin/copy-to-build-support
+++ b/bin/copy-to-build-support
@@ -107,7 +107,8 @@ sed -n '
printf ' `architectures`.`name`=from_base64("%s")' \
"$(printf '%s' "${architecture}" | base64 -w0)"
printf ' AND NOT EXISTS ('
- printf 'SELECT 1 FROM `binary_packages_in_repositories` AS `bs_bpir`'
+ printf 'SELECT 1'
+ printf ' FROM `binary_packages_in_repositories` AS `bs_bpir`'
mysql_join_binary_packages_in_repositories_repositories 'bs_bpir' 'bs_r'
printf ' WHERE `bs_bpir`.`package`=`binary_packages`.`id`'
printf ' AND `bs_r`.`name`="build-support"'
diff --git a/bin/db-update b/bin/db-update
index bcc5ccf..cd8e8e9 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -192,14 +192,17 @@ for source_stability in \
printf 'from_base64("%s"),' \
${force_pkgs} | \
sed 's/,$/);\n/'
- printf 'DELETE `moveable_bpir` FROM `moveable_bpir`'
- printf ' JOIN `binary_packages_in_repositories` ON `binary_packages_in_repositories`.`id`=`moveable_bpir`.`id`'
+ printf 'DELETE `moveable_bpir`'
+ printf ' FROM `moveable_bpir`'
+ printf ' JOIN `binary_packages_in_repositories`'
+ printf ' ON `binary_packages_in_repositories`.`id`=`moveable_bpir`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_in_repositories_repositories
printf ' WHERE `repositories`.`stability`!=%s;\n' \
"${source_stability}"
printf 'UPDATE `moveable_bpir`'
- printf ' JOIN `binary_packages_in_repositories` ON `binary_packages_in_repositories`.`id`=`moveable_bpir`.`id`'
+ printf ' JOIN `binary_packages_in_repositories`'
+ printf ' ON `binary_packages_in_repositories`.`id`=`moveable_bpir`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_build_assignments
mysql_join_build_assignments_package_sources
@@ -207,16 +210,20 @@ for source_stability in \
mysql_join_upstream_repositories_repository_moves
printf ' AND `repository_moves`.`from_repository`=`binary_packages_in_repositories`.`repository`'
printf ' SET `moveable_bpir`.`to_repository`=`repository_moves`.`to_repository`;\n'
- printf 'DELETE FROM `moveable_bpir` WHERE `moveable_bpir`.`to_repository` IS NULL;\n'
+ printf 'DELETE FROM `moveable_bpir`'
+ printf ' WHERE `moveable_bpir`.`to_repository` IS NULL;\n'
printf 'INSERT IGNORE INTO `replaced_bpir` (`id`,`replaced_by`)'
printf ' SELECT `binary_packages_in_repositories`.`id`,`moveable_bpir`.`id`'
printf ' FROM `moveable_bpir`'
- printf ' JOIN `binary_packages_in_repositories` AS `subst_bpir` ON `moveable_bpir`.`id`=`subst_bpir`.`id`'
+ printf ' JOIN `binary_packages_in_repositories` AS `subst_bpir`'
+ printf ' ON `moveable_bpir`.`id`=`subst_bpir`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages 'subst_bpir' 'subst_bp'
- printf ' JOIN `binary_packages` ON `binary_packages`.`pkgname`=`subst_bp`.`pkgname`'
+ printf ' JOIN `binary_packages`'
+ printf ' ON `binary_packages`.`pkgname`=`subst_bp`.`pkgname`'
mysql_join_binary_packages_binary_packages_in_repositories
mysql_join_binary_packages_in_repositories_repositories
- printf ' JOIN `repositories` AS `m_to_r` ON `moveable_bpir`.`to_repository`=`m_to_r`.`id`'
+ printf ' JOIN `repositories` AS `m_to_r`'
+ printf ' ON `moveable_bpir`.`to_repository`=`m_to_r`.`id`'
printf ' AND `repositories`.`stability`=`m_to_r`.`stability`'
printf ' AND `repositories`.`architecture`=`m_to_r`.`architecture`;\n'
elif ${progressive}; then
@@ -252,7 +259,8 @@ for source_stability in \
printf ' AND `dependency_types`.`relevant_for_binary_packages`'
mysql_join_dependencies_versions '' 'd_v'
printf ' WHERE NOT EXISTS ('
- printf 'SELECT 1 FROM `install_target_providers`'
+ printf 'SELECT 1'
+ printf ' FROM `install_target_providers`'
mysql_join_install_target_providers_binary_packages '' 'itp_bp'
mysql_join_binary_packages_binary_packages_in_repositories 'itp_bp' 'itp_bpir'
mysql_join_binary_packages_in_repositories_repositories 'itp_bpir' 'itp_r'
@@ -269,7 +277,8 @@ for source_stability in \
printf ' AND `rsr_a`.`less_stable`=`old_r`.`stability`'
# this is the least stable package of stability at least to_r.stability
printf ' AND NOT EXISTS ('
- printf 'SELECT 1 FROM `binary_packages` AS `subst_bp`'
+ printf 'SELECT 1'
+ printf ' FROM `binary_packages` AS `subst_bp`'
mysql_join_binary_packages_binary_packages_in_repositories 'subst_bp' 'subst_bpir'
mysql_join_binary_packages_in_repositories_repositories 'subst_bpir' 'subst_r'
printf ' JOIN `repository_stability_relations` AS `rsr_b`'
@@ -287,7 +296,8 @@ for source_stability in \
printf 'INSERT IGNORE INTO `moveable_bpir` (`id`,`to_repository`)'
printf ' SELECT `replaced_bpir`.`replaced_by`,`binary_packages_in_repositories`.`repository`'
printf ' FROM `replaced_bpir`'
- printf ' JOIN `binary_packages_in_repositories` ON `binary_packages_in_repositories`.`id`=`replaced_bpir`.`id`'
+ printf ' JOIN `binary_packages_in_repositories`'
+ printf ' ON `binary_packages_in_repositories`.`id`=`replaced_bpir`.`id`'
printf ';\n'
# packages which replace nothing
@@ -307,7 +317,8 @@ for source_stability in \
printf ' JOIN `repositories` as `to_r`'
printf ' ON `to_r`.`id`=`repository_moves`.`to_repository`'
printf ' WHERE NOT EXISTS ('
- printf 'SELECT 1 FROM `binary_packages_in_repositories` AS `repl_bpir`'
+ printf 'SELECT 1'
+ printf ' FROM `binary_packages_in_repositories` AS `repl_bpir`'
mysql_join_binary_packages_in_repositories_binary_packages 'repl_bpir' 'repl_bp'
mysql_join_binary_packages_in_repositories_repositories 'repl_bpir' 'repl_r'
printf ' WHERE `repl_bp`.`pkgname`=`binary_packages`.`pkgname`'
@@ -326,15 +337,18 @@ for source_stability in \
printf 'INSERT IGNORE INTO `rps` (`id`)'
printf ' SELECT `binary_packages_in_repositories`.`repository`'
printf ' FROM `moveable_bpir`'
- printf ' JOIN `binary_packages_in_repositories` ON `moveable_bpir`.`id`=`binary_packages_in_repositories`.`id`;\n'
+ printf ' JOIN `binary_packages_in_repositories`'
+ printf ' ON `moveable_bpir`.`id`=`binary_packages_in_repositories`.`id`;\n'
printf 'INSERT IGNORE INTO `rps` (`id`)'
printf ' SELECT `binary_packages_in_repositories`.`repository`'
printf ' FROM `replaced_bpir`'
- printf ' JOIN `binary_packages_in_repositories` ON `replaced_bpir`.`id`=`binary_packages_in_repositories`.`id`;\n'
+ printf ' JOIN `binary_packages_in_repositories`'
+ printf ' ON `replaced_bpir`.`id`=`binary_packages_in_repositories`.`id`;\n'
printf 'SELECT "repositories",`architectures`.`name`,`repositories`.`name`'
printf ' FROM `rps`'
- printf ' JOIN `repositories` ON `rps`.`id`=`repositories`.`id`'
+ printf ' JOIN `repositories`'
+ printf ' ON `rps`.`id`=`repositories`.`id`'
mysql_join_repositories_architectures
printf ';\n'
@@ -345,12 +359,14 @@ for source_stability in \
mysql_package_name_query
printf ',`r_a`.`name`,`repositories`.`name`,`new_r_a`.`name`,`new_repo`.`name`'
printf ' FROM `moveable_bpir`'
- printf ' JOIN `binary_packages_in_repositories` ON `moveable_bpir`.`id`=`binary_packages_in_repositories`.`id`'
+ printf ' JOIN `binary_packages_in_repositories`'
+ printf ' ON `moveable_bpir`.`id`=`binary_packages_in_repositories`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_in_repositories_repositories
mysql_join_binary_packages_architectures
mysql_join_repositories_architectures '' 'r_a'
- printf ' JOIN `repositories` AS `new_repo` ON `new_repo`.`id`=`moveable_bpir`.`to_repository`'
+ printf ' JOIN `repositories` AS `new_repo`'
+ printf ' ON `new_repo`.`id`=`moveable_bpir`.`to_repository`'
mysql_join_repositories_architectures 'new_repo' 'new_r_a'
printf ';\n'
@@ -361,7 +377,8 @@ for source_stability in \
mysql_package_name_query
printf ',`r_a`.`name`,`repositories`.`name`'
printf ' FROM `replaced_bpir`'
- printf ' JOIN `binary_packages_in_repositories` ON `replaced_bpir`.`id`=`binary_packages_in_repositories`.`id`'
+ printf ' JOIN `binary_packages_in_repositories`'
+ printf ' ON `replaced_bpir`.`id`=`binary_packages_in_repositories`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_in_repositories_repositories
mysql_join_binary_packages_architectures
@@ -454,11 +471,14 @@ for source_stability in \
printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `%s` COLUMNS TERMINATED BY " ";\n' \
"${tmp_dir}/mv.id" 'moved_bpir' \
"${tmp_dir}/rm.id" 'replaced_bpir'
- printf 'DELETE `binary_packages_in_repositories` FROM `binary_packages_in_repositories`'
- printf ' JOIN `replaced_bpir` ON `binary_packages_in_repositories`.`id`=`replaced_bpir`.`id`;\n'
+ printf 'DELETE `binary_packages_in_repositories`'
+ printf ' FROM `binary_packages_in_repositories`'
+ printf ' JOIN `replaced_bpir`'
+ printf ' ON `binary_packages_in_repositories`.`id`=`replaced_bpir`.`id`;\n'
mysql_query_and_delete_unneeded_binary_packages
printf 'UPDATE `binary_packages_in_repositories`'
- printf ' JOIN `moved_bpir` ON `binary_packages_in_repositories`.`id`=`moved_bpir`.`id`'
+ printf ' JOIN `moved_bpir`'
+ printf ' ON `binary_packages_in_repositories`.`id`=`moved_bpir`.`id`'
printf ' SET `binary_packages_in_repositories`.`repository`=`moved_bpir`.`new_repository`,'
printf '`binary_packages_in_repositories`.`last_moved`=NOW()'
printf ' WHERE `binary_packages_in_repositories`.`repository`!=`moved_bpir`.`new_repository`;\n'
diff --git a/bin/delete-packages b/bin/delete-packages
index 103288a..daa281d 100755
--- a/bin/delete-packages
+++ b/bin/delete-packages
@@ -190,7 +190,8 @@ export TMPDIR="${tmp_dir}"
printf ' AND `repositories`.`is_on_master_mirror`'
printf ' AND NOT EXISTS ('
# no packages depending on that one exist
- printf 'SELECT 1 FROM `dependencies`'
+ printf 'SELECT 1'
+ printf ' FROM `dependencies`'
mysql_join_dependencies_dependency_types
printf ' AND `dependency_types`.`relevant_for_binary_packages`'
mysql_join_dependencies_binary_packages '' 'd_bp'
@@ -206,7 +207,8 @@ export TMPDIR="${tmp_dir}"
printf ' WHERE `install_target_providers`.`install_target`=`dependencies`.`depending_on`'
printf ' AND `d_r`.`architecture`=`repositories`.`architecture`'
printf ' AND NOT EXISTS ('
- printf 'SELECT 1 FROM `binary_packages` AS `s_bp`'
+ printf 'SELECT 1'
+ printf ' FROM `binary_packages` AS `s_bp`'
mysql_join_binary_packages_binary_packages_in_repositories 's_bp' 's_bpir'
printf ' AND NOT `s_bpir`.`is_to_be_deleted`'
mysql_join_binary_packages_install_target_providers 's_bp' 's_itp'
@@ -226,11 +228,14 @@ export TMPDIR="${tmp_dir}"
printf 'INSERT IGNORE INTO `bp_to_delete`'
printf ' SELECT `binary_packages_in_repositories`.`package`'
printf ' FROM `bpir_to_delete`'
- printf ' JOIN `binary_packages_in_repositories` ON `bpir_to_delete`.`id`=`binary_packages_in_repositories`.`id`;\n'
+ printf ' JOIN `binary_packages_in_repositories`'
+ printf ' ON `bpir_to_delete`.`id`=`binary_packages_in_repositories`.`id`;\n'
# then remove all bp_to_delete which are actually still needed
- printf 'DELETE `bp_to_delete` FROM `bp_to_delete`'
- printf ' JOIN `binary_packages` ON `binary_packages`.`id`=`bp_to_delete`.`id`'
+ printf 'DELETE `bp_to_delete`'
+ printf ' FROM `bp_to_delete`'
+ printf ' JOIN `binary_packages`'
+ printf ' ON `binary_packages`.`id`=`bp_to_delete`.`id`'
mysql_join_binary_packages_binary_packages_in_repositories
printf ' WHERE NOT EXISTS ('
printf 'SELECT 1'
@@ -243,7 +248,8 @@ export TMPDIR="${tmp_dir}"
printf '`architectures`.`name`,'
printf '`repositories`.`name`'
printf ' FROM `bpir_to_delete`'
- printf ' JOIN `binary_packages_in_repositories` ON `bpir_to_delete`.`id`=`binary_packages_in_repositories`.`id`'
+ printf ' JOIN `binary_packages_in_repositories`'
+ printf ' ON `bpir_to_delete`.`id`=`binary_packages_in_repositories`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_in_repositories_repositories
mysql_join_repositories_architectures
@@ -255,7 +261,8 @@ export TMPDIR="${tmp_dir}"
printf '`repositories`.`name`,'
printf '`binary_packages`.`pkgname`'
printf ' FROM `bpir_to_delete`'
- printf ' JOIN `binary_packages_in_repositories` ON `bpir_to_delete`.`id`=`binary_packages_in_repositories`.`id`'
+ printf ' JOIN `binary_packages_in_repositories`'
+ printf ' ON `bpir_to_delete`.`id`=`binary_packages_in_repositories`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_in_repositories_repositories
mysql_join_repositories_architectures
@@ -266,7 +273,8 @@ export TMPDIR="${tmp_dir}"
printf '`repositories`.`name`,"/",'
mysql_package_name_query
printf ') FROM `bpir_to_delete`'
- printf ' JOIN `binary_packages_in_repositories` ON `bpir_to_delete`.`id`=`binary_packages_in_repositories`.`id`'
+ printf ' JOIN `binary_packages_in_repositories`'
+ printf ' ON `bpir_to_delete`.`id`=`binary_packages_in_repositories`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages
mysql_join_binary_packages_in_repositories_repositories
mysql_join_binary_packages_architectures
@@ -281,7 +289,8 @@ export TMPDIR="${tmp_dir}"
printf '"pool/",'
mysql_package_name_query
printf ') FROM `bp_to_delete`'
- printf ' JOIN `binary_packages` ON `bp_to_delete`.`id`=`binary_packages`.`id`'
+ printf ' JOIN `binary_packages`'
+ printf ' ON `bp_to_delete`.`id`=`binary_packages`.`id`'
mysql_join_binary_packages_architectures
printf ';\n'
@@ -398,7 +407,8 @@ fi
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'
} | \
diff --git a/bin/get-assignment b/bin/get-assignment
index 3fc0d49..27a266a 100755
--- a/bin/get-assignment
+++ b/bin/get-assignment
@@ -253,10 +253,12 @@ next_building=$(
printf ' ON `build_assignments`.`id`=`considered_build_assignments`.`id`'
mysql_join_build_assignments_package_sources
printf ' WHERE NOT EXISTS ('
- printf 'SELECT 1 FROM `toolchain_order`'
+ printf 'SELECT 1'
+ printf ' FROM `toolchain_order`'
printf ' WHERE `toolchain_order`.`pkgbase`=`package_sources`.`pkgbase`'
printf ') AND EXISTS ('
- printf 'SELECT 1 FROM `considered_build_assignments_2`'
+ printf 'SELECT 1'
+ printf ' FROM `considered_build_assignments_2`'
printf ' JOIN `build_assignments`'
printf ' ON `build_assignments`.`id`=`considered_build_assignments_2`.`id`'
mysql_join_build_assignments_package_sources
@@ -282,7 +284,8 @@ next_building=$(
printf 'DELETE `considered_build_assignments`'
printf ' FROM `considered_build_assignments`'
printf ' WHERE EXISTS ('
- printf 'SELECT 1 FROM `considered_build_assignments_2`'
+ printf 'SELECT 1'
+ printf ' FROM `considered_build_assignments_2`'
printf ' JOIN `build_assignments`'
printf ' ON `build_assignments`.`id`=`considered_build_assignments_2`.`id`'
mysql_join_build_assignments_package_sources
diff --git a/bin/get-package-updates b/bin/get-package-updates
index 622bd0b..9271c90 100755
--- a/bin/get-package-updates
+++ b/bin/get-package-updates
@@ -209,7 +209,8 @@ for repo in ${repo_names}; do
# shellcheck disable=SC2016
eval "old_repo_revisions__${repo}='$(
{
- printf 'SELECT `git_repositories`.`head` FROM `git_repositories`'
+ printf 'SELECT `git_repositories`.`head`'
+ printf ' FROM `git_repositories`'
printf ' WHERE `git_repositories`.`name`=from_base64("%s");\n' \
"$(printf '%s' "${repo}" | base64 -w0)"
} | \
diff --git a/bin/interpret-mail b/bin/interpret-mail
index a925118..fc77716 100755
--- a/bin/interpret-mail
+++ b/bin/interpret-mail
@@ -79,7 +79,8 @@ log() {
base64 -w0
)" \
"${comment}"
- printf ' FROM `email_actions` JOIN `gpg_keys`'
+ printf ' FROM `email_actions`'
+ printf ' JOIN `gpg_keys`'
printf '%s' "${gpg_keys_filter}"
printf ' AND `email_actions`.`name`=from_base64("%s");\n' "$(
printf '%s' "${action}" | \
@@ -168,7 +169,8 @@ fi
gpg_keys_filter=$(
# shellcheck disable=SC2016
{
- printf 'SELECT DISTINCT `gpg_keys`.`id` FROM `gpg_keys`'
+ printf 'SELECT DISTINCT `gpg_keys`.`id`'
+ printf ' FROM `gpg_keys`'
printf ' WHERE `gpg_keys`.`fingerprint` IN ('
grep '^\[GNUPG:] VALIDSIG ' "${tmp_dir}/gpg-status" | \
cut -d' ' -f3 | \
@@ -211,7 +213,8 @@ fi
# shellcheck disable=SC2016
{
- printf 'SELECT DISTINCT `email_actions`.`name` FROM `email_actions`'
+ printf 'SELECT DISTINCT `email_actions`.`name`'
+ printf ' FROM `email_actions`'
mysql_join_email_actions_allowed_email_actions
mysql_join_allowed_email_actions_gpg_keys
printf '%s\n' "${gpg_keys_filter}"
diff --git a/bin/modify-package-state b/bin/modify-package-state
index 7a0c252..b67fc4d 100755
--- a/bin/modify-package-state
+++ b/bin/modify-package-state
@@ -249,7 +249,10 @@ while read -r a b; do
exit 42
;;
esac
- if printf 'SELECT 1 FROM %s %s AND %s LIMIT 1' "${combiner}" "${selector}" "${tester}" | \
+ if {
+ printf 'SELECT 1'
+ printf ' FROM %s %s AND %s LIMIT 1' "${combiner}" "${selector}" "${tester}"
+ } | \
mysql_run_query | \
grep -qxF '1'; then
# shellcheck disable=SC2016
diff --git a/bin/return-assignment b/bin/return-assignment
index e808702..24764d1 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -74,7 +74,10 @@ if [ "$6" = 'ERROR' ]; then
# shellcheck disable=SC2016
infos=$(
{
- printf 'SELECT DISTINCT `build_assignments`.`id`,IF(`build_assignments`.`is_broken`,"true","false") FROM `build_slaves`'
+ printf 'SELECT DISTINCT'
+ printf ' `build_assignments`.`id`,'
+ printf 'IF(`build_assignments`.`is_broken`,"true","false")'
+ printf ' FROM `build_slaves`'
mysql_join_build_slaves_build_assignments
mysql_join_build_assignments_package_sources
mysql_join_package_sources_upstream_repositories
@@ -279,7 +282,8 @@ fi
# shellcheck disable=SC2016
build_assignment_id=$(
{
- printf 'SELECT DISTINCT `build_assignments`.`id` FROM `build_slaves`'
+ printf 'SELECT DISTINCT `build_assignments`.`id`'
+ printf ' FROM `build_slaves`'
mysql_join_build_slaves_build_assignments
mysql_join_build_assignments_package_sources
mysql_join_package_sources_upstream_repositories
@@ -567,7 +571,8 @@ fi
mysql_join_build_assignments_package_sources
mysql_join_package_sources_upstream_repositories
mysql_join_upstream_repositories_repository_moves
- printf ' JOIN `repositories` as `t` ON `t`.`id`=`repository_moves`.`to_repository`'
+ printf ' JOIN `repositories` as `t`'
+ printf ' ON `t`.`id`=`repository_moves`.`to_repository`'
mysql_join_repositories_architectures 't' 't_a'
printf ' JOIN `architecture_compatibilities`'
printf ' ON `architecture_compatibilities`.`built_for`=`binary_packages`.`architecture`'
@@ -716,7 +721,8 @@ trigger_mirror_refreshs
printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `pkg_hashes`;\n' \
"${tmp_dir}/sha512sums"
printf 'UPDATE `binary_packages`'
- printf ' JOIN `pkg_hashes` ON `pkg_hashes`.`pkgid`=`binary_packages`.`id`'
+ printf ' JOIN `pkg_hashes`'
+ printf ' ON `pkg_hashes`.`pkgid`=`binary_packages`.`id`'
printf ' SET `binary_packages`.`sha512sum`=`pkg_hashes`.`sha512sum`;\n'
printf 'COMMIT;\n'
@@ -734,15 +740,19 @@ trigger_mirror_refreshs
"${tmp_dir}/so.${lib_link#*:}" "${lib_link%:*}"
printf 'INSERT IGNORE INTO `install_targets` (`name`)'
- printf ' SELECT DISTINCT `%s`.`lib` FROM `%s`;\n' \
- "${lib_link%:*}" "${lib_link%:*}"
+ printf ' SELECT DISTINCT `%s`.`lib`' \
+ "${lib_link%:*}"
+ printf ' FROM `%s`;\n' \
+ "${lib_link%:*}"
printf 'COMMIT;\n'
# TODO: possibly remove install_target_providers with less restrictive
# versions than we have now
printf 'INSERT IGNORE INTO `versions` (`epoch`,`version`)'
- printf ' SELECT DISTINCT `%s`.`epoch`,`%s`.`version` FROM `%s`;\n' \
- "${lib_link%:*}" "${lib_link%:*}" "${lib_link%:*}"
+ printf ' SELECT DISTINCT `%s`.`epoch`,`%s`.`version`' \
+ "${lib_link%:*}" "${lib_link%:*}"
+ printf ' FROM `%s`;\n' \
+ "${lib_link%:*}"
printf 'COMMIT;\n'
if [ "${lib_link%:*}" = 'pl' ]; then
@@ -933,14 +943,17 @@ trigger_mirror_refreshs
# remove broken loops
printf 'CREATE TEMPORARY TABLE `loops_to_delete` (`loop` MEDIUMINT);\n'
printf 'INSERT IGNORE INTO `loops_to_delete`'
- printf ' SELECT `build_dependency_loops`.`loop` FROM `build_dependency_loops`'
+ printf ' SELECT `build_dependency_loops`.`loop`'
+ printf ' FROM `build_dependency_loops`'
mysql_join_build_dependency_loops_binary_packages
mysql_join_binary_packages_binary_packages_in_repositories
printf ' WHERE NOT `binary_packages_in_repositories`.`repository`=%s;\n' \
"${repository_ids__any_build_list}"
printf 'COMMIT;\n'
- printf 'DELETE FROM `build_dependency_loops` WHERE EXISTS ('
- printf 'SELECT 1 FROM `loops_to_delete`'
+ printf 'DELETE FROM `build_dependency_loops`'
+ printf ' WHERE EXISTS ('
+ printf 'SELECT 1'
+ printf ' FROM `loops_to_delete`'
printf ' WHERE `loops_to_delete`.`loop`=`build_dependency_loops`.`loop`'
printf ');\n'
printf 'DROP TEMPORARY TABLE `loops_to_delete`;\n'
diff --git a/bin/sanity-check b/bin/sanity-check
index 5068687..df0b43c 100755
--- a/bin/sanity-check
+++ b/bin/sanity-check
@@ -61,7 +61,8 @@ archs=$(
printf 'SELECT DISTINCT `architectures`.`name`'
printf ' FROM `architectures`'
printf ' WHERE EXISTS ('
- printf 'SELECT 1 FROM `repositories`'
+ printf 'SELECT 1'
+ printf ' FROM `repositories`'
printf ' WHERE `repositories`.`architecture`=`architectures`.`id`'
printf ' AND `repositories`.`is_on_master_mirror`'
printf ');\n'
@@ -145,7 +146,8 @@ while [ $# -gt 0 ]; do
repo_revision=$(
# shellcheck disable=SC2016
{
- printf 'SELECT `git_repositories`.`head` FROM `git_repositories`'
+ printf 'SELECT `git_repositories`.`head`'
+ printf ' FROM `git_repositories`'
printf ' WHERE `git_repositories`.`name`=from_base64("%s");\n' \
"$(printf '%s' "${repo}" | base64 -w0)"
} | \
@@ -188,7 +190,8 @@ while [ $# -gt 0 ]; do
mysql_join_package_sources_build_assignments
mysql_join_build_assignments_architectures
printf ' WHERE EXISTS('
- printf 'SELECT 1 FROM `binary_packages`'
+ printf 'SELECT 1'
+ printf ' FROM `binary_packages`'
mysql_join_binary_packages_binary_packages_in_repositories
printf ' WHERE `binary_packages_in_repositories`.`repository`=%s' \
"${repository_ids__any_build_list}"
@@ -211,7 +214,8 @@ while [ $# -gt 0 ]; do
errors=$(
# shellcheck disable=SC2016
{
- printf 'SELECT `a`.`pkgname` FROM `binary_packages` AS `a`'
+ printf 'SELECT `a`.`pkgname`'
+ printf ' FROM `binary_packages` AS `a`'
mysql_join_binary_packages_binary_packages_in_repositories 'a' 'air'
mysql_join_binary_packages_in_repositories_repositories 'air' 'a_r'
printf ' AND `a_r`.`name`="build-list"'
diff --git a/bin/seed-build-list b/bin/seed-build-list
index dabb5da..566be63 100755
--- a/bin/seed-build-list
+++ b/bin/seed-build-list
@@ -268,13 +268,15 @@ if [ -s "${tmp_dir}/package-regexes" ]; then
printf 'SELECT DISTINCT "pkgbase",`package_sources`.`pkgbase`,`upstream_repositories`.`name`'
printf ' FROM `names`'
- printf ' JOIN `package_sources` ON `package_sources`.`pkgbase` REGEXP `names`.`name`'
+ printf ' JOIN `package_sources`'
+ printf ' ON `package_sources`.`pkgbase` REGEXP `names`.`name`'
mysql_join_package_sources_upstream_repositories
printf ';\n'
printf 'SELECT DISTINCT "pkgname",`binary_packages`.`pkgname`'
printf ' FROM `names`'
- printf ' JOIN `binary_packages` ON `binary_packages`.`pkgname` REGEXP `names`.`name`;\n'
+ printf ' JOIN `binary_packages`'
+ printf ' ON `binary_packages`.`pkgname` REGEXP `names`.`name`;\n'
} | \
mysql_run_query | \
sed -n '
@@ -389,7 +391,8 @@ fi
printf ' FROM `least_stable_bp`;\n'
# remove packages that should never be rescheduled
- printf 'DELETE `least_stable_bp` FROM `least_stable_bp`'
+ printf 'DELETE `least_stable_bp`'
+ printf ' FROM `least_stable_bp`'
printf ' JOIN `binary_packages`'
printf ' ON `binary_packages`.`id`=`least_stable_bp`.`id`'
# 1)
@@ -550,7 +553,8 @@ fi
printf ' WHERE `build_assignments`.`is_black_listed` IS NOT NULL'
printf ' OR `package_sources`.`pkgbase` LIKE "lib32-%%"'
printf ' OR EXISTS ('
- printf 'SELECT 1 FROM `dependencies`'
+ printf 'SELECT 1'
+ printf ' FROM `dependencies`'
mysql_join_dependencies_dependency_types
printf ' AND ('
printf '`dependency_types`.`relevant_for_building`'
@@ -559,7 +563,8 @@ fi
mysql_join_dependencies_install_target_providers_with_versions '' 'it_dummy'
printf ' WHERE `dependencies`.`dependent`=`binary_packages`.`id`'
printf ' AND NOT EXISTS ('
- printf 'SELECT 1 FROM `install_target_providers`'
+ printf 'SELECT 1'
+ printf ' FROM `install_target_providers`'
mysql_join_install_target_providers_binary_packages '' 'it_bp'
mysql_join_binary_packages_binary_packages_in_repositories 'it_bp' 'it_bpir'
printf ' WHERE NOT `it_bpir`.`is_to_be_deleted`'
@@ -580,7 +585,8 @@ fi
printf '`pkgbases`.`pkgbase`,'
printf '`git_repositories`.`head`,'
printf '('
- printf 'SELECT `al32`.`head` FROM `git_repositories` AS `al32`'
+ printf 'SELECT `al32`.`head`'
+ printf ' FROM `git_repositories` AS `al32`'
printf ' WHERE `al32`.`name`="archlinux32"'
printf '),'
printf '`pkgbases`.`repo`'
@@ -589,13 +595,15 @@ fi
printf ' ON `upstream_repositories`.`name`=`pkgbases`.`repo`'
mysql_join_upstream_repositories_git_repositories
printf ' WHERE NOT EXISTS ('
- printf 'SELECT 1 FROM `ignore_packages`'
+ printf 'SELECT 1'
+ printf ' FROM `ignore_packages`'
printf ' WHERE `ignore_packages`.`pkgbase`=`pkgbases`.`pkgbase`'
printf ' AND `ignore_packages`.`priority`>=`pkgbases`.`priority`'
printf ') AND ('
printf '`pkgbases`.`priority`!=2'
printf ' OR NOT EXISTS ('
- printf 'SELECT 1 FROM `package_sources`'
+ printf 'SELECT 1'
+ printf ' FROM `package_sources`'
mysql_join_package_sources_build_assignments
mysql_join_build_assignments_binary_packages
mysql_join_binary_packages_binary_packages_in_repositories
diff --git a/bin/why-dont-you b/bin/why-dont-you
index a3c2aa2..9fb13f5 100755
--- a/bin/why-dont-you
+++ b/bin/why-dont-you
@@ -46,7 +46,8 @@ case "${action}" in
printf '`to_build`.`baa_name`,'
printf 'If(`to_build`.`is_broken`,1,0),'
printf '('
- printf 'SELECT COUNT(1) FROM `failed_builds`'
+ printf 'SELECT COUNT(1)'
+ printf ' FROM `failed_builds`'
printf 'WHERE `failed_builds`.`build_assignment`=`to_build`.`ba_id`'
printf ')'
printf ',replace(to_base64(`%s`.`%s`),"\\n","")' \
@@ -98,7 +99,8 @@ case "${action}" in
printf ') AS `deps`'
printf ' ON `deps`.`dependent`=`to_build`.`bin_id`'
# now we join with build slaves to see if someone builds this
- printf ' LEFT JOIN `build_slaves` ON `build_slaves`.`currently_building`=`to_build`.`ba_id`'
+ printf ' LEFT JOIN `build_slaves`'
+ printf ' ON `build_slaves`.`currently_building`=`to_build`.`ba_id`'
printf ';\n'
} | \
mysql_run_query | \
@@ -315,7 +317,8 @@ case "${action}" in
printf ' ON `rsr`.`more_stable`=`r_r`.`stability`'
printf ' AND `rsr`.`less_stable`=`m_r`.`stability`'
printf ' WHERE 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'
mysql_join_binary_packages_in_repositories_binary_packages 'subst_bpir' 'subst_bp'
printf ' JOIN `repository_stability_relations` AS `rsr_a`'
@@ -364,7 +367,9 @@ case "${action}" in
printf ' FROM `install_targets`;\n'
# create copy
- printf 'INSERT INTO `knots_copy` SELECT * FROM `knots`;\n'
+ printf 'INSERT INTO `knots_copy`'
+ printf ' SELECT *'
+ printf ' FROM `knots`;\n'
# "available" bpir requires available install_target
printf 'INSERT INTO `edges` (`cause`,`impact`,`invert`)'