From d4984aa43e97ab09590b175c45cb162e577cf0fc Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Wed, 4 Sep 2019 14:30:17 +0200 Subject: bin/seed-build-list: implement blacklisting, update TODO --- bin/seed-build-list | 62 ++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 47 insertions(+), 15 deletions(-) (limited to 'bin') diff --git a/bin/seed-build-list b/bin/seed-build-list index a136777..819289e 100755 --- a/bin/seed-build-list +++ b/bin/seed-build-list @@ -592,7 +592,8 @@ if ${update}; then printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `pkgbases`(`pkgbase`);\n' \ "${tmp_dir}/pkgbases" -# TODO: this seems to be broken (deletes too few packages) +# TODO: this seems to be broken (deletes too few packages) - still valid +# after implementing the correct blacklisting below? printf 'DELETE `d_bpir`' printf ' FROM `pkgbases`' # the package on the deletion-list ... @@ -637,22 +638,53 @@ if ${update}; then printf '`pkgbase` VARCHAR (64),' printf 'UNIQUE KEY `content`(`architecture`,`pkgbase`)' printf ');\n' - printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `blacklist`(`architecture`,`pkgbase`);\n' \ + printf 'LOAD DATA LOCAL INFILE "%s" INTO TABLE `blacklist` COLUMNS TERMINATED BY " " (`architecture`,`pkgbase`);\n' \ "${tmp_dir}/blacklist" -# TODO: finish this! -# printf 'UPDATE `blacklist`' .. will not work (blacklisting "any" packages needs to create multiple binary_packages_in_repositories) -# printf ' JOIN `package_sources`' -# printf ' ON `blacklist`.`pkgbase`=`package_sources`.`pkgbase`' -# mysql_join_package_sources_build_assignments -# mysql_join_build_assignments_architectures -# printf ' AND `architectures`.`name`=`blacklist`.`architecture`' -# mysql_join_build_assignments_binary_packages -# mysql_join_binary_packages_binary_packages_in_repositories -# printf ' AND `binary_packages_in_repositories`.`repositories`=%s' \ -# "${repository_ids__any_build_list}" -# printf ' JOIN `repositories` AS `dl_r`' -# printf ' ON `dl_r`.`architecture`' ... see above + printf 'INSERT IGNORE INTO `binary_packages_in_repositories` (' + printf '`package`,' + printf '`repository`,' + printf '`is_to_be_deleted`' + printf ')' + printf ' SELECT' + printf ' `binary_packages`.`id`,' + printf '`dl_r`.`id`,' + printf '1' + printf ' FROM `blacklist`' + printf ' JOIN `package_sources`' + printf ' ON `blacklist`.`pkgbase`=`package_sources`.`pkgbase`' + mysql_join_package_sources_build_assignments + mysql_join_build_assignments_architectures + printf ' AND `architectures`.`name`=`blacklist`.`architecture`' + mysql_join_build_assignments_binary_packages + mysql_join_binary_packages_binary_packages_in_repositories + printf ' AND `binary_packages_in_repositories`.`repository`=%s' \ + "${repository_ids__any_build_list}" + printf ' JOIN `architecture_compatibilities` AS `ac`' + printf ' ON `ac`.`built_for`=`binary_packages`.`architecture`' + printf ' AND `ac`.`fully_compatible`' + printf ' JOIN `repositories` AS `dl_r`' + printf ' ON `ac`.`runs_on`=`dl_r`.`architecture`' + # shellcheck disable=SC2154 + printf ' AND `dl_r`.`stability`=%s;\n' \ + "${repository_stability_ids__forbidden}" + + printf 'DELETE `binary_packages_in_repositories`' + printf ' FROM `blacklist`' + printf ' JOIN `package_sources`' + printf ' ON `blacklist`.`pkgbase`=`package_sources`.`pkgbase`' + mysql_join_package_sources_build_assignments + mysql_join_build_assignments_architectures + printf ' AND `architectures`.`name`=`blacklist`.`architecture`' + mysql_join_build_assignments_binary_packages + mysql_join_binary_packages_binary_packages_in_repositories + printf ' AND `binary_packages_in_repositories`.`repository`=%s' \ + "${repository_ids__any_build_list}" + printf ' AND (' + printf '`binary_packages`.`architecture`=`architectures`.`id`' + printf ' OR `architectures`.`id`=%s' \ + "${architecture_ids__any}" + printf ');\n' } | \ mysql_run_query -- cgit v1.2.3-70-g09d2