index : builder | |
Archlinux32 build system | gitolite user |
summaryrefslogtreecommitdiff |
-rwxr-xr-x | lib/common-functions | 8 | ||||
-rwxr-xr-x | lib/mysql-functions | 50 |
diff --git a/lib/common-functions b/lib/common-functions index bf4306a..50dc6f1 100755 --- a/lib/common-functions +++ b/lib/common-functions @@ -126,6 +126,8 @@ ls_master_mirror() { remove_old_package_versions() { +# TODO: needs to remove binary_packages_in_repositories, too + ( # the new shell is intentional tmp_dir=$(mktemp -d 'tmp.common-functions.remove_old_package_versions.XXXXXXXXXX' --tmpdir) trap 'rm -rf --one-file-system "${tmp_dir}"' EXIT @@ -152,12 +154,14 @@ remove_old_package_versions() { mysql_package_name_query 'd_bp' 'd_bpa' printf ')' printf ' FROM `binary_packages` AS `d_bp`' - mysql_join_binary_packages_repositories 'd_bp' 'd_r' + mysql_join_binary_packages_binary_packages_in_repositories 'd_bp' 'd_bpir' + mysql_join_binary_packages_in_repositories_repositories 'd_bpir' 'd_r' printf ' AND `d_r`.`is_on_master_mirror`' mysql_join_repositories_architectures 'd_r' 'd_ra' mysql_join_binary_packages_architectures 'd_bp' 'd_bpa' printf ' JOIN `binary_packages` AS `o_bp` ON `d_bp`.`pkgname`=`o_bp`.`pkgname`' - mysql_join_binary_packages_repositories 'o_bp' 'o_r' + mysql_join_binary_packages_binary_packages_in_repositories 'o_bp' 'o_bpir' + mysql_join_binary_packages_in_repositories_repositories 'o_bpir' 'o_r' printf ' AND `o_r`.`is_on_master_mirror`' printf ' AND `o_r`.`architecture`=`d_r`.`architecture`' printf ' JOIN `repository_stability_relations`' diff --git a/lib/mysql-functions b/lib/mysql-functions index 4a719a8..4ed10a2 100755 --- a/lib/mysql-functions +++ b/lib/mysql-functions @@ -259,6 +259,8 @@ mysql_generate_package_metadata() { mysql_add_package_source "${pkgbase}" "${git_revision}" "${old_git_revision}" "${mod_git_revision}" "${repository}" "${temp_dir}/SRCINFO" ) + # TODO: architectures should be identified by id, not "(SELECT ...)" + # add the build assignment(s) { sed -n ' @@ -407,6 +409,7 @@ mysql_generate_package_metadata() { # packages!) printf '(SELECT `sub_pkgrel` FROM `binary_packages`' mysql_join_binary_packages_architectures + mysql_join_binary_packages_binary_packages_in_repositories printf ' WHERE' printf ' `binary_packages`.`%s`=from_base64("%s") AND' \ 'epoch' "${epoch}" \ @@ -415,7 +418,7 @@ mysql_generate_package_metadata() { 'pkgname' "${pkgname}" printf ' `architectures`.`name`=from_base64("%s")' \ "${arch}" - printf ' AND `binary_packages`.`repository` IN (%s,%s)),' \ + printf ' AND `binary_packages_in_repository`.`repository` IN (%s,%s)),' \ "${repository_ids__any_build_list}" \ "${current_repository_id}" # max(sub_pkgrel)+1 @@ -438,7 +441,7 @@ mysql_generate_package_metadata() { printf ')' printf ',0))' ) - { + { # TODO: fix this mess, I'm tired printf 'INSERT IGNORE INTO `binary_packages` (' printf '`%s`,' \ 'build_assignment' \ @@ -631,20 +634,23 @@ mysql_sanity_check() { printf ' AND `ba_arch`.`name`="any";\n' printf 'SELECT DISTINCT CONCAT("package multiple times on build list: ",`a`.`pkgname`)' printf ' FROM `binary_packages` AS `a`' - printf ' JOIN `binary_packages` AS `b`' - printf ' ON `a`.`pkgname`=`b`.`pkgname`' - printf ' AND `a`.`repository`=`b`.`repository`' + mysql_join_binary_packages_binary_packages_in_repositories 'a' 'a_bir' + printf ' JOIN `binary_packages_in_repositories` AS `b_bir`' + printf ' ON `b_bir`.`repository`=`a_bir`.`repository`' + mysql_join_binary_packages_in_repositories_binary_packages 'b_bir' 'b' + printf ' AND `a`.`pkgname`=`b`.`pkgname`' printf ' AND `a`.`id`!=`b`.`id`' - mysql_join_binary_packages_repositories 'a' - printf ' WHERE `repositories`.`name`="build-list";\n' + printf ' WHERE `a_bir`.`repository`=%s;\n' \ + "${repository_ids__any_build_list}" printf 'SELECT DISTINCT CONCAT("\\"split-package with differing sub_pkgrels on the build-list: ",`a`.`pkgname`)' printf ' FROM `binary_packages` AS `a`' printf ' JOIN `binary_packages` AS `b` ON `a`.`build_assignment`=`b`.`build_assignment`' - mysql_join_binary_packages_repositories 'a' 'arep' - mysql_join_binary_packages_repositories 'b' 'brep' + mysql_join_binary_packages_binary_packages_in_repositories 'a' 'a_bir' + mysql_join_binary_packages_binary_packages_in_repositories 'b' 'b_bir' printf ' WHERE `a`.`sub_pkgrel`!=`b`.`sub_pkgrel`' - printf ' AND `%srep`.`name`="build-list"' \ - 'a' 'b' + printf ' AND `%s_bir`.`repository`=%s' \ + 'a' "${repository_ids__any_build_list}" \ + 'b' "${repository_ids__any_build_list}" printf ';\n' } | \ mysql_run_query | \ @@ -677,7 +683,8 @@ mysql_sanity_check() { printf 'SELECT `r_a`.`name`,`repositories`.`name`,`pkgname`,`epoch`,`pkgver`,`pkgrel`,`sub_pkgrel`,`architectures`.`name`' printf ' FROM `binary_packages`' mysql_join_binary_packages_architectures - mysql_join_binary_packages_repositories + mysql_join_binary_packages_binary_packages_in_repositories + mysql_join_binary_packages_in_repositories_repositories mysql_join_repositories_architectures '' 'r_a' printf ' WHERE `repositories`.`is_on_master_mirror`' } | \ @@ -708,8 +715,10 @@ mysql_find_build_assignment_loops() { mysql_join_dependencies_install_target_providers mysql_join_install_target_providers_binary_packages '' 'packages_dependency' mysql_join_dependencies_binary_packages '' 'packages_dependent' - mysql_join_binary_packages_repositories 'packages_dependency' 'repositories_dependency' - mysql_join_binary_packages_repositories 'packages_dependent' 'repositories_dependent' + mysql_join_binary_packages_binary_packages_in_repositories 'packages_dependency' 'packages_in_repository_dependency' + mysql_join_binary_packages_in_repositories_repositories 'packages_in_repository_dependency' 'repositories_dependency' + mysql_join_binary_packages_binary_packages_in_repositories 'packages_dependent' 'packages_in_repository_dependent' + mysql_join_binary_packages_in_repositories_repositories 'packages_in_repository_dependent' 'repositories_dependent' printf ' WHERE `repositories_dependent`.`name`="build-list" AND `repositories_dependency`.`name`="build-list"' } | \ mysql_run_query | \ @@ -763,7 +772,8 @@ mysql_cleanup() { printf '`binary_packages` ' fi printf 'FROM `binary_packages`' - mysql_join_binary_packages_repositories + mysql_join_binary_packages_binary_packages_in_repositories + mysql_join_binary_packages_in_repositories_repositories printf ' WHERE `repositories`.`name`="to-be-decided";\n' # remove build_assignments w/o binary_package printf '%s FROM `build_assignments` ' \ @@ -797,7 +807,8 @@ mysql_cleanup() { else printf 'SELECT COUNT(DISTINCT `build_slaves`.`id`) FROM `repositories`' fi - mysql_join_repositories_binary_packages + mysql_join_repositories_binary_packages_in_repositories + mysql_join_binary_packages_in_repositories_binary_packages printf ' AND `repositories`.`name`="build-list"' printf ' RIGHT' mysql_join_binary_packages_build_slaves @@ -838,11 +849,13 @@ mysql_cleanup() { mysql_query_has_pending_dependencies() { printf 'EXISTS (' printf 'SELECT * FROM `binary_packages` as `to_dos`' - mysql_join_binary_packages_repositories 'to_dos' 'to_do_repos' + mysql_join_binary_packages_binary_packages_in_repositories 'to_dos' 'to_dos_pir' + mysql_join_binary_packages_in_repositories_repositories 'to_dos_pir' 'to_do_repos' mysql_join_binary_packages_dependencies 'to_dos' mysql_join_dependencies_install_target_providers mysql_join_install_target_providers_binary_packages '' 'bin_deps' - mysql_join_binary_packages_repositories 'bin_deps' 'dep_repos' + mysql_join_binary_packages_binary_packages_in_repositories 'bin_deps' 'binir_deps' + mysql_join_binary_packages_in_repositories_repositories 'binir_deps' 'dep_repos' printf ' WHERE' printf ' `%s`.`name`="build-list" AND' \ 'dep_repos' 'to_do_repos' @@ -945,7 +958,6 @@ for link in \ 'allowed_email_actions:gpg_key:gpg_keys' \ \ 'binary_packages:architecture:architectures' \ - 'binary_packages:repository:repositories' \ 'binary_packages:build_assignment:build_assignments' \ \ 'binary_packages_in_repositories:package:binary_packages' \ |