From dfda73807ee7e016e65fb298b54f5edc2880ecb5 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 25 Jul 2018 15:51:58 +0200 Subject: bin/seed-build-list: upon un-deleting a package, actually _remove_ it from the deletion-list --- bin/seed-build-list | 70 ++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 56 insertions(+), 14 deletions(-) diff --git a/bin/seed-build-list b/bin/seed-build-list index 25b7f42..8d51475 100755 --- a/bin/seed-build-list +++ b/bin/seed-build-list @@ -5,9 +5,6 @@ # shellcheck source=../lib/load-configuration . "${0%/*}/../lib/load-configuration" -# TODO: upon un-deleting a package, actually _remove_ it from the -# deletion-list - # shellcheck disable=SC2016 usage() { >&2 echo '' @@ -540,16 +537,61 @@ fi printf ');\n' } | \ mysql_run_query | \ - sort -u | \ tr '\t' ' ' | \ - if ${update}; then - while read -r pkgbase git_rev mod_git_rev repo; do - printf '%s ' "${pkgbase}" "${git_rev}" "${mod_git_rev}" "${repo}" | \ - sed 's/ $/\n/' - mysql_generate_package_metadata "${repository_ids__any_build_list}" "${pkgbase}" "${git_rev}" '' "${mod_git_rev}" "${repo}" - done + sort -u > \ + "${tmp_dir}/update-list" - rm -f "${build_list_lock_file}" - else - cat - fi +if ${update}; then + while read -r pkgbase git_rev mod_git_rev repo; do + printf '%s ' "${pkgbase}" "${git_rev}" "${mod_git_rev}" "${repo}" | \ + sed 's/ $/\n/' + mysql_generate_package_metadata "${repository_ids__any_build_list}" "${pkgbase}" "${git_rev}" '' "${mod_git_rev}" "${repo}" + done < \ + "${tmp_dir}/update-list" + + cut -d' ' -f1 < \ + "${tmp_dir}/update-list" | \ + sort -u | \ + sponge "${tmp_dir}/update-list" + + # shellcheck disable=SC2016 + { + printf 'CREATE TEMPORARY TABLE `pkgbases` (' + printf '`pkgbase` VARCHAR (64),' + printf 'UNIQUE KEY `pkgbase`(`pkgbase`)' + printf ');\n' + printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `pkgbases`(`pkgbase`);\n' \ + "${tmp_dir}/update-list" + + printf 'DELETE `d_bpir`' + printf ' FROM `pkgbases`' + # the package on the deletion-list ... + printf ' JOIN `package_sources` AS `d_ps`' + printf ' ON `pkgbases`.`pkgbase`=`d_ps`.`pkgbase`' + mysql_join_package_sources_build_assignments 'd_ps' 'd_ba' + mysql_join_build_assignments_binary_packages 'd_ba' 'd_bp' + mysql_join_binary_packages_binary_packages_in_repositories 'd_bp' 'd_bpir' + mysql_join_binary_packages_in_repositories_repositories 'd_bpir' 'd_r' + # shellcheck disable=SC2154 + printf ' AND `d_r`.`stablility`=%s' \ + "${stability_ids__forbidden}" + # ... needs a counter-part on the build-list (which was just created) + printf ' JOIN `package_sources` AS `a_ps`' + printf ' ON `pkgbases`.`pkgbase`=`a_ps`.`pkgbase`' + mysql_join_package_sources_build_assignments 'a_ps' 'a_ba' + mysql_join_build_assignments_binary_packages 'a_ba' 'a_bp' + mysql_join_binary_packages_architectures 'a_bp' 'a_bpa' + printf ' AND (' + printf '`a_bpa`.`name`="any"' + printf ' OR `a_bpa`.`id`=`d_r`.`architecture`' + printf ')' + mysql_join_binary_packages_binary_packages_in_repositories 'a_bp' 'a_bpir' + printf ' AND `a_bpir`.`repository`=%s;\n' \ + "${repository_ids__any_build_list}" + } | \ + mysql_run_query + + rm -f "${build_list_lock_file}" +else + cat "${tmp_dir}/update-list" +fi -- cgit v1.2.3-70-g09d2