From 6626de14465e6501035a0d5fe642e1cd308151bd Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Thu, 8 Feb 2018 16:51:23 +0100 Subject: bin/mysql-functions: add quick-repair (removes falsely scheduled packages, but transfers all dependencies,installs to new packages) --- bin/mysql-functions | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) 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} +} -- cgit v1.2.3-70-g09d2