index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2019-08-06 10:15:52 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2019-08-06 10:15:52 +0200 |
commit | e79888f1da097f23619f9b1667607d2898eb34e8 (patch) | |
tree | 369d8efdc9bee12e1ff0c1d4305f8adb17a9dd98 | |
parent | 1057764d68f13ad3f09d58c249fcee644a8d5850 (diff) |
-rwxr-xr-x | bin/bootstrap-mysql | 140 | ||||
-rw-r--r-- | misc/database-layout.dump | 71 |
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 diff --git a/misc/database-layout.dump b/misc/database-layout.dump index d4f4283..538f63f 100644 --- a/misc/database-layout.dump +++ b/misc/database-layout.dump @@ -1,74 +1,3 @@ -blacklist_packages STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `blacklist_packages`() -blacklist_packages:BEGIN -CREATE TEMPORARY TABLE `bl` (`arch` SMALLINT,`pkgbase` VARCHAR(64),UNIQUE KEY `content`(`arch`,`pkgbase`),KEY (`arch`),KEY (`pkgbase`)); -CREATE TEMPORARY TABLE `bl_copy` (`arch` SMALLINT,`pkgbase` VARCHAR(64),UNIQUE KEY `content`(`arch`,`pkgbase`),KEY (`arch`),KEY (`pkgbase`)); -INSERT IGNORE INTO `bl`(`arch`,`pkgbase`) - SELECT `architectures`.`id`,`blacklist`.`pkgbase` - FROM `blacklist` - JOIN `architectures` - ON `architectures`.`name`=`blacklist`.`arch`; -CREATE TEMPORARY TABLE `available_install_targets` (`architecture` SMALLINT,`install_target` BIGINT,UNIQUE KEY `content`(`architecture`,`install_target`),KEY (`architecture`),KEY (`install_target`)); -REPEAT -DELETE - FROM `bl_copy`; -INSERT IGNORE INTO `bl_copy` (`arch`,`pkgbase`) - SELECT `bl`.`arch`, `bl`.`pkgbase` - FROM `bl`; -INSERT IGNORE INTO `bl`(`arch`,`pkgbase`) - SELECT `architecture_compatibilities`.`built_for`,`bl_copy`.`pkgbase` - FROM `bl_copy` - JOIN `architecture_compatibilities` - ON (`architecture_compatibilities`.`runs_on`=`bl_copy`.`arch` OR `bl_copy`.`arch`=1) AND `architecture_compatibilities`.`built_for`!=1; -DELETE - FROM `bl_copy`; -INSERT IGNORE INTO `bl_copy` (`arch`,`pkgbase`) - SELECT `bl`.`arch`, `bl`.`pkgbase` - FROM `bl`; -DELETE - FROM `available_install_targets`; -INSERT IGNORE INTO `available_install_targets` (`architecture`,`install_target`)SELECT `architectures`.`id`,`install_target_providers`.`install_target` - FROM `install_target_providers` - JOIN `binary_packages` - ON `install_target_providers`.`package`=`binary_packages`.`id` - JOIN `build_assignments` - ON `binary_packages`.`build_assignment`=`build_assignments`.`id` - JOIN `package_sources` - ON `build_assignments`.`package_source`=`package_sources`.`id` - JOIN `architectures` - ON (`architectures`.`id`=`binary_packages`.`architecture` OR `binary_packages`.`architecture`=1 OR `architectures`.`id`=1) - LEFT JOIN `bl_copy` - ON `bl_copy`.`pkgbase`=`package_sources`.`pkgbase` AND (`bl_copy`.`arch`=`build_assignments`.`architecture` OR `bl_copy`.`arch`=1) - WHERE `bl_copy`.`pkgbase` IS NULL; -INSERT IGNORE INTO `bl` (`arch`,`pkgbase`) - SELECT `a_bp`.`architecture`,`a_ps`.`pkgbase` - FROM `package_sources` AS `a_ps` - JOIN `build_assignments` AS `a_ba` - ON `a_ps`.`id`=`a_ba`.`package_source` - JOIN `binary_packages` AS `a_bp` - ON `a_ba`.`id`=`a_bp`.`build_assignment` - JOIN `architectures` AS `a_a` - ON `a_bp`.`architecture`=`a_a`.`id` - JOIN `dependencies` - ON `a_bp`.`id`=`dependencies`.`dependent` - JOIN `dependency_types` - ON `dependencies`.`dependency_type`=`dependency_types`.`id` AND (`dependency_types`.`relevant_for_building` OR `dependency_types`.`relevant_for_binary_packages`) - JOIN `install_target_providers` AS `itp_dummy` - ON `dependencies`.`depending_on`=`itp_dummy`.`install_target` - JOIN `binary_packages` AS `itp_bp_dummy` - ON `itp_dummy`.`package`=`itp_bp_dummy`.`id` AND (`itp_bp_dummy`.`architecture`=`a_ba`.`architecture` OR `a_ba`.`architecture`=1 OR `itp_bp_dummy`.`architecture`=1) - LEFT JOIN `available_install_targets` - ON `available_install_targets`.`install_target`=`dependencies`.`depending_on` AND `available_install_targets`.`architecture`=`a_ba`.`architecture` - WHERE `available_install_targets`.`install_target` IS NULL; -UNTIL ROW_COUNT()=0 -END REPEAT; -SELECT `architectures`.`name`,`bl`.`pkgbase` - FROM `bl` - JOIN `architectures` - ON `architectures`.`id`=`bl`.`arch`; -DROP TEMPORARY TABLE `bl`; -DROP TEMPORARY TABLE `bl_copy`; -DROP TEMPORARY TABLE `available_install_targets`; -END utf8mb4 utf8mb4_unicode_ci utf8mb4_unicode_ci calculate_maximal_moveable_set STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION CREATE DEFINER=`root`@`localhost` PROCEDURE `calculate_maximal_moveable_set`(IN `arch_id` MEDIUMINT,IN `from_stability` MEDIUMINT) BEGIN DECLARE row_count_saved INT DEFAULT 0; |