index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2020-02-13 11:10:41 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2020-02-13 11:13:22 +0100 |
commit | 47c8a23cf8e71b44adcddddba6bba2ae32c33726 (patch) | |
tree | 729d86314f04f006d52f27ffa2ce1a3f6ca1dfe8 /bin/get-package-updates | |
parent | 68df3b54a3335f6639dc269f879b60d13cd14cbc (diff) |
-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 |