summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2020-02-13 11:10:41 +0100
committerErich Eckner <git@eckner.net>2020-02-13 11:13:22 +0100
commit47c8a23cf8e71b44adcddddba6bba2ae32c33726 (patch)
tree729d86314f04f006d52f27ffa2ce1a3f6ca1dfe8 /bin
parent68df3b54a3335f6639dc269f879b60d13cd14cbc (diff)
downloadbuilder-47c8a23cf8e71b44adcddddba6bba2ae32c33726.tar.xz
bin/get-package-updates: do not delete build assignment just because *one* package built by it is on the deletion-list - remove the deletion-list package and keep the build-assignment in that case
Diffstat (limited to 'bin')
-rwxr-xr-xbin/get-package-updates57
1 files changed, 40 insertions, 17 deletions
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