index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-05-15 10:32:39 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-05-15 10:32:39 +0200 |
commit | 8164a438c460fafb090656151a8ac221d288856d (patch) | |
tree | 742cab823ed41ce6999f471c3d59ceb2ad0bfe18 /bin/get-package-updates | |
parent | 1eb61f044cb3a58534257b046ed1020dc8573b5a (diff) |
-rwxr-xr-x | bin/get-package-updates | 53 |
diff --git a/bin/get-package-updates b/bin/get-package-updates index eb45ffd..bb4c0fc 100755 --- a/bin/get-package-updates +++ b/bin/get-package-updates @@ -104,6 +104,8 @@ if [ -s "${work_dir}/build-master-sanity" ]; then exit fi +mysql_retrieve_repository_ids + # TODO: How should new deletion-list packages be handled? # - packages deleted upstream should be marked as to-be-deleted if # existent and otherwise be ignored @@ -122,27 +124,25 @@ delete_package() { { # packages from the build-list/to-be-decided go straight to the deletion-list printf 'UPDATE `binary_packages`' - mysql_join_binary_packages_repositories mysql_join_binary_packages_build_assignments mysql_join_build_assignments_package_sources - 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)" - printf 'COMMIT;\n' - printf 'UPDATE `binary_packages_in_repositories`' - mysql_join_binary_packages_in_repositories_binary_packages - mysql_join_binary_packages_repositories - mysql_join_binary_packages_build_assignments - mysql_join_build_assignments_package_sources - 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 ' LEFT' + mysql_join_binary_packages_binary_packages_in_repositories + # shellcheck disable=SC2154 + printf ' SET `binary_packages`.`repository`=%s,' \ + "${repository_ids__any_deletion_list}" + # shellcheck disable=SC2154 + printf '`binary_packages_in_repositories`.`repository`=%s' \ + "${repository_ids__any_deletion_list}" + # shellcheck disable=SC2154 + printf ' WHERE `binary_packages`.`repository` in (%s,%s)' \ + "${repository_ids__any_build_list}" \ + "${repository_ids__any_to_be_decided}" printf ' AND `package_sources`.`pkgbase`=from_base64("%s");\n' \ "$(printf '%s' "$1" | base64 -w0)" printf 'COMMIT;\n' # other packages are marked as `is_to_be_deleted` printf 'UPDATE `binary_packages`' - mysql_join_binary_packages_repositories mysql_join_binary_packages_build_assignments mysql_join_build_assignments_package_sources printf ' SET `binary_packages`.`is_to_be_deleted`=1' @@ -229,12 +229,12 @@ trigger_rebuild_on_any_file_sed_expression=$( printf '`upstream_repositories`.`name`,"-",' printf 'IF(`architectures`.`name`="any","any","x86_64"))' printf ' FROM `binary_packages`' - mysql_join_binary_packages_repositories mysql_join_binary_packages_build_assignments mysql_join_build_assignments_architectures mysql_join_build_assignments_package_sources mysql_join_package_sources_upstream_repositories - printf ' WHERE `repositories`.`name`="build-list";\n' + printf ' WHERE `binary_packages`.`repositories`=%s;\n' \ + "${repository_ids__any_build_list}" } | \ mysql_run_query | \ sed ' @@ -378,18 +378,18 @@ trigger_rebuild_on_any_file_sed_expression=$( printf ' FROM `binary_packages`' mysql_join_binary_packages_build_assignments mysql_join_build_assignments_package_sources - mysql_join_binary_packages_repositories printf ' WHERE `package_sources`.`pkgbase`=from_base64("%s")' \ "$( printf '%s' "${package}" | \ base64 -w0 )" - printf ' AND (`repositories`.`name`="build-list" OR `repositories`.`name`="deletion-list");\n' + printf ' AND `binary_packages`.`repositories` IN (%s,%s);\n' \ + "${repository_ids__any_build_list}" \ + "${repository_ids__any_deletion_list}" # remove is-to-be-deleted marker from old binary packages printf 'UPDATE `binary_packages`' mysql_join_binary_packages_build_assignments mysql_join_build_assignments_package_sources - mysql_join_binary_packages_repositories printf ' SET `is_to_be_deleted`=0' printf ' WHERE `package_sources`.`pkgbase`=from_base64("%s");\n' \ "$( @@ -580,6 +580,7 @@ echo 'Done - mark decisions as final.' printf ' LEFT JOIN `bl` ON `package_sources`.`pkgbase`=`bl`.`pkgbase`' printf ' SET `build_assignments`.`is_black_listed`=`bl`.`reason`;\n' printf 'DROP TEMPORARY TABLE `bl`;\n' + printf 'COMMIT;\n' # update hashes of repositories in mysql database for repo in ${repo_names}; do @@ -594,16 +595,10 @@ echo 'Done - mark decisions as final.' mysql_join_binary_packages_repositories '' 'from_repo' printf ' LEFT' mysql_join_binary_packages_binary_packages_in_repositories - printf ' SET `binary_packages`.`repository`=(' - printf 'SELECT `to_repo`.`id`' - printf ' FROM `repositories` AS `to_repo`' - printf ' WHERE `to_repo`.`name`="build-list"' - printf '),' - printf ' `binary_packages_in_repositories`.`repository`=(' - printf 'SELECT `to_repo`.`id`' - printf ' FROM `repositories` AS `to_repo`' - printf ' WHERE `to_repo`.`name`="build-list"' - printf ')' + printf ' SET `binary_packages`.`repository`=%s,' \ + "${repository_ids__any_build_list}" + printf '`binary_packages_in_repositories`.`repository`=%s' \ + "${repository_ids__any_build_list}" printf ' WHERE `from_repo`.`name`="to-be-decided";\n' } | \ mysql_run_query |