index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | bin/get-package-updates | 57 |
diff --git a/bin/get-package-updates b/bin/get-package-updates index b293543..2c7afce 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -416,23 +416,46 @@ echo 'Check modified packages from the last update, and put them to the build li if [ "${mode}" = 'A' ] || [ "${mode}" = 'M' ]; then # shellcheck disable=SC2016 { - # delete old build assignment and associated binary packages - # which are not yet built or on the deletion list - printf 'DELETE `build_assignments`,`binary_packages`,`binary_packages_in_repositories`' - printf ' FROM `binary_packages`' - mysql_join_binary_packages_build_assignments - mysql_join_build_assignments_package_sources - mysql_join_binary_packages_binary_packages_in_repositories - mysql_join_binary_packages_in_repositories_repositories - printf ' WHERE `package_sources`.`pkgbase`=from_base64("%s")' \ - "$( - printf '%s' "${package}" | \ - base64 -w0 - )" - # shellcheck disable=SC2154 - printf ' AND `repositories`.`stability` IN (%s,%s);\n' \ - "${repository_stability_ids__unbuilt}" \ - "${repository_stability_ids__forbidden}" + # delete old binary packages which are not yet built or on the + # deletion list and their build_assignment, if it only built + # deleted packages (first try deleting the build assignment, + # otherwise we loose the handle on it!) + for with_ba in true false; do + printf 'DELETE ' + if "${with_ba}"; then + # try to delete build-assignment, too + printf '`build_assignments`,' + fi + printf '`binary_packages`,`binary_packages_in_repositories`' + printf ' FROM `binary_packages`' + mysql_join_binary_packages_build_assignments + mysql_join_build_assignments_package_sources + if "${with_ba}"; then + # some package not unbuilt or not on the deletion-list? + mysql_join_binary_packages_binary_packages_in_repositories '' 'keep_bpir' + printf ' LEFT' + mysql_join_binary_packages_in_repositories_repositories 'keep_bpir' 'keep_r' + # shellcheck disable=SC2154 + printf ' AND `all_r`.`stability` NOT IN (%s,%s);\n' \ + "${repository_stability_ids__unbuilt}" \ + "${repository_stability_ids__forbidden}" + fi + mysql_join_binary_packages_binary_packages_in_repositories + mysql_join_binary_packages_in_repositories_repositories + printf ' WHERE `package_sources`.`pkgbase`=from_base64("%s")' \ + "$( + printf '%s' "${package}" | \ + base64 -w0 + )" + if "${with_ba}"; then + # only if all packages unbuilt or on the deletion-list + printf ' AND `keep_r`.`id` IS NULL' + fi + # shellcheck disable=SC2154 + printf ' AND `repositories`.`stability` IN (%s,%s);\n' \ + "${repository_stability_ids__unbuilt}" \ + "${repository_stability_ids__forbidden}" + done # remove is-to-be-deleted marker from old binary packages printf 'UPDATE `binary_packages_in_repositories`' mysql_join_binary_packages_in_repositories_binary_packages |