summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-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'