summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-02-08 16:51:23 +0100
committerErich Eckner <git@eckner.net>2018-02-08 16:51:23 +0100
commit6626de14465e6501035a0d5fe642e1cd308151bd (patch)
treefdf49c450219809761833d676693eed9f39dd421
parent765f9b249eed27f2b441107de8e2ebcbcbf874b4 (diff)
downloadbuilder-6626de14465e6501035a0d5fe642e1cd308151bd.tar.xz
bin/mysql-functions: add quick-repair (removes falsely scheduled packages, but transfers all dependencies,installs to new packages)
-rwxr-xr-xbin/mysql-functions36
1 files changed, 36 insertions, 0 deletions
diff --git a/bin/mysql-functions b/bin/mysql-functions
index ea3ea78..c57b5ae 100755
--- a/bin/mysql-functions
+++ b/bin/mysql-functions
@@ -896,3 +896,39 @@ mysql_repair_binary_packages_without_build_assignment() {
done | \
${mysql_command}
}
+
+# mysql_remove_duplicate_build_order
+# remove _all_ build orders which just increase sub_pkgrel of another package
+# (this may undo "seed-build-list" effects)
+mysql_remove_duplicate_build_order() {
+ {
+ printf 'CREATE TEMPORARY TABLE `ren` (`old` BIGINT, `new` BIGINT);\n'
+ printf 'INSERT INTO `ren` (`old`,`new`)'
+ printf ' SELECT `old`.`id`,`new`.`id`'
+ printf ' FROM `binary_packages` as `old`'
+ printf ' JOIN `binary_packages` as `new` ON'
+ printf ' `old`.`%s`=`new`.`%s` AND' \
+ 'pkgname' 'pkgname' \
+ 'epoch' 'epoch' \
+ 'pkgver' 'pkgver' \
+ 'pkgrel' 'pkgrel'
+ printf ' `old`.`sub_pkgrel`+1=`new`.`sub_pkgrel`'
+ printf ' JOIN `repositories` AS `%s` ON `%s`.`id`=`%s`.`repository`' \
+ 'orep' 'orep' 'old' \
+ 'nrep' 'nrep' 'new'
+ printf ' WHERE `orep`.`name`!="build-list"'
+ printf ' AND `nrep`.`name`="build-list";\n'
+ printf 'UPDATE IGNORE `dependencies`'
+ printf ' JOIN `ren` ON `ren`.`old`=`dependencies`.`dependent`'
+ printf ' SET `dependencies`.`dependent`=`ren`.`new`;\n'
+ printf 'UPDATE IGNORE `install_target_providers`'
+ printf ' JOIN `ren` ON `ren`.`old`=`install_target_providers`.`package`'
+ printf ' SET `install_target_providers`.`package`=`ren`.`new`;\n'
+ printf 'DELETE FROM `binary_packages`'
+ printf ' WHERE EXISTS ('
+ printf 'SELECT * FROM `ren`'
+ printf ' WHERE `ren`.`old`=`binary_packages`.`id`'
+ printf ');\n'
+ } | \
+ ${mysql_command}
+}