Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-04-24 14:19:37 +0200
committerErich Eckner <git@eckner.net>2018-04-24 14:19:37 +0200
commitae36f67281ba7a8c2ca1baa3f51e922d27f93fe1 (patch)
tree6e3986ddd431e3cd291eac2c98faaa262d819307 /bin
parent7673a80a19fa5c8cbd71afe9ecf93ee5ede223de (diff)
bin/bootstrap-mysql,misc/database-layout.dump: do not move packages commited to svn within 10 seconds separately
Diffstat (limited to 'bin')
-rwxr-xr-xbin/bootstrap-mysql52
1 files changed, 52 insertions, 0 deletions
diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql
index 8ccb2a2..2bcd212 100755
--- a/bin/bootstrap-mysql
+++ b/bin/bootstrap-mysql
@@ -367,6 +367,25 @@ if [ ! "$1" = 'slim' ]; then
printf 'CREATE TEMPORARY TABLE `moveable_binary_packages%s` (`id` BIGINT, `to_repository` MEDIUMINT, UNIQUE KEY (`id`));\n' \
"${copy}"
done
+ printf 'DROP TEMPORARY TABLE IF EXISTS `package_blobs`;\n'
+ printf 'CREATE TEMPORARY TABLE `package_blobs` (`ps_a` BIGINT, `ps_b` BIGINT, UNIQUE KEY `content` (`ps_a`,`ps_b`));\n'
+ # all packages being vaguely relevant enter `package_blobs`, because
+ # they might block any other package from moving
+ printf 'INSERT IGNORE INTO `package_blobs` (`ps_a`,`ps_b`)'
+ printf ' SELECT `a_ps`.`id`,`b_ps`.`id`'
+ printf ' FROM `package_sources` AS `a_ps`'
+ printf ' JOIN `package_sources` AS `b_ps`'
+ printf ' ON UNIX_TIMESTAMP(`a_ps`.`commit_time`) - UNIX_TIMESTAMP(`b_ps`.`commit_time`) BETWEEN -10 AND 10'
+ mysql_join_package_sources_build_assignments 'a_ps' 'a_ba'
+ mysql_join_package_sources_build_assignments 'b_ps' 'b_ba'
+ mysql_join_build_assignments_binary_packages 'a_ba' 'a_bp'
+ mysql_join_build_assignments_binary_packages 'b_ba' 'b_bp'
+ mysql_join_binary_packages_repositories 'a_bp' 'a_r'
+ mysql_join_binary_packages_repositories 'b_bp' 'b_r'
+ mysql_join_repositories_repository_stabilities 'a_r' 'a_rs'
+ mysql_join_repositories_repository_stabilities 'b_r' 'b_rs'
+ printf ' WHERE `a_rs`.`name` = `from_stability`'
+ printf ' AND `b_rs`.`name` = `from_stability`;\n'
# these packages are considered for moving:
printf 'INSERT IGNORE INTO `moveable_binary_packages` (`id`,`to_repository`)'
printf ' SELECT `binary_packages`.`id`,`repository_moves`.`to_repository`'
@@ -409,6 +428,7 @@ if [ ! "$1" = 'slim' ]; then
# list until no further changes are required
printf 'REPEAT\n'
printf 'SET row_count_saved = 0;\n'
+
# create copies of our temporary tables *yuck*
for table in 'replaced' 'moveable'; do
for copy in '' '2'; do
@@ -531,6 +551,38 @@ if [ ! "$1" = 'slim' ]; then
# b) 2) ^
printf ');\n'
printf 'SET row_count_saved = row_count_saved + ROW_COUNT();\n'
+
+ # refresh copies of our temporary tables *yuck*
+ for table in 'replaced' 'moveable'; do
+ for copy in '' '2'; do
+ if [ "${table}" = 'moveable' ] && \
+ [ "${copy}" = '2' ]; then
+ continue
+ fi
+ printf 'DELETE FROM `%s_binary_packages_copy%s`;\n' "${table}" "${copy}"
+ printf 'INSERT IGNORE INTO `%s_binary_packages_copy%s`' "${table}" "${copy}"
+ printf ' SELECT `%s_binary_packages`.*' "${table}"
+ printf ' FROM `%s_binary_packages`;\n' "${table}"
+ done
+ done
+
+ printf 'DELETE `replaced_binary_packages`,`moveable_binary_packages` FROM `replaced_binary_packages`'
+ printf ' RIGHT JOIN `moveable_binary_packages`'
+ printf ' ON `replaced_binary_packages`.`replaced_by`=`moveable_binary_packages`.`id`'
+ printf ' JOIN `binary_packages`'
+ printf ' ON `binary_packages`.`id`=`moveable_binary_packages`.`id`'
+ mysql_join_binary_packages_build_assignments
+ printf ' JOIN `package_blobs`'
+ printf ' ON `build_assignments`.`package_source`=`package_blobs`.`ps_a`'
+ printf ' JOIN `build_assignments` AS `bl_ba`'
+ printf ' ON `bl_ba`.`package_source`=`package_blobs`.`ps_b`'
+ mysql_join_build_assignments_binary_packages 'bl_ba' 'bl_bp'
+ printf ' WHERE NOT EXISTS ('
+ printf 'SELECT 1 FROM `moveable_binary_packages_copy`'
+ printf ' WHERE `moveable_binary_packages_copy`.`id`=`bl_bp`.`id`'
+ printf ');\n'
+ printf 'SET row_count_saved = row_count_saved + ROW_COUNT();\n'
+
printf 'UNTIL row_count_saved=0\n'
printf 'END REPEAT;\n'
for table in 'moveable' 'replaced'; do