index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-01-17 15:24:40 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-01-17 15:24:40 +0100 |
commit | c9f55c95cb382e22c41a310c1005e3de43379ae9 (patch) | |
tree | 38210b816af5645dad7fad10b1de6a32fe89c76b /bin/bootstrap-mysql | |
parent | 294c66ccc56ee6200b288585833cae1d1bfc3ea8 (diff) |
-rwxr-xr-x | bin/bootstrap-mysql | 72 |
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"' |