diff options
-rwxr-xr-x | bin/bootstrap-mysql | 14 | ||||
-rwxr-xr-x | bin/db-update | 18 |
2 files changed, 16 insertions, 16 deletions
diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql index 6b64d96..ee51e1a 100755 --- a/bin/bootstrap-mysql +++ b/bin/bootstrap-mysql @@ -42,7 +42,7 @@ fi printf 'DROP PROCEDURE IF EXISTS calculate_maximal_moveable_set;\n' printf 'DELIMITER //\n' - printf 'CREATE PROCEDURE calculate_maximal_moveable_set(IN `from_stability` VARCHAR(32))\n' + printf 'CREATE PROCEDURE calculate_maximal_moveable_set(IN `from_stability` MEDIUMINT)\n' printf 'BEGIN\n' # variable to store count of changed rows printf 'DECLARE row_count_saved INT DEFAULT 0;\n' @@ -75,10 +75,8 @@ fi mysql_join_binary_packages_in_repositories_repositories 'a_bpir' 'a_r' mysql_join_binary_packages_binary_packages_in_repositories 'b_bp' 'b_bpir' mysql_join_binary_packages_in_repositories_repositories 'b_bpir' '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' + printf ' WHERE `a_r`.`stability` = `from_stability`' + printf ' AND `b_r`.`stability` = `from_stability`;\n' # these packages are considered for moving: printf 'INSERT IGNORE INTO `moveable_bpir` (`id`,`to_repository`)' printf ' SELECT `binary_packages_in_repositories`.`id`,`repository_moves`.`to_repository`' @@ -92,9 +90,11 @@ fi mysql_join_upstream_repositories_repository_moves printf ' AND `repository_moves`.`from_repository`=`binary_packages_in_repositories`.`repository`' # correct stability: "testing"/"staging" - as chosen - printf ' WHERE `repository_stabilities`.`name`=`from_stability`' + printf ' WHERE `repository_stabilities`.`id`=`from_stability`' printf ' AND (' - printf '`from_stability`="staging"' + # this should not be replaced by ${repository_stability_ids__staging}, + # because it may change + printf '`repository_stabilities`.`name`="staging"' # "testing" packages must be tested printf ' OR `binary_packages`.`is_tested`' printf ')' diff --git a/bin/db-update b/bin/db-update index 91840d6..4808f2b 100755 --- a/bin/db-update +++ b/bin/db-update @@ -133,7 +133,10 @@ trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT export TMPDIR="${tmp_dir}" -for source_stability in 'testing' 'staging'; do +# shellcheck disable=SC2154 +for source_stability in \ + "${repository_stability_ids__testing}" \ + "${repository_stability_ids__staging}"; do find "${tmp_dir}" -mindepth 1 -delete # shellcheck disable=SC2016 @@ -153,8 +156,7 @@ for source_stability in 'testing' 'staging'; do printf ' JOIN `binary_packages_in_repositories` ON `binary_packages_in_repositories`.`id`=`moveable_bpir`.`id`' mysql_join_binary_packages_in_repositories_binary_packages mysql_join_binary_packages_in_repositories_repositories - mysql_join_repositories_repository_stabilities - printf ' WHERE `repository_stabilities`.`name`!="%s";\n' \ + 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`' @@ -197,8 +199,7 @@ for source_stability in 'testing' 'staging'; do mysql_join_binary_packages_binary_packages_in_repositories 'old_bp' 'old_bpir' # the old package is currently in the new repository printf ' AND `repository_moves`.`to_repository`=`old_bpir`.`repository`' - mysql_join_repositories_repository_stabilities 'old_r' 'old_rs' - printf ' AND `old_rs`.`name`="%s"' \ + printf ' AND `old_r`.`stability`=%s' \ "${source_stability}" mysql_join_binary_packages_dependencies 'new_bp' mysql_join_dependencies_dependency_types @@ -223,8 +224,7 @@ for source_stability in 'testing' 'staging'; do mysql_join_binary_packages_in_repositories_binary_packages mysql_join_binary_packages_in_repositories_repositories printf ' AND `repositories`.`is_on_master_mirror`' - mysql_join_repositories_repository_stabilities - printf ' AND `repository_stabilities`.`name`="%s"' \ + printf ' AND `repositories`.`stability`=%s' \ "${source_stability}" mysql_join_binary_packages_build_assignments mysql_join_build_assignments_package_sources @@ -238,7 +238,7 @@ for source_stability in 'testing' 'staging'; do printf ' AND `repl_bpir`.`repository`=`repository_moves`.`to_repository`' printf ');\n' else - printf 'CALL calculate_maximal_moveable_set("%s");\n' \ + printf 'CALL calculate_maximal_moveable_set(%s);\n' \ "${source_stability}" fi @@ -295,7 +295,7 @@ for source_stability in 'testing' 'staging'; do done if [ ! -s "${tmp_dir}/repositories" ]; then - >&2 printf 'Nothing to move from %s.\n' "${source_stability}" + >&2 printf 'Nothing to move here (%s).\n' "${source_stability}" continue fi |