diff options
Diffstat (limited to 'bin/db-update')
-rwxr-xr-x | bin/db-update | 60 |
1 files changed, 40 insertions, 20 deletions
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' |