summaryrefslogtreecommitdiff
path: root/bin/db-update
diff options
context:
space:
mode:
Diffstat (limited to 'bin/db-update')
-rwxr-xr-xbin/db-update29
1 files changed, 18 insertions, 11 deletions
diff --git a/bin/db-update b/bin/db-update
index 55c32db..d732502 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -9,9 +9,6 @@
# TODO: separate locks for staging, testing (and stable)
-# TODO: we should delete more packages than just the ones in repositories
-# where we move to (think of [extra] -> [community])
-
# shellcheck disable=SC2039,SC2119,SC2120
# shellcheck source=../lib/load-configuration
@@ -136,6 +133,10 @@ for source_stability in \
# shellcheck disable=SC2016
{
+ # Note, that we do not need to check that two repositories a and b
+ # are for the same architecture if we joined them via
+ # repository_moves, because only repositories with the same
+ # architectures should be listed there.
if [ -n "${force_ids}" ]; then
printf 'DROP TEMPORARY TABLE IF EXISTS `%s_bpir`;\n' \
'moveable' 'replaced'
@@ -169,8 +170,11 @@ for source_stability in \
printf ' JOIN `binary_packages_in_repositories` AS `subst_bpir` ON `moveable_bpir`.`id`=`subst_bpir`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages 'subst_bpir' 'subst_bp'
printf ' JOIN `binary_packages` ON `binary_packages`.`pkgname`=`subst_bp`.`pkgname`'
- mysql_join_in_repositories_binary_packages_binary_packages
- printf ' AND `binary_packages_in_repositories`.`repository`=`moveable_binary_packages`.`to_repository`;\n'
+ mysql_join_binary_packages_binary_packages_in_repositories
+ mysql_join_binary_packages_in_repositories_repositories
+ printf ' JOIN `repositories` AS `m_to_r` ON `moveable_binary_packages`.`to_repository`=`m_to_r`.`id`'
+ printf ' AND `repositories`.`stability`=`m_to_r`.`stability`'
+ printf ' AND `repositories`.`architecture`=`m_to_r`.`architecture`;\n'
elif ${progressive}; then
printf 'DROP TEMPORARY TABLE IF EXISTS `%s_bpir`;\n' \
'moveable' 'replaced'
@@ -181,21 +185,24 @@ for source_stability in \
printf ' SELECT `old_bpir`.`id`,`new_bpir`.`id`'
printf ' FROM `binary_packages_in_repositories` AS `new_bpir`'
mysql_join_binary_packages_in_repositories_binary_packages 'new_bpir' 'new_bp'
- # the new package is _currently_ in the old repository
- mysql_join_binary_packages_in_repositories_repositories 'new_bpir' 'old_r'
- printf ' AND `old_r`.`is_on_master_mirror`'
+ mysql_join_binary_packages_in_repositories_repositories 'new_bpir' 'from_r'
+ printf ' AND `from_r`.`is_on_master_mirror`'
mysql_join_binary_packages_build_assignments 'new_bp'
mysql_join_build_assignments_package_sources
mysql_join_package_sources_upstream_repositories
mysql_join_upstream_repositories_repository_moves
- printf ' AND `repository_moves`.`from_repository`=`old_r`.`id`'
+ printf ' AND `repository_moves`.`from_repository`=`from_r`.`id`'
+ printf ' JOIN `repositories` AS `to_r`'
+ printf ' ON `repository_moves`.`to_repository`=`to_r`.`id`'
+ printf ' AND `to_r`.`stability`=%s' \
+ "${source_stability}"
printf ' JOIN `binary_packages` AS `old_bp`'
printf ' ON `new_bp`.`pkgname`=`old_bp`.`pkgname`'
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_binary_packages_in_repositories_repositories 'old_bpir' 'old_r'
printf ' AND `old_r`.`stability`=%s' \
"${source_stability}"
+ printf ' AND `old_r`.`architecture`=`to_r`.`architecture`'
mysql_join_binary_packages_dependencies 'new_bp'
mysql_join_dependencies_dependency_types
printf ' AND `dependency_types`.`relevant_for_binary_packages`'