summaryrefslogtreecommitdiff
path: root/bin/bootstrap-mysql
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2019-08-06 10:15:52 +0200
committerErich Eckner <git@eckner.net>2019-08-06 10:15:52 +0200
commite79888f1da097f23619f9b1667607d2898eb34e8 (patch)
tree369d8efdc9bee12e1ff0c1d4305f8adb17a9dd98 /bin/bootstrap-mysql
parent1057764d68f13ad3f09d58c249fcee644a8d5850 (diff)
downloadbuilder-e79888f1da097f23619f9b1667607d2898eb34e8.tar.xz
misc/database-layout.dump, bin/bootstrap-mysql: drop unnecessary procedures
Diffstat (limited to 'bin/bootstrap-mysql')
-rwxr-xr-xbin/bootstrap-mysql140
1 files changed, 0 insertions, 140 deletions
diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql
index e94c5d2..2c63b2a 100755
--- a/bin/bootstrap-mysql
+++ b/bin/bootstrap-mysql
@@ -669,146 +669,6 @@ fi
printf 'END\n'
printf '//\n'
- printf 'DROP PROCEDURE IF EXISTS `blacklist_packages`//\n'
- printf 'CREATE PROCEDURE `blacklist_packages`()\n'
- printf 'blacklist_packages:BEGIN\n'
-
- for suffix in '' '_copy'; do
- printf 'CREATE TEMPORARY TABLE `bl%s` (' \
- "${suffix}"
- printf '`arch` SMALLINT,'
- printf '`pkgbase` VARCHAR(64),'
- printf 'UNIQUE KEY `content`(`arch`,`pkgbase`),'
- printf 'KEY (`arch`),'
- printf 'KEY (`pkgbase`)'
- printf ');\n'
- done
- printf 'INSERT IGNORE INTO `bl`(`arch`,`pkgbase`)'
- printf ' SELECT'
- printf ' `architectures`.`id`,'
- printf '`blacklist`.`pkgbase`'
- printf ' FROM `blacklist`'
- printf ' JOIN `architectures`'
- printf ' ON `architectures`.`name`=`blacklist`.`arch`;\n'
-
- printf 'CREATE TEMPORARY TABLE `available_install_targets` ('
- printf '`architecture` SMALLINT,'
- printf '`install_target` BIGINT,'
- printf 'UNIQUE KEY `content`(`architecture`,`install_target`),'
- printf 'KEY (`architecture`),'
- printf 'KEY (`install_target`)'
- printf ');\n'
-
- printf 'REPEAT\n'
-
- printf 'DELETE FROM `bl_copy`;\n'
- printf 'INSERT IGNORE INTO `bl_copy` (`arch`,`pkgbase`)'
- printf ' SELECT'
- printf ' `bl`.`arch`,'
- printf ' `bl`.`pkgbase`'
- printf ' FROM `bl`;\n'
-
- printf 'INSERT IGNORE INTO `bl`(`arch`,`pkgbase`)'
- printf ' SELECT'
- printf ' `architecture_compatibilities`.`built_for`,'
- printf '`bl_copy`.`pkgbase`'
- printf ' FROM `bl_copy`'
- printf ' JOIN `architecture_compatibilities`'
- printf ' ON ('
- printf '`architecture_compatibilities`.`runs_on`=`bl_copy`.`arch`'
- # shellcheck disable=SC2154
- printf ' OR `bl_copy`.`arch`=%s' \
- "${architecture_ids__any}"
- printf ') AND `architecture_compatibilities`.`built_for`!=%s;\n' \
- "${architecture_ids__any}"
-
- printf 'DELETE FROM `bl_copy`;\n'
- printf 'INSERT IGNORE INTO `bl_copy` (`arch`,`pkgbase`)'
- printf ' SELECT'
- printf ' `bl`.`arch`,'
- printf ' `bl`.`pkgbase`'
- printf ' FROM `bl`;\n'
-
- printf 'DELETE FROM `available_install_targets`;\n'
- printf 'INSERT IGNORE INTO `available_install_targets` (`architecture`,`install_target`)'
- printf 'SELECT'
- printf ' `architectures`.`id`,'
- printf '`install_target_providers`.`install_target`'
- printf ' FROM `install_target_providers`'
- mysql_join_install_target_providers_binary_packages
- mysql_join_binary_packages_build_assignments
- mysql_join_build_assignments_package_sources
- printf ' JOIN `architectures`'
- printf ' ON ('
- printf '`architectures`.`id`=`binary_packages`.`architecture`'
- printf ' OR `binary_packages`.`architecture`=%s' \
- "${architecture_ids__any}"
- printf ' OR `architectures`.`id`=%s' \
- "${architecture_ids__any}"
- printf ')'
- printf ' LEFT JOIN `bl_copy`'
- printf ' ON `bl_copy`.`pkgbase`=`package_sources`.`pkgbase`'
- printf ' AND ('
- printf '`bl_copy`.`arch`=`build_assignments`.`architecture`'
- printf ' OR `bl_copy`.`arch`=%s' \
- "${architecture_ids__any}"
- # we intentionally do not allow arch-specific packages to cause
- # "any"-packages to be blacklisted (this is seldom and makes the
- # query quite complex, because we must check if /all/
- # arch-specific packages are unavailable)
- printf ')'
- # we're only interested in those which are not (yet) blacklisted
- printf ' WHERE `bl_copy`.`pkgbase` IS NULL;\n'
-
- printf 'INSERT IGNORE INTO `bl` (`arch`,`pkgbase`)'
- printf ' SELECT'
- printf ' `a_bp`.`architecture`,'
- printf '`a_ps`.`pkgbase`'
- printf ' FROM `package_sources` AS `a_ps`'
- mysql_join_package_sources_build_assignments 'a_ps' 'a_ba'
- mysql_join_build_assignments_binary_packages 'a_ba' 'a_bp'
- mysql_join_binary_packages_architectures 'a_bp' 'a_a'
- mysql_join_binary_packages_dependencies 'a_bp'
- mysql_join_dependencies_dependency_types
- printf ' AND (`dependency_types`.`relevant_for_building`'
- printf ' OR `dependency_types`.`relevant_for_binary_packages`)'
- # TODO: This should be corrected at the root: automatic install targets, which are bogus should
- # not be added in the first place - but how do we detect that? -> add exceptions!
- mysql_join_dependencies_install_target_providers '' 'itp_dummy'
- mysql_join_install_target_providers_binary_packages 'itp_dummy' 'itp_bp_dummy'
- printf ' AND ('
- printf '`itp_bp_dummy`.`architecture`=`a_ba`.`architecture`'
- printf ' OR `a_ba`.`architecture`=%s' \
- "${architecture_ids__any}"
- printf ' OR `itp_bp_dummy`.`architecture`=%s' \
- "${architecture_ids__any}"
- printf ')'
- printf ' LEFT JOIN `available_install_targets`' # list of not-blacklisted install targets
- printf ' ON `available_install_targets`.`install_target`=`dependencies`.`depending_on`'
- printf ' AND `available_install_targets`.`architecture`=`a_ba`.`architecture`'
- # we only add those to the blacklist, that have not install_target_provider
- printf ' WHERE `available_install_targets`.`install_target` IS NULL'
- printf ';\n'
-
- printf 'UNTIL ROW_COUNT()=0\n'
- printf 'END REPEAT;\n'
-
- printf 'SELECT'
- printf ' `architectures`.`name`,'
- printf '`bl`.`pkgbase`'
- printf ' FROM `bl`'
- printf ' JOIN `architectures`'
- printf ' ON `architectures`.`id`=`bl`.`arch`'
- printf ';\n'
-
- printf 'DROP TEMPORARY TABLE `%s`;\n' \
- 'bl' \
- 'bl_copy' \
- 'available_install_targets'
-
- printf 'END\n'
- printf '//\n'
-
printf 'DELIMITER ;\n'
if [ "x$1" != 'x-no-privileges' ]; then