summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-06-07 11:25:46 +0200
committerErich Eckner <git@eckner.net>2018-06-07 11:25:46 +0200
commitd93a256e5e78d628e19af15504d3d3c643dbc87f (patch)
tree879000a90c1e106035a4b47a4ed4c2ada3245535
parentae5055cb7864d36e9bcb947c970f3fd5bc0af465 (diff)
downloadbuilder-d93a256e5e78d628e19af15504d3d3c643dbc87f.tar.xz
bin/db-update,bin/bootstrap-mysql: replaced packages may be in a differen, but equally-stable repository
-rwxr-xr-xbin/bootstrap-mysql8
-rwxr-xr-xbin/db-update29
2 files changed, 23 insertions, 14 deletions
diff --git a/bin/bootstrap-mysql b/bin/bootstrap-mysql
index ee51e1a..eb6462c 100755
--- a/bin/bootstrap-mysql
+++ b/bin/bootstrap-mysql
@@ -108,14 +108,15 @@ fi
printf ' FROM `moveable_bpir`'
printf ' JOIN `binary_packages_in_repositories` AS `m_bpir` ON `m_bpir`.`id`=`moveable_bpir`.`id`'
mysql_join_binary_packages_in_repositories_binary_packages 'm_bpir' 'm_bp'
- mysql_join_binary_packages_in_repositories_repositories 'm_bpir' 'm_r'
+ mysql_join_binary_packages_in_repositories_repositories 'm_bpir' 'm_from_r'
mysql_join_binary_packages_build_assignments 'm_bp' 'm_ba'
mysql_join_build_assignments_package_sources 'm_ba' 'm_ps'
mysql_join_package_sources_upstream_repositories 'm_ps' 'm_ur'
mysql_join_upstream_repositories_repository_moves 'm_ur'
- printf ' AND `repository_moves`.`from_repository`=`m_r`.`id`'
+ printf ' AND `repository_moves`.`from_repository`=`m_from_r`.`id`'
# in its target repository
- printf ' JOIN `repositories` AS `r_r` ON `repository_moves`.`to_repository`=`r_r`.`id`'
+ printf ' JOIN `repositories` AS `m_to_r` ON `repository_moves`.`to_repository`=`m_to_r`.`id`'
+ printf ' JOIN `repositories` AS `r_r` ON `r_r`.`stability`=`m_to_r`.`stability`'
mysql_join_repositories_binary_packages_in_repositories 'r_r' 'r_bpir'
mysql_join_binary_packages_in_repositories_binary_packages 'r_bpir' 'r_bp'
# all packages with identical names
@@ -219,6 +220,7 @@ fi
# we need to check wether req_bp's dependency is (un)critical
mysql_join_binary_packages_binary_packages_in_repositories 'req_bp' 'req_bpir'
mysql_join_binary_packages_in_repositories_repositories 'req_bpir' 'req_r'
+ printf ' AND `repl_r`.`architecture`=`req_r`.`architecture`'
# dependent package is "less stable" than dependency
printf ' JOIN `repository_stability_relations` AS `repl_rr`'
printf ' ON `repl_rr`.`more_stable`=`repl_r`.`stability`'
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`'