summaryrefslogtreecommitdiff
path: root/lib/mysql-functions
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-26 09:04:25 +0200
committerErich Eckner <git@eckner.net>2018-09-26 09:06:18 +0200
commitc62685fd40cbbf6ba16b440f1fd9c79290080fb7 (patch)
tree94887a84883e181579192810e995da7d22a62f6f /lib/mysql-functions
parent2135e09d9dd775cda7f8d62bc1d7ceb63c97e165 (diff)
downloadbuilder-c62685fd40cbbf6ba16b440f1fd9c79290080fb7.tar.xz
lib/mysql-functions: mysql_generate_package_metadata(): remove old binary_packages_in_repositories iff inserting into build-list or to-be-decided-list
Diffstat (limited to 'lib/mysql-functions')
-rwxr-xr-xlib/mysql-functions37
1 files changed, 37 insertions, 0 deletions
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'