From c62685fd40cbbf6ba16b440f1fd9c79290080fb7 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 26 Sep 2018 09:04:25 +0200 Subject: lib/mysql-functions: mysql_generate_package_metadata(): remove old binary_packages_in_repositories iff inserting into build-list or to-be-decided-list --- lib/mysql-functions | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'lib') diff --git a/lib/mysql-functions b/lib/mysql-functions index 98efd23..ad83618 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -462,6 +462,43 @@ mysql_generate_package_metadata() { 'pkgrel' 'pkgrel' printf ';\n' + if [ "${current_repository_id}" -eq "${repository_ids__any_build_list}" ] || \ + [ "${current_repository_id}" -eq "${repository_ids__any_to_be_decided}" ]; then + printf 'DELETE `binary_packages_in_repositories`' + printf ' FROM `links`' + printf ' JOIN `architectures`' + printf ' ON `architectures`.`name`=`links`.`architecture`' + mysql_join_architectures_binary_packages + printf ' AND `binary_packages`.`pkgname`=`links`.`pkgname`' + printf ' AND (' + printf '`binary_packages`.`sub_pkgrel`!=@sub_pkgrel' + printf ' OR `binary_packages`.`%s`!=`links`.`%s`' \ + 'epoch' 'epoch' \ + 'pkgver' 'pkgver' \ + 'pkgrel' 'pkgrel' + printf ')' + mysql_join_binary_packages_binary_packages_in_repositories + printf ' AND `binary_packages_in_repositories`.`repository`=%s' \ + "${current_repository_id}" + printf ';\n' + + printf 'DELETE `binary_packages`' + printf ' FROM `links`' + printf ' JOIN `architectures`' + printf ' ON `architectures`.`name`=`links`.`architecture`' + mysql_join_architectures_binary_packages + printf ' AND `binary_packages`.`pkgname`=`links`.`pkgname`' + printf ' AND (' + printf '`binary_packages`.`sub_pkgrel`!=@sub_pkgrel' + printf ' OR `binary_packages`.`%s`!=`links`.`%s`' \ + 'epoch' 'epoch' \ + 'pkgver' 'pkgver' \ + 'pkgrel' 'pkgrel' + printf ') LEFT' + mysql_join_binary_packages_binary_packages_in_repositories + printf ' WHERE `binary_packages_in_repositories`.`id` IS NULL;\n' + fi + printf 'INSERT IGNORE INTO `install_targets` (`name`)' printf ' SELECT `links`.`install_target_name`' printf ' FROM `links`;\n' -- cgit v1.2.3-70-g09d2