diff options
author | Erich Eckner <git@eckner.net> | 2018-10-11 10:47:43 +0200 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-10-11 10:52:37 +0200 |
commit | 1f60caaf2c601a18ecf25dd130fa185d4a098eea (patch) | |
tree | 3d8fae374b29b51aacc1b12fd25b2299cf4a207f | |
parent | e3e17d228bae8d86a7797f66c005b1b5ff9bce72 (diff) | |
download | builder-1f60caaf2c601a18ecf25dd130fa185d4a098eea.tar.xz |
lib/mysql-functions: mysql_generate_package_metadata() should remove identical binary_packages which are unbuilt before inserting new ones
-rwxr-xr-x | lib/mysql-functions | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/lib/mysql-functions b/lib/mysql-functions index 1eca658..e1f0d6c 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -216,7 +216,7 @@ mysql_generate_package_metadata() { trap 'rm -rf --one-file-system "${temp_dir}"' EXIT if ! make_source_info "${package}" "${repository}" "${git_revision}" "${mod_git_revision}" "${temp_dir}/SRCINFO"; then - printf '"make_source_info %s %s %s %s %s" failed.\n' "${package}" "${repository}" "${git_revision}" "${mod_git_revision}" "${temp_dir}/SRCINFO" + >&2 printf '"make_source_info %s %s %s %s %s" failed.\n' "${package}" "${repository}" "${git_revision}" "${mod_git_revision}" "${temp_dir}/SRCINFO" exit 2 fi # remove empty lines and unsupported architectures @@ -420,6 +420,35 @@ mysql_generate_package_metadata() { printf ' ON `architectures`.`name`=`links`.`build_architecture`' printf ' WHERE `links`.`type`="arch";\n' + # we delete unbuilt binary_packages of identical version prior to + # inserting, so we can _update_ a build list entry (e.g. because + # the source changed, but the version stays the same) + printf 'DELETE `binary_packages`' + printf ' FROM `links`' + printf ' JOIN `architectures`' + printf ' ON `links`.`architecture`=`architectures`.`name`' + printf ' JOIN `architectures` AS `ba_a`' + printf ' ON `ba_a`.`name`=`links`.`build_architecture`' + mysql_join_architectures_build_assignments 'ba_a' + mysql_join_build_assignments_binary_packages + printf ' AND `binary_packages`.`%s`=`links`.`%s`' \ + 'pkgname' 'pkgname' \ + 'epoch' 'epoch' \ + 'pkgver' 'pkgver' \ + 'pkgrel' 'pkgrel' + printf ' AND `binary_packages`.`sub_pkgrel`=@sub_pkgrel' + printf ' AND `binary_packages`.`architecture`=`architectures`.`id`' + printf ' WHERE `links`.`type`="arch"' + # the below test should always give "true", but it is a useful + # safeguard to not delete built packages from the database + printf ' AND NOT EXISTS(' + printf 'SELECT 1' + printf ' FROM `binary_packages_in_repositories`' + mysql_join_binary_packages_in_repositories_repositories + printf ' WHERE `repositories`.`is_on_master_mirror`' + printf ' AND `binary_packages_in_repositories`.`package`=`binary_packages`.`id`' + printf ');\n' + printf 'INSERT IGNORE INTO `binary_packages` (' printf '`build_assignment`,' printf '`pkgname`,' |