diff options
author | Erich Eckner <git@eckner.net> | 2018-11-09 10:50:09 +0100 |
---|---|---|
committer | Erich Eckner <git@eckner.net> | 2018-11-09 10:50:09 +0100 |
commit | f89a3fd4c3577eba5a9e3f1c1d27c26fb8432f7b (patch) | |
tree | a7720fef45dd700374cda0843ed2d2354ac5bc28 /buildmaster | |
parent | 1a9e9dc143b73b29113c5d22c0812f25c43cd34a (diff) | |
download | archweb32-f89a3fd4c3577eba5a9e3f1c1d27c26fb8432f7b.tar.xz |
lib/mysql-joins.php new: it contains mysql_join_* functions similar to the ones in lib/mysql-functions of the build scripts
Diffstat (limited to 'buildmaster')
-rw-r--r-- | buildmaster/blacklist.php | 4 | ||||
-rw-r--r-- | buildmaster/build-list-links.php | 18 | ||||
-rw-r--r-- | buildmaster/build-list.php | 38 | ||||
-rw-r--r-- | buildmaster/build-slaves.php | 12 | ||||
-rw-r--r-- | buildmaster/deletion-links.php | 16 | ||||
-rw-r--r-- | buildmaster/dependencies.php | 68 | ||||
-rw-r--r-- | buildmaster/gpg-keys.php | 9 | ||||
-rw-r--r-- | buildmaster/log.php | 9 | ||||
-rw-r--r-- | buildmaster/mysql-issues.php | 56 | ||||
-rw-r--r-- | buildmaster/status.php | 31 | ||||
-rw-r--r-- | buildmaster/to-delete.php | 10 |
11 files changed, 128 insertions, 143 deletions
diff --git a/buildmaster/blacklist.php b/buildmaster/blacklist.php index acd59e9..24247e8 100644 --- a/buildmaster/blacklist.php +++ b/buildmaster/blacklist.php @@ -9,8 +9,8 @@ require_once BASE . "/lib/mysql.php"; "`package_sources`.`pkgbase`," . "`build_assignments`.`is_black_listed` " . "FROM `build_assignments` " . - "JOIN `architectures` ON `build_assignments`.`architecture`=`architectures`.`id` " . - "JOIN `package_sources` ON `build_assignments`.`package_source`=`package_sources`.`id` " . + mysql_join_build_assignments_architectures() . + mysql_join_build_assignments_package_sources() . "WHERE `build_assignments`.`is_black_listed` IS NOT NULL " . "GROUP BY CONCAT(to_base64(`package_sources`.`pkgbase`),\" - \",to_base64(`build_assignments`.`is_black_listed`)) " . "ORDER BY `package_sources`.`pkgbase`" diff --git a/buildmaster/build-list-links.php b/buildmaster/build-list-links.php index 3d4badf..e3d2779 100644 --- a/buildmaster/build-list-links.php +++ b/buildmaster/build-list-links.php @@ -26,9 +26,9 @@ $query = " `build_assignments`.`id`," . "IF(`build_assignments`.`is_broken`,\"#ff0000\",IF(`build_assignments`.`is_blocked` IS NULL,\"#000000\",\"#800000\"))" . " FROM `binary_packages_in_repositories`" . - " JOIN `binary_packages` ON `binary_packages_in_repositories`.`package`=`binary_packages`.`id`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . - " JOIN `build_assignments` ON `binary_packages`.`build_assignment`=`build_assignments`.`id`" . + mysql_join_binary_packages_in_repositories_binary_packages() . + mysql_join_binary_packages_in_repositories_repositories() . + mysql_join_binary_packages_build_assignments() . " WHERE `repositories`.`name`=\"build-list\"" . $limit; if (isset($_GET["raw"])) @@ -71,10 +71,10 @@ $query = "`d_bp`.`build_assignment`," . "`dependencies`.`dependency_type`" . " FROM `ba`" . - " JOIN `binary_packages` AS `d_bp` ON `d_bp`.`build_assignment`=`ba`.`id`" . - " JOIN `dependencies` ON `d_bp`.`id`=`dependencies`.`dependent`" . - " JOIN `install_target_providers` ON `install_target_providers`.`install_target`=`dependencies`.`depending_on`" . - " JOIN `binary_packages` AS `i_bp` ON `i_bp`.`id`=`install_target_providers`.`package`" . + mysql_join_build_assignments_binary_packages('ba','d_bp') . + mysql_join_binary_packages_dependencies('d_bp') . + mysql_join_dependencies_install_target_providers() . + mysql_join_install_target_providers_binary_packages('','i_bp') . " JOIN `ba_copy` ON `i_bp`.`build_assignment`=`ba_copy`.`id`" . " WHERE `d_bp`.`build_assignment`!=`i_bp`.`build_assignment`"; if (isset($_GET["raw"])) @@ -140,8 +140,8 @@ $query = " `ba`.`color`" . " FROM `ba`" . " JOIN `build_assignments` ON `ba`.`id`=`build_assignments`.`id`" . - " JOIN `package_sources` ON `build_assignments`.`package_source`=`package_sources`.`id`" . - " JOIN `architectures` ON `build_assignments`.`architecture`=`architectures`.`id`" . + mysql_join_build_assignments_package_sources() . + mysql_join_build_assignments_architectures() . " GROUP BY `ba`.`group`"; if (isset($_GET["raw"])) print $query . ";\n"; diff --git a/buildmaster/build-list.php b/buildmaster/build-list.php index 11ccb59..dbade40 100644 --- a/buildmaster/build-list.php +++ b/buildmaster/build-list.php @@ -272,13 +272,13 @@ $result = mysql_run_query( "`git_repositories`.`name` AS `git_repository`," . "`architectures`.`name` AS `arch`" . " FROM `build_assignments`" . - " JOIN `architectures` ON `build_assignments`.`architecture` = `architectures`.`id`" . - " JOIN `package_sources` ON `build_assignments`.`package_source` = `package_sources`.`id`" . - " JOIN `upstream_repositories` ON `package_sources`.`upstream_package_repository` = `upstream_repositories`.`id`" . - " JOIN `git_repositories` ON `upstream_repositories`.`git_repository`=`git_repositories`.`id`" . - " JOIN `binary_packages` ON `binary_packages`.`build_assignment` = `build_assignments`.`id`" . - " JOIN `binary_packages_in_repositories` ON `binary_packages`.`id` = `binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository` = `repositories`.`id`" . + mysql_join_build_assignments_architectures() . + mysql_join_build_assignments_package_sources() . + mysql_join_package_sources_upstream_repositories() . + mysql_join_upstream_repositories_git_repositories() . + mysql_join_build_assignments_binary_packages() . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . " WHERE `repositories`.`name`=\"build-list\"" . ") AS `ba_q`". " LEFT JOIN" . @@ -287,12 +287,12 @@ $result = mysql_run_query( "`dependent_bp`.`build_assignment`," . "COUNT(DISTINCT `dependency_bp`.`build_assignment`) AS `run_dependencies_pending`" . " FROM `binary_packages` AS `dependent_bp`" . - " JOIN `dependencies` ON `dependencies`.`dependent` = `dependent_bp`.`id`" . - " JOIN `dependency_types` ON `dependencies`.`dependency_type` = `dependency_types`.`id`" . - " JOIN `install_target_providers` ON `install_target_providers`.`install_target` = `dependencies`.`depending_on`" . - " JOIN `binary_packages` AS `dependency_bp` ON `dependency_bp`.`id` = `install_target_providers`.`package`" . - " JOIN `binary_packages_in_repositories` ON `dependency_bp`.`id` = `binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository` = `repositories`.`id`" . + mysql_join_binary_packages_dependencies('dependent_bp') . + mysql_join_dependencies_dependency_types() . + mysql_join_dependencies_install_target_providers() . + mysql_join_install_target_providers_binary_packages('','dependency_bp') . + mysql_join_binary_packages_binary_packages_in_repositories('dependency_bp') . + mysql_join_binary_packages_in_repositories_repositories() . " WHERE `dependency_bp`.`build_assignment` != `dependent_bp`.`build_assignment`" . " AND `dependency_types`.`relevant_for_building`" . " AND `dependency_types`.`relevant_for_binary_packages`" . @@ -305,13 +305,13 @@ $result = mysql_run_query( "`dependent_bp`.`build_assignment`," . "COUNT(DISTINCT `dependencies`.`id`) AS `make_dependencies_pending`" . " FROM `binary_packages` AS `dependent_bp`" . - " JOIN `dependencies` ON `dependencies`.`dependent` = `dependent_bp`.`id`" . - " JOIN `dependency_types` ON `dependencies`.`dependency_type` = `dependency_types`.`id`" . + mysql_join_binary_packages_dependencies('dependent_bp') . + mysql_join_dependencies_dependency_types() . " WHERE NOT EXISTS(" . "SELECT 1 FROM `install_target_providers`" . - " JOIN `binary_packages` AS `dependency_bp` ON `dependency_bp`.`id` = `install_target_providers`.`package`" . - " JOIN `binary_packages_in_repositories` ON `dependency_bp`.`id` = `binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository` = `repositories`.`id`" . + mysql_join_install_target_providers_binary_packages('','dependency_bp') . + mysql_join_binary_packages_binary_packages_in_repositories('dependency_bp','dependency_bpir') . + mysql_join_binary_packages_in_repositories_repositories('dependency_bpir') . " WHERE `install_target_providers`.`install_target` = `dependencies`.`depending_on`" . " AND `repositories`.`is_on_master_mirror`" . ")" . @@ -366,7 +366,7 @@ $result = mysql_run_query( " ON `cfb`.`build_assignment`=`rfb`.`build_assignment`" . " AND `cfb`.`reason`=`rfb`.`reason`" . " AND `cfb`.`max_date`=`rfb`.`date`" . - " JOIN `fail_reasons` ON `rfb`.`reason`=`fail_reasons`.`id`" . + mysql_join_failed_builds_fail_reasons('rfb') . " GROUP BY `rfb`.`build_assignment`" . ") AS `fr_q` ON `fr_q`.`build_assignment`=`ba_q`.`id`" . " LEFT JOIN" . diff --git a/buildmaster/build-slaves.php b/buildmaster/build-slaves.php index 56853e3..36a1522 100644 --- a/buildmaster/build-slaves.php +++ b/buildmaster/build-slaves.php @@ -107,20 +107,16 @@ $result = mysql_run_query( "SELECT " . implode(",",array_map("combine_fields",$columns)) . " FROM `build_slaves`" . - " JOIN `ssh_keys`" . - " ON `build_slaves`.`ssh_key`=`ssh_keys`.`id`" . - " JOIN `persons`" . - " ON `ssh_keys`.`owner`=`persons`.`id`" . + mysql_join_build_slaves_ssh_keys() . + mysql_join_ssh_keys_persons(). " LEFT JOIN (" . "SELECT " . "`build_assignments`.`id` AS `id`," . implode(",",array_filter(array_map("combine_ba_q_fields",$columns),"non_empty")) . " FROM `build_assignments`" . - " JOIN `package_sources`" . - " ON `build_assignments`.`package_source`=`package_sources`.`id`" . - " JOIN `architectures`" . - " ON `build_assignments`.`architecture`=`architectures`.`id`" . + mysql_join_build_assignments_package_sources() . + mysql_join_build_assignments_architectures() . ") AS `ba_q`" . " ON `ba_q`.`id`=`build_slaves`.`currently_building`" . diff --git a/buildmaster/deletion-links.php b/buildmaster/deletion-links.php index efa75db..066bf8d 100644 --- a/buildmaster/deletion-links.php +++ b/buildmaster/deletion-links.php @@ -74,8 +74,8 @@ mysql_run_query( ")" . ") AS `color`" . " FROM `binary_packages_in_repositories`" . - " JOIN `binary_packages` ON `binary_packages_in_repositories`.`package`=`binary_packages`.`id`" . - " JOIN `build_assignments` ON `binary_packages`.`build_assignment`=`build_assignments`.`id`" . + mysql_join_binary_packages_in_repositories_binary_packages() . + mysql_join_binary_packages_build_assignments() . $available_filter . " JOIN `available` ON `available`.`pkgname`=`binary_packages`.`pkgname`" . " WHERE `binary_packages_in_repositories`.`is_to_be_deleted`" . @@ -114,9 +114,9 @@ mysql_run_query( " `dependencies`.`dependency_type`" . " FROM `d_bpir`" . " JOIN `binary_packages_in_repositories` ON `d_bpir`.`id`=`binary_packages_in_repositories`.`id`" . - " JOIN `dependencies` ON `binary_packages_in_repositories`.`package`=`dependencies`.`dependent`" . - " JOIN `install_target_providers` ON `install_target_providers`.`install_target`=`dependencies`.`depending_on`" . - " JOIN `binary_packages_in_repositories` AS `itp_bpir` ON `itp_bpir`.`package`=`install_target_providers`.`package`" . + mysql_join_binary_packages_in_repositories_dependencies() . + mysql_join_dependencies_install_target_providers() . + mysql_join_install_target_providers_binary_packages_in_repositories('','itp_bpir') . " JOIN `d_bpir_copy` ON `itp_bpir`.`id`=`d_bpir_copy`.`id`" . " WHERE `dependencies`.`dependent`!=`install_target_providers`.`package`" ); @@ -174,9 +174,9 @@ $result = mysql_run_query( "`d_bpir`.`color`" . " FROM `d_bpir`" . " JOIN `binary_packages_in_repositories` ON `d_bpir`.`id`=`binary_packages_in_repositories`.`id`" . - " JOIN `binary_packages` ON `binary_packages`.`id`=`binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . - " JOIN `architectures` ON `repositories`.`architecture`=`architectures`.`id`" . + mysql_join_binary_packages_in_repositories_binary_packages() . + mysql_join_binary_packages_in_repositories_repositories() . + mysql_join_repositories_architectures() . " GROUP BY `d_bpir`.`group`" ); diff --git a/buildmaster/dependencies.php b/buildmaster/dependencies.php index fb168a1..1f6edb4 100644 --- a/buildmaster/dependencies.php +++ b/buildmaster/dependencies.php @@ -37,18 +37,18 @@ mysql_run_query( "INSERT IGNORE INTO `cons` (`dep`,`itp`)" . " SELECT `dependencies`.`id`,`install_target_providers`.`id`". " FROM `binary_packages`" . - " JOIN `binary_packages_in_repositories` ON `binary_packages`.`id`=`binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . - " JOIN `repository_stabilities` ON `repositories`.`stability`=`repository_stabilities`.`id`" . - " JOIN `architectures` ON `binary_packages`.`architecture`=`architectures`.`id`" . - " JOIN `build_assignments` ON `binary_packages`.`build_assignment`= `build_assignments`.`id`" . - " JOIN `package_sources` ON `build_assignments`.`package_source`= `package_sources`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . + mysql_join_repositories_repository_stabilities() . + mysql_join_binary_packages_architectures() . + mysql_join_binary_packages_build_assignments() . + mysql_join_build_assignments_package_sources() . $match . - " JOIN `dependencies` ON `dependencies`.`dependent`=`binary_packages`.`id`" . - " JOIN `dependency_types` ON `dependencies`.`dependency_type`=`dependency_types`.`id`" . - " JOIN `install_targets` ON `dependencies`.`depending_on`=`install_targets`.`id`" . + mysql_join_binary_packages_dependencies() . + mysql_join_dependencies_dependency_types() . + mysql_join_dependencies_install_targets() . $ignore_install_targets . - " JOIN `install_target_providers` ON `install_target_providers`.`install_target`=`dependencies`.`depending_on`" . + mysql_join_dependencies_install_target_providers() . " WHERE (`dependency_types`.`relevant_for_binary_packages` OR `repository_stabilities`.`name`=\"unbuilt\")" . " LIMIT " . $limit ); @@ -57,19 +57,19 @@ mysql_run_query( "INSERT IGNORE INTO `cons` (`dep`,`itp`)" . " SELECT `dependencies`.`id`,`install_target_providers`.`id`". " FROM `binary_packages`" . - " JOIN `binary_packages_in_repositories` ON `binary_packages`.`id`=`binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . - " JOIN `architectures` ON `binary_packages`.`architecture`=`architectures`.`id`" . - " JOIN `build_assignments` ON `binary_packages`.`build_assignment`= `build_assignments`.`id`" . - " JOIN `package_sources` ON `build_assignments`.`package_source`= `package_sources`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . + mysql_join_binary_packages_architectures() . + mysql_join_binary_packages_build_assignments() . + mysql_join_build_assignments_package_sources() . $match . - " JOIN `install_target_providers` ON `install_target_providers`.`package`=`binary_packages`.`id`" . - " JOIN `dependencies` ON `install_target_providers`.`install_target`=`dependencies`.`depending_on`" . - " JOIN `binary_packages` AS `d_bp` ON `dependencies`.`dependent`=`d_bp`.`id`" . - " JOIN `binary_packages_in_repositories` as `d_bpir` ON `d_bp`.`id`=`d_bpir`.`package`" . - " JOIN `repositories` AS `d_r` ON `d_bpir`.`repository`=`d_r`.`id`" . - " JOIN `repository_stabilities` AS `d_rs` ON `d_r`.`stability`=`d_rs`.`id`" . - " JOIN `dependency_types` ON `dependencies`.`dependency_type`=`dependency_types`.`id`" . + mysql_join_binary_packages_install_target_providers() . + mysql_join_install_target_providers_dependencies() . + mysql_join_dependencies_binary_packages('','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') . + mysql_join_repositories_repository_stabilities('d_r','d_rs') . + mysql_join_dependencies_dependency_types() . " WHERE (`dependency_types`.`relevant_for_binary_packages` OR `d_rs`.`name`=\"unbuilt\")" . " LIMIT " . $limit ); @@ -90,7 +90,7 @@ $result = mysql_run_query( "SELECT DISTINCT `dependencies`.`dependent`,`dependencies`.`depending_on`,`dependency_types`.`name`" . " FROM `cons`" . " JOIN `dependencies` ON `cons`.`dep`=`dependencies`.`id`" . - " JOIN `dependency_types` ON `dependencies`.`dependency_type`=`dependency_types`.`id`" + mysql_join_dependencies_dependency_types() ); while ($row = $result->fetch_assoc()) @@ -100,7 +100,7 @@ $result = mysql_run_query( "SELECT DISTINCT `install_targets`.`id`,`install_targets`.`name`" . " FROM `cons`" . " JOIN `dependencies` ON `cons`.`dep`=`dependencies`.`id`" . - " JOIN `install_targets` ON `dependencies`.`depending_on`=`install_targets`.`id`" + mysql_join_dependencies_install_targets() ); while ($row = $result->fetch_assoc()) @@ -124,11 +124,11 @@ $result = mysql_run_query( $pkgfile_query . " FROM `cons`" . " JOIN `dependencies` ON `cons`.`dep`=`dependencies`.`id`" . - " JOIN `binary_packages` ON `dependencies`.`dependent`=`binary_packages`.`id`" . - " JOIN `architectures` ON `architectures`.`id`=`binary_packages`.`architecture`" . - " JOIN `binary_packages_in_repositories` ON `binary_packages`.`id`=`binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . - " JOIN `repository_stabilities` ON `repository_stabilities`.`id`=`repositories`.`stability`" + mysql_join_dependencies_binary_packages() . + mysql_join_binary_packages_architectures() . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . + mysql_join_repositories_repository_stabilities() ); while ($row = $result->fetch_assoc()) @@ -141,11 +141,11 @@ $result = mysql_run_query( $pkgfile_query . " FROM `cons`" . " JOIN `install_target_providers` ON `cons`.`itp`=`install_target_providers`.`id`" . - " JOIN `binary_packages` ON `install_target_providers`.`package`=`binary_packages`.`id`" . - " JOIN `architectures` ON `architectures`.`id`=`binary_packages`.`architecture`" . - " JOIN `binary_packages_in_repositories` ON `binary_packages`.`id`=`binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . - " JOIN `repository_stabilities` ON `repository_stabilities`.`id`=`repositories`.`stability`" + mysql_join_install_target_providers_binary_packages() . + mysql_join_binary_packages_architectures() . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . + mysql_join_repositories_repository_stabilities() ); while ($row = $result->fetch_assoc()) diff --git a/buildmaster/gpg-keys.php b/buildmaster/gpg-keys.php index ae82a5d..db990c2 100644 --- a/buildmaster/gpg-keys.php +++ b/buildmaster/gpg-keys.php @@ -8,12 +8,9 @@ require_once BASE . "/lib/mysql.php"; "`persons`.`name` AS `person`," . "`gpg_keys`.`fingerprint`" . " FROM `email_actions`" . - " JOIN `allowed_email_actions` ON" . - " `email_actions`.`id`=`allowed_email_actions`.`action`" . - " RIGHT JOIN `gpg_keys` ON" . - " `allowed_email_actions`.`gpg_key`=`gpg_keys`.`id`" . - " JOIN `persons` ON" . - " `gpg_keys`.`owner`=`persons`.`id`" . + mysql_join_email_actions_allowed_email_actions() . + " RIGHT" . mysql_join_allowed_email_actions_gpg_keys() . + mysql_join_gpg_keys_persons() . " GROUP BY `gpg_keys`.`id`" . " ORDER BY `persons`.`name`" ); diff --git a/buildmaster/log.php b/buildmaster/log.php index 23bfc72..f6de94b 100644 --- a/buildmaster/log.php +++ b/buildmaster/log.php @@ -13,7 +13,7 @@ require_once BASE . "/lib/mysql.php"; "action" => "`ssh_log`.`action`", "parameters" => "`ssh_log`.`parameters`" ); - $join = " LEFT JOIN `build_slaves` ON `ssh_log`.`build_slave`=`build_slaves`.`id`"; + $join = " LEFT" . mysql_join_ssh_log_build_slaves(); if (isset($_GET["action"])) $filter .= " AND `ssh_log`.`action` LIKE from_base64(\"" . base64_encode($_GET["action"]) . "\")"; if (isset($_GET["slave"])) @@ -29,9 +29,10 @@ require_once BASE . "/lib/mysql.php"; "comment" => "`email_log`.`comment`" ); $join = - " LEFT JOIN `email_actions` ON `email_log`.`action`=`email_actions`.`id`" . - " LEFT JOIN (`gpg_keys`" . - " JOIN `persons` ON `gpg_keys`.`owner`=`persons`.`id`" . + " LEFT" . mysql_join_email_log_email_actions() . + " LEFT JOIN (" . + "`gpg_keys`" . + mysql_join_gpg_keys_persons() . ") ON `email_log`.`gpg_key`=`gpg_keys`.`id`"; } diff --git a/buildmaster/mysql-issues.php b/buildmaster/mysql-issues.php index b149cad..19ef55d 100644 --- a/buildmaster/mysql-issues.php +++ b/buildmaster/mysql-issues.php @@ -25,19 +25,19 @@ require_once BASE . "/lib/mysql.php"; "`subst_r`.`name` AS `subst_repository`," . "`subst_buildlist_bp`.`id` AS `subst_buildlist`" . " FROM `binary_packages`" . - " JOIN `binary_packages_in_repositories` ON `binary_packages`.`id`=`binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . " AND `repositories`.`is_on_master_mirror`" . - " JOIN `architectures` AS `r_a` ON `repositories`.`architecture`=`r_a`.`id`" . - " JOIN `dependencies` ON `dependencies`.`dependent`=`binary_packages`.`id`" . - " JOIN `dependency_types` ON `dependencies`.`dependency_type`=`dependency_types`.`id`" . + mysql_join_repositories_architectures('','r_a') . + mysql_join_binary_packages_dependencies() . + mysql_join_dependencies_dependency_types() . " AND `dependency_types`.`relevant_for_binary_packages`" . - " JOIN `install_targets` ON `dependencies`.`depending_on`=`install_targets`.`id`" . - " JOIN `architectures` ON `binary_packages`.`architecture`=`architectures`.`id`" . + mysql_join_dependencies_install_targets() . + mysql_join_binary_packages_architectures() . " LEFT JOIN (" . "`binary_packages` AS `subst_bp`" . - " JOIN `binary_packages_in_repositories` as `subst_bpir` ON `subst_bp`.`id`=`subst_bpir`.`package`" . - " JOIN `repositories` AS `subst_r` ON `subst_bpir`.`repository`=`subst_r`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories('subst_bp','subst_bpir') . + mysql_join_binary_packages_in_repositories_repositories('subst_bpir','subst_r') . " JOIN `repository_stability_relations` ON `repository_stability_relations`.`less_stable`=`subst_r`.`stability`" . ")" . " ON `subst_bp`.`pkgname`=`binary_packages`.`pkgname`" . @@ -46,15 +46,15 @@ require_once BASE . "/lib/mysql.php"; " AND `subst_r`.`architecture`=`repositories`.`architecture`" . " LEFT JOIN (" . "`binary_packages` AS `subst_buildlist_bp`" . - " JOIN `binary_packages_in_repositories` AS `subst_buildlist_bpir` ON `subst_buildlist_bp`.`id`=`subst_buildlist_bpir`.`package`" . - " JOIN `repositories` AS `subst_buildlist_r` ON `subst_buildlist_bpir`.`repository`=`subst_buildlist_r`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories('subst_buildlist_bp','subst_buildlist_bpir') . + mysql_join_binary_packages_in_repositories_repositories('subst_buildlist_bpir','subst_buildlist_r') . " AND `subst_buildlist_r`.`name`=\"build-list\"". ") ON `subst_buildlist_bp`.`pkgname`=`binary_packages`.`pkgname`" . " AND `subst_bp`.`architecture`=`binary_packages`.`architecture`" . " WHERE NOT EXISTS (" . "SELECT 1 FROM `install_target_providers`" . - " JOIN `binary_packages_in_repositories` AS `i_bpir` ON `i_bpir`.`package`=`install_target_providers`.`package`" . - " JOIN `repositories` AS `i_r` ON `i_bpir`.`repository`=`i_r`.`id`" . + mysql_join_install_target_providers_binary_packages_in_repositories('','i_bpir') . + mysql_join_binary_packages_in_repositories_repositories('i_bpir','i_r') . " JOIN `architecture_compatibilities` ON `architecture_compatibilities`.`fully_compatible`" . " AND `architecture_compatibilities`.`built_for`=`i_r`.`architecture`" . " WHERE `install_target_providers`.`install_target`=`dependencies`.`depending_on`" . @@ -86,20 +86,20 @@ require_once BASE . "/lib/mysql.php"; "`repository_stabilities`.`name` AS `stability`," . "IF(`binary_packages_in_repositories`.`is_to_be_deleted`,1,0) AS `is_to_be_deleted`" . " FROM `binary_packages`" . - " JOIN `binary_packages_in_repositories` ON `binary_packages`.`id`=`binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . " AND `repositories`.`is_on_master_mirror`" . - " JOIN `architectures` AS `r_a` ON `repositories`.`architecture`=`r_a`.`id`" . - " JOIN `repository_stabilities` ON `repositories`.`stability`=`repository_stabilities`.`id`" . - " JOIN `dependencies` ON `dependencies`.`dependent`=`binary_packages`.`id`" . - " JOIN `dependency_types` ON `dependencies`.`dependency_type`=`dependency_types`.`id`" . + mysql_join_repositories_architectures('','r_a') . + mysql_join_repositories_repository_stabilities() . + mysql_join_binary_packages_dependencies() . + mysql_join_dependencies_dependency_types() . " AND `dependency_types`.`relevant_for_binary_packages`" . - " JOIN `install_targets` ON `dependencies`.`depending_on`=`install_targets`.`id`" . - " JOIN `architectures` ON `binary_packages`.`architecture`=`architectures`.`id`" . + mysql_join_dependencies_install_targets() . + mysql_join_binary_packages_architectures() . " WHERE EXISTS (" . "SELECT 1 FROM `install_target_providers`" . - " JOIN `binary_packages_in_repositories` AS `prov_bpir` ON `prov_bpir`.`package`=`install_target_providers`.`package`" . - " JOIN `repositories` AS `prov_r` ON `prov_r`.`id`=`prov_bpir`.`repository`" . + mysql_join_install_target_providers_binary_packages_in_repositories('','prov_bpir') . + mysql_join_binary_packages_in_repositories_repositories('prov_bpir','prov_r') . " JOIN `architecture_compatibilities` ON `architecture_compatibilities`.`built_for`=`prov_r`.`architecture`" . " AND `architecture_compatibilities`.`fully_compatible`" . " WHERE `install_target_providers`.`install_target` = `dependencies`.`depending_on`" . @@ -107,17 +107,17 @@ require_once BASE . "/lib/mysql.php"; ")" . " AND NOT EXISTS (" . "SELECT 1 FROM `install_target_providers`" . - " JOIN `binary_packages` AS `prov_bp` ON `prov_bp`.`id`=`install_target_providers`.`package`" . - " JOIN `binary_packages_in_repositories` AS `prov_bpir` ON `prov_bp`.`id`=`prov_bpir`.`package`" . - " JOIN `repositories` AS `prov_r` ON `prov_bpir`.`repository`=`prov_r`.`id`" . + mysql_join_install_target_providers_binary_packages('','prov_bp') . + mysql_join_binary_packages_binary_packages_in_repositories('prov_bp','prov_bpir') . + mysql_join_binary_packages_in_repositories_repositories('prov_bpir','prov_r') . " JOIN `repository_stability_relations` ON `prov_r`.`stability`=`repository_stability_relations`.`more_stable`" . " WHERE `install_target_providers`.`install_target` = `dependencies`.`depending_on`" . " AND `repositories`.`stability`=`repository_stability_relations`.`less_stable`" . " AND `repositories`.`architecture`=`prov_r`.`architecture`" . " AND NOT EXISTS (" . "SELECT 1 FROM `binary_packages` AS `sup_bp`" . - " JOIN `binary_packages_in_repositories` AS `sup_bpir` ON `sup_bp`.`id`=`sup_bpir`.`package`" . - " JOIN `repositories` AS `sup_r` ON `sup_bpir`.`repository`=`sup_r`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories('sup_bp','sup_bpir') . + mysql_join_binary_packages_in_repositories_repositories('sup_bpir','sup_r') . " JOIN `repository_stability_relations` AS `sup_rra` ON `sup_r`.`stability`=`sup_rra`.`more_stable`" . " JOIN `repository_stability_relations` AS `sup_rrb` ON `sup_r`.`stability`=`sup_rrb`.`less_stable`" . " WHERE `sup_bp`.`pkgname` = `prov_bp`.`pkgname`" . diff --git a/buildmaster/status.php b/buildmaster/status.php index 3776d81..05a4455 100644 --- a/buildmaster/status.php +++ b/buildmaster/status.php @@ -27,8 +27,8 @@ if ($result -> num_rows > 0) { $result = mysql_run_query( "SELECT MAX(`binary_packages_in_repositories`.`last_moved`) AS `last_moved`" . " FROM `binary_packages`" . - " JOIN `binary_packages_in_repositories` ON `binary_packages_in_repositories`.`package`=`binary_packages`.`id`" . - " JOIN `build_assignments` ON `binary_packages`.`build_assignment`=`build_assignments`.`id`" . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_build_assignments() . " WHERE `binary_packages_in_repositories`.`last_moved`>`build_assignments`.`return_date`" ); @@ -47,12 +47,9 @@ $age_queries = array( "SELECT " . "`build_assignments`.`package_source`" . " FROM `build_assignments`" . - " JOIN `binary_packages`" . - " ON `binary_packages`.`build_assignment`=`build_assignments`.`id`" . - " JOIN `binary_packages_in_repositories`" . - " ON `binary_packages_in_repositories`.`package`=`binary_packages`.`id`" . - " JOIN `repositories`" . - " ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . + mysql_join_build_assignments_binary_packages() . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . " WHERE `repositories`.`name`=\"build-list\"" . " AND `build_assignments`.`is_blocked` IS NULL" . " GROUP BY `build_assignments`.`package_source`" . @@ -69,10 +66,8 @@ $age_queries = array( "`binary_packages_in_repositories`.`package`," . "MIN(`binary_packages_in_repositories`.`last_moved`) AS `first_last_moved`" . " FROM `binary_packages_in_repositories`" . - " JOIN `repositories`" . - " ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . - " JOIN `repository_stabilities`" . - " ON `repositories`.`stability`=`repository_stabilities`.`id`" . + mysql_join_binary_packages_in_repositories_repositories() . + mysql_join_repositories_repository_stabilities() . " WHERE `repository_stabilities`.`name`=\"staging\"" . " GROUP BY `binary_packages_in_repositories`.`package`" . ") AS `binary_packages_in_repositories`" . @@ -88,10 +83,8 @@ $age_queries = array( "`binary_packages_in_repositories`.`package`," . "MIN(`binary_packages_in_repositories`.`last_moved`) AS `first_last_moved`" . " FROM `binary_packages_in_repositories`" . - " JOIN `repositories`" . - " ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . - " JOIN `repository_stabilities`" . - " ON `repositories`.`stability`=`repository_stabilities`.`id`" . + mysql_join_binary_packages_in_repositories_repositories() . + mysql_join_repositories_repository_stabilities() . " WHERE `repository_stabilities`.`name`=\"testing\"" . " GROUP BY `binary_packages_in_repositories`.`package`" . ") AS `binary_packages_in_repositories`" . @@ -109,10 +102,8 @@ $age_queries = array( "`binary_packages_in_repositories`.`package`," . "MIN(`binary_packages_in_repositories`.`last_moved`) AS `first_last_moved`" . " FROM `binary_packages_in_repositories`" . - " JOIN `repositories`" . - " ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . - " JOIN `repository_stabilities`" . - " ON `repositories`.`stability`=`repository_stabilities`.`id`" . + mysql_join_binary_packages_in_repositories_repositories() . + mysql_join_repositories_repository_stabilities() . " WHERE `repository_stabilities`.`name`=\"testing\"" . " GROUP BY `binary_packages_in_repositories`.`package`" . ") AS `binary_packages_in_repositories`" . diff --git a/buildmaster/to-delete.php b/buildmaster/to-delete.php index 6c5e547..df11750 100644 --- a/buildmaster/to-delete.php +++ b/buildmaster/to-delete.php @@ -10,11 +10,11 @@ require_once BASE . "/lib/mysql.php"; "`binary_packages`.`pkgver`," . "`binary_packages`.`pkgrel`," . "`binary_packages`.`sub_pkgrel`," . - "`architectures`.`name` AS `arch` " . - "FROM `binary_packages` " . - "JOIN `architectures` ON `binary_packages`.`architecture`=`architectures`.`id` " . - " JOIN `binary_packages_in_repositories` ON `binary_packages`.`id`=`binary_packages_in_repositories`.`package`" . - " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" . + "`architectures`.`name` AS `arch`" . + " FROM `binary_packages`" . + mysql_join_binary_packages_architectures() . + mysql_join_binary_packages_binary_packages_in_repositories() . + mysql_join_binary_packages_in_repositories_repositories() . "WHERE `binary_packages_in_repositories`.`is_to_be_deleted` " . "AND `repositories`.`is_on_master_mirror`" ); |