diff options
author | Erich Eckner <git@eckner.net> | 2018-02-13 10:38:17 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-02-13 10:38:17 +0100 |
commit | 85e1b4ef9f0da06b6bcb2a3c8e550fdd1bb8b794 (patch) | |
tree | 07624fa8f81fc6d9e8da73734ecbdb8a7635fd67 /bin/get-package-updates | |
parent | fd342d4b92aa6881df2903804829a54100b83367 (diff) | |
download | builder-85e1b4ef9f0da06b6bcb2a3c8e550fdd1bb8b794.tar.xz |
bin/get-package-updates: test_exclusion now cooperates with the database
Diffstat (limited to 'bin/get-package-updates')
-rwxr-xr-x | bin/get-package-updates | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/bin/get-package-updates b/bin/get-package-updates index 533f14f..465f896 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -9,8 +9,6 @@ # TODO: Find out, why sometimes package updates are missed. -# TODO: test_exclusion does not yet cooperate with the database - # TODO: read information from database # TODO: correctly handle if pkgbase of a split package is renamed, e.g.: @@ -104,31 +102,36 @@ delete_package() { echo "$1" >> \ "${work_dir}/deletion-list.new" sed -i "/^$(str_to_regex "${1}") /d" "${work_dir}/build-list.new" - # shellcheck disable=SC2016 - { - # packages from the build-list/to-be-decided go straight to the deletion-list - printf 'UPDATE `binary_packages`' - printf ' JOIN `%s` ON `%s`.`id`=`binary_packages`.`%s`' \ - 'repositories' 'repositories' 'repository' \ - 'build_assignments' 'build_assignments' 'build_assignment' - printf ' JOIN `%s` ON `%s`.`id`=`%s`.`%s`' \ - 'package_sources' 'package_sources' 'build_assignments' 'package_source' - printf ' SET `binary_packages`.`repository`=(SELECT `repositories`.`id` FROM `repositories` WHERE `repositories`.`name`="deletion-list")' - printf ' WHERE `repositories`.`name` in ("build-list","to-be-decided")' - printf ' AND `package_sources`.`pkgbase`=from_base64("%s");\n' \ - "$(printf '%s' "$1" | base64 -w0)" - # other packages are marked as `is_to_be_deleted` - printf 'UPDATE `binary_packages`' - printf ' JOIN `%s` ON `%s`.`id`=`binary_packages`.`%s`' \ - 'repositories' 'repositories' 'repository' \ - 'build_assignments' 'build_assignments' 'build_assignment' - printf ' JOIN `%s` ON `%s`.`id`=`%s`.`%s`' \ - 'package_sources' 'package_sources' 'build_assignments' 'package_source' - printf ' SET `binary_packages`.`is_to_be_deleted`=1' - printf ' WHERE `package_sources`.`pkgbase`=from_base64("%s");' \ - "$(printf '%s' "$1" | base64 -w0)" - } | \ - ${mysql_command} + # TODO: Once we want to rely on the database for test_exclusion, we + # need to run the command below unconditionally, but with some + # changes, so we can easily revert. + if [ -z "${test_exclusion}" ]; then + # shellcheck disable=SC2016 + { + # packages from the build-list/to-be-decided go straight to the deletion-list + printf 'UPDATE `binary_packages`' + printf ' JOIN `%s` ON `%s`.`id`=`binary_packages`.`%s`' \ + 'repositories' 'repositories' 'repository' \ + 'build_assignments' 'build_assignments' 'build_assignment' + printf ' JOIN `%s` ON `%s`.`id`=`%s`.`%s`' \ + 'package_sources' 'package_sources' 'build_assignments' 'package_source' + printf ' SET `binary_packages`.`repository`=(SELECT `repositories`.`id` FROM `repositories` WHERE `repositories`.`name`="deletion-list")' + printf ' WHERE `repositories`.`name` in ("build-list","to-be-decided")' + printf ' AND `package_sources`.`pkgbase`=from_base64("%s");\n' \ + "$(printf '%s' "$1" | base64 -w0)" + # other packages are marked as `is_to_be_deleted` + printf 'UPDATE `binary_packages`' + printf ' JOIN `%s` ON `%s`.`id`=`binary_packages`.`%s`' \ + 'repositories' 'repositories' 'repository' \ + 'build_assignments' 'build_assignments' 'build_assignment' + printf ' JOIN `%s` ON `%s`.`id`=`%s`.`%s`' \ + 'package_sources' 'package_sources' 'build_assignments' 'package_source' + printf ' SET `binary_packages`.`is_to_be_deleted`=1' + printf ' WHERE `package_sources`.`pkgbase`=from_base64("%s");' \ + "$(printf '%s' "$1" | base64 -w0)" + } | \ + ${mysql_command} + fi } # create tmp_dir and trap |