Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/db-update46
1 files changed, 29 insertions, 17 deletions
diff --git a/bin/db-update b/bin/db-update
index b1df047..6f4ff8e 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -9,8 +9,6 @@
# TODO: make (all) locking less restrictive
-# TODO: -p should not move split package parts separately
-
# shellcheck disable=SC2039,SC2119,SC2120
# shellcheck source=../lib/load-configuration
@@ -221,6 +219,26 @@ trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT
export TMPDIR="${tmp_dir}"
+# mysql_query_update_replaced_bpir
+# print a query to fill the `replaced_bpir` table from `moveable_bpir`
+
+# shellcheck disable=SC2016
+mysql_query_update_replaced_bpir() {
+ printf 'INSERT IGNORE INTO `replaced_bpir` (`id`,`replaced_by`)'
+ printf ' SELECT `binary_packages_in_repositories`.`id`,`moveable_bpir`.`id`'
+ printf ' FROM `moveable_bpir`'
+ printf ' JOIN `binary_packages_in_repositories` AS `subst_bpir`'
+ printf ' ON `moveable_bpir`.`id`=`subst_bpir`.`id`'
+ mysql_join_binary_packages_in_repositories_binary_packages 'subst_bpir' 'subst_bp'
+ printf ' JOIN `binary_packages`'
+ printf ' ON `binary_packages`.`pkgname`=`subst_bp`.`pkgname`'
+ mysql_join_binary_packages_binary_packages_in_repositories
+ mysql_join_binary_packages_in_repositories_repositories
+ printf ' JOIN `repositories` AS `m_to_r`'
+ printf ' ON `moveable_bpir`.`to_repository`=`m_to_r`.`id`'
+ printf ' AND `repositories`.`stability`=`m_to_r`.`stability`'
+ printf ' AND `repositories`.`architecture`=`m_to_r`.`architecture`;\n'
+}
# shellcheck disable=SC2016
{
@@ -318,20 +336,7 @@ export TMPDIR="${tmp_dir}"
printf ' SET `moveable_bpir`.`to_repository`=`repository_moves`.`to_repository`;\n'
printf 'DELETE FROM `moveable_bpir`'
printf ' WHERE `moveable_bpir`.`to_repository` IS NULL;\n'
- printf 'INSERT IGNORE INTO `replaced_bpir` (`id`,`replaced_by`)'
- printf ' SELECT `binary_packages_in_repositories`.`id`,`moveable_bpir`.`id`'
- printf ' FROM `moveable_bpir`'
- printf ' JOIN `binary_packages_in_repositories` AS `subst_bpir`'
- printf ' ON `moveable_bpir`.`id`=`subst_bpir`.`id`'
- mysql_join_binary_packages_in_repositories_binary_packages 'subst_bpir' 'subst_bp'
- printf ' JOIN `binary_packages`'
- printf ' ON `binary_packages`.`pkgname`=`subst_bp`.`pkgname`'
- mysql_join_binary_packages_binary_packages_in_repositories
- mysql_join_binary_packages_in_repositories_repositories
- printf ' JOIN `repositories` AS `m_to_r`'
- printf ' ON `moveable_bpir`.`to_repository`=`m_to_r`.`id`'
- printf ' AND `repositories`.`stability`=`m_to_r`.`stability`'
- printf ' AND `repositories`.`architecture`=`m_to_r`.`architecture`;\n'
+ mysql_query_update_replaced_bpir
elif ${progressive}; then
printf 'DROP TEMPORARY TABLE IF EXISTS `%s_bpir`;\n' \
'moveable' 'replaced'
@@ -402,12 +407,19 @@ export TMPDIR="${tmp_dir}"
printf ');\n'
printf 'INSERT IGNORE INTO `moveable_bpir` (`id`,`to_repository`)'
- printf ' SELECT `replaced_bpir`.`replaced_by`,`binary_packages_in_repositories`.`repository`'
+ printf ' SELECT `tm_bpir`.`id`,`tm_bpir`.`repository`'
printf ' FROM `replaced_bpir`'
printf ' JOIN `binary_packages_in_repositories`'
printf ' ON `binary_packages_in_repositories`.`id`=`replaced_bpir`.`id`'
+ mysql_join_binary_packages_in_repositories_binary_packages
+ printf ' JOIN `binary_packages` AS `tm_bp`'
+ printf ' ON `tm_bp`.`build_assignment`=`binary_packages`.`build_assignment`'
+ mysql_join_binary_packages_binary_packages_in_repositories 'tm_bp' 'tm_bpir'
+ printf ' AND `tm_bpir`.`repository`=`binary_packages_in_repositories`.`repository`'
printf ';\n'
+ mysql_query_update_replaced_bpir
+
# packages which replace nothing
printf 'INSERT IGNORE INTO `moveable_bpir` (`id`,`to_repository`)'
printf ' SELECT `binary_packages_in_repositories`.`id`,`repository_moves`.`to_repository`'