summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-09-05 15:03:38 +0200
committerErich Eckner <git@eckner.net>2018-09-05 15:03:38 +0200
commit0cf0640014b4b6c1d7939a7afe730b5f69426cdf (patch)
treef298cb31ac9f8a0147f78419d461e45c8a6bb6c3
parent0eecec43af96dd9d7917d12f6c031e8c98a769d9 (diff)
downloadbuilder-0cf0640014b4b6c1d7939a7afe730b5f69426cdf.tar.xz
lib/mysql-functions: fix calculation of sub_pkgrel
-rwxr-xr-xlib/mysql-functions12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions
index 45bf3df..69c782e 100755
--- a/lib/mysql-functions
+++ b/lib/mysql-functions
@@ -391,7 +391,14 @@ mysql_generate_package_metadata() {
"${temp_dir}/database-input"
printf 'SET @sub_pkgrel=('
- printf 'SELECT IFNULL(MAX(`binary_packages`.`sub_pkgrel`)+1,0)'
+ printf 'SELECT IFNULL('
+ printf 'MAX('
+ printf '`binary_packages`.`sub_pkgrel`+'
+ printf 'IF(`binary_packages_in_repositories`.`repository`!=%s,1,0)' \
+ "${repository_ids__any_build_list}"
+ printf '),'
+ printf '0'
+ printf ')'
printf ' FROM `links`'
printf ' JOIN `architectures`'
printf ' ON `architectures`.`name`=`links`.`architecture`'
@@ -403,9 +410,6 @@ mysql_generate_package_metadata() {
'pkgrel' 'pkgrel'
printf ' LEFT'
mysql_join_binary_packages_binary_packages_in_repositories
- printf ' WHERE `binary_packages_in_repositories`.`repository`!=%s' \
- "${repository_ids__any_build_list}"
- printf ' OR `binary_packages_in_repositories`.`repository` IS NULL'
printf ');\n'
printf 'INSERT IGNORE INTO `build_assignments` ('