index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
author | Erich Eckner <git@eckner.net> | 2018-07-25 15:51:58 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-07-25 15:51:58 +0200 |
commit | dfda73807ee7e016e65fb298b54f5edc2880ecb5 (patch) | |
tree | 62a281711c4c5a11c7201fbdfec4c84c301f966f /bin | |
parent | 700df20c73efe5779a05617485c815ab686bd227 (diff) |
-rwxr-xr-x | bin/seed-build-list | 70 |
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 |