summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/return-assignment103
1 files changed, 102 insertions, 1 deletions
diff --git a/bin/return-assignment b/bin/return-assignment
index 17a742b..08e43f8 100755
--- a/bin/return-assignment
+++ b/bin/return-assignment
@@ -679,7 +679,87 @@ trigger_mirror_refreshs
"${tmp_dir}/repository-ids"
printf 'COMMIT;\n'
-# TODO: do not remove toolchain build assignments if they need to be compiled a second time
+ # reschedule toolchain packages if they were not fully unblocked
+ mysql_query_create_toolchain_order
+ printf 'INSERT IGNORE INTO `binary_packages` ('
+ printf '`build_assignment`,'
+ printf '`epoch`,'
+ printf '`pkgver`,'
+ printf '`pkgrel`,'
+ printf '`has_issues`,'
+ printf '`is_tested`,'
+ printf '`pkgname`,'
+ printf '`architecture`,'
+ printf '`sub_pkgrel`)'
+ printf ' SELECT '
+ printf '`binary_packages`.`%s`,' \
+ 'build_assignment' \
+ 'epoch' \
+ 'pkgver' \
+ 'pkgrel' \
+ 'has_issues' \
+ 'is_tested' \
+ 'pkgname' \
+ 'architecture'
+ printf '`binary_packages`.`sub_pkgrel`+1'
+ printf ' FROM `binary_packages`'
+ printf ' JOIN `pkg_hashes`'
+ printf ' ON `pkg_hashes`.`pkgid`=`binary_packages`.`id`'
+ mysql_join_binary_packages_build_assignments
+ mysql_join_build_assignments_package_sources
+ printf ' JOIN `toolchain_order` AS `late`'
+ printf ' ON `late`.`pkgbase`=`package_sources`.`pkgbase`'
+ printf ' JOIN `toolchain_order_copy` AS `early`'
+ printf ' ON `early`.`number`<`late`.`number`'
+ printf ' AND `early`.`pkgbase`!=`late`.`pkgbase`'
+ printf ' JOIN `package_sources` AS `early_ps`'
+ printf ' ON `early`.`pkgbase`=`early_ps`.`pkgbase`'
+ mysql_join_package_sources_build_assignments 'early_ps' 'early_ba'
+ mysql_join_build_assignments_binary_packages 'early_ba' 'early_bp'
+ mysql_join_binary_packages_binary_packages_in_repositories 'early_bp' 'early_bpir'
+ printf ' AND `early_bpir`.`repository`=%s' \
+ "${repository_ids__any_build_list}"
+ printf ' WHERE `early_bp`.`architecture`=`binary_packages`.`architecture`'
+ # shellcheck disable=SC2154
+ printf ' OR `%s`.`architecture`=%s' \
+ 'early_bp' "${architecture_ids__any}" \
+ 'binary_packages' "${architecture_ids__any}"
+
+ join_part=$(
+ printf ' JOIN `pkg_hashes`'
+ printf ' ON `built_bp`.`id`=`pkg_hashes`.`pkgid`'
+ printf ' JOIN `binary_packages` AS `new_bp`'
+ printf ' ON'
+ printf ' `built_bp`.`%s`=`new_bp`.`%s` AND' \
+ 'build_assignment' 'build_assignment' \
+ 'epoch' 'epoch' \
+ 'pkgver' 'pkgver' \
+ 'pkgrel' 'pkgrel' \
+ 'has_issues' 'has_issues' \
+ 'is_tested' 'is_tested' \
+ 'pkgname' 'pkgname' \
+ 'architecture' 'architecture'
+ printf ' `built_bp`.`sub_pkgrel`+1=`new_bp`.`sub_pkgrel`'
+ )
+ printf 'INSERT IGNORE INTO `binary_packages_in_repositories`'
+ printf ' (`package`,`repository`,`is_to_be_deleted`)'
+ printf ' SELECT `new_bp`.`id`,%s,0' \
+ "${repository_ids__any_build_list}"
+ printf ' FROM `binary_packages` AS `built_bp`'
+ printf '%s;\n' "${join_part}"
+ printf 'INSERT IGNORE INTO `dependencies`'
+ printf ' (`dependent`,`depending_on`,`dependency_type`)'
+ printf ' SELECT `new_bp`.`id`,`dependencies`.`depending_on`,`dependencies`.`dependency_type`'
+ printf ' FROM `dependencies`'
+ mysql_join_dependencies_binary_packages '' 'built_bp'
+ printf '%s;\n' "${join_part}"
+ printf 'INSERT IGNORE INTO `install_target_providers`'
+ printf ' (`package`,`install_target`)'
+ printf ' SELECT `new_bp`.`id`,`install_target_providers`.`install_target`'
+ printf ' FROM `install_target_providers`'
+ mysql_join_install_target_providers_binary_packages '' 'built_bp'
+ printf '%s;\n' "${join_part}"
+
# remove from build-list
printf 'DELETE `binary_packages_in_repositories`'
printf ' FROM `binary_packages_in_repositories`'
@@ -689,6 +769,27 @@ trigger_mirror_refreshs
"${repository_ids__any_build_list}"
printf 'COMMIT;\n'
+ printf ' AND NOT EXISTS ('
+ printf 'SELECT 1 FROM `toolchain_order` AS `late`'
+ printf ' JOIN `toolchain_order` AS `early`'
+ printf ' ON `early`.`number`<`late`.`number`'
+ printf ' AND `early`.`pkgbase`!=`late`.`pkgbase`'
+ printf ' JOIN `package_sources` AS `early_ps`'
+ printf ' ON `early_ps`.`pkgbase`=`early`.`pkgbase`'
+ mysql_join_package_sources_build_assignments 'early_ps' 'early_ba'
+ mysql_join_build_assignments_binary_packages 'early_ba' 'early_bp'
+ mysql_join_binary_packages_binary_packages_in_repositories 'early_bp' 'early_bpir'
+ printf ' AND `early_bpir`.`repository`=%s' \
+ "${repository_ids__any_build_list}"
+ printf ' WHERE `late`.`pkgbase`=`package_sources`.`pkgbase`'
+ printf ' AND ('
+ printf '`early_bp`.`architecture`=`binary_packages`.`architecture`'
+ printf ' OR `%s`.`architecture`=%s' \
+ 'early_bp' "${architecture_ids__any}" \
+ 'binary_packages' "${architecture_ids__any}"
+ printf ')'
+ printf ');\n'
+
# update package information
printf 'UPDATE `binary_packages`'
printf ' SET'