Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbin/db-update41
1 files changed, 22 insertions, 19 deletions
diff --git a/bin/db-update b/bin/db-update
index 1b72805..7d5af50 100755
--- a/bin/db-update
+++ b/bin/db-update
@@ -370,25 +370,28 @@ for source_stability in \
s,^\(\S\+\) \(\S\+\) \(\S\+\)$,\2/\3/\1,
' "${tmp_dir}/rm"
- # shellcheck disable=SC2016
- {
- printf 'CREATE TEMPORARY TABLE `replaced_bpir` (`id` BIGINT, UNIQUE KEY (`id`));\n'
- printf 'CREATE TEMPORARY TABLE `moved_bpir` (`id` BIGINT, `new_repository` MEDIUMINT, UNIQUE KEY (`id`));\n'
- printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `%s` COLUMNS TERMINATED BY " ";\n' \
- "${tmp_dir}/mv.id" 'moved_bpir' \
- "${tmp_dir}/rm.id" 'replaced_bpir'
- printf 'DELETE `binary_packages_in_repositories` FROM `binary_packages_in_repositories`'
- printf ' JOIN `replaced_bpir` ON `binary_packages_in_repositories`.`id`=`replaced_bpir`.`id`;\n'
- mysql_query_and_delete_unneeded_binary_packages
- printf 'UPDATE `binary_packages_in_repositories`'
- printf ' JOIN `moved_bpir` ON `binary_packages_in_repositories`.`id`=`moved_bpir`.`id`'
- printf ' SET `binary_packages_in_repositories`.`repository`=`moved_bpir`.`new_repository`,'
- printf '`binary_packages_in_repositories`.`last_moved`=NOW()'
- printf ' WHERE `binary_packages_in_repositories`.`repository`!=`moved_bpir`.`new_repository`;\n'
- } | \
- mysql_run_query | \
- sort -u >> \
- "${tmp_dir}/rm"
+ # somewhat inaccurate
+ if ! ${no_action}; then
+ # shellcheck disable=SC2016
+ {
+ printf 'CREATE TEMPORARY TABLE `replaced_bpir` (`id` BIGINT, UNIQUE KEY (`id`));\n'
+ printf 'CREATE TEMPORARY TABLE `moved_bpir` (`id` BIGINT, `new_repository` MEDIUMINT, UNIQUE KEY (`id`));\n'
+ printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `%s` COLUMNS TERMINATED BY " ";\n' \
+ "${tmp_dir}/mv.id" 'moved_bpir' \
+ "${tmp_dir}/rm.id" 'replaced_bpir'
+ printf 'DELETE `binary_packages_in_repositories` FROM `binary_packages_in_repositories`'
+ printf ' JOIN `replaced_bpir` ON `binary_packages_in_repositories`.`id`=`replaced_bpir`.`id`;\n'
+ mysql_query_and_delete_unneeded_binary_packages
+ printf 'UPDATE `binary_packages_in_repositories`'
+ printf ' JOIN `moved_bpir` ON `binary_packages_in_repositories`.`id`=`moved_bpir`.`id`'
+ printf ' SET `binary_packages_in_repositories`.`repository`=`moved_bpir`.`new_repository`,'
+ printf '`binary_packages_in_repositories`.`last_moved`=NOW()'
+ printf ' WHERE `binary_packages_in_repositories`.`repository`!=`moved_bpir`.`new_repository`;\n'
+ } | \
+ mysql_run_query | \
+ sort -u >> \
+ "${tmp_dir}/rm"
+ fi
# move the packages remotely via sftp
{