Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-11-09 10:50:09 +0100
committerErich Eckner <git@eckner.net>2018-11-09 10:50:09 +0100
commitf89a3fd4c3577eba5a9e3f1c1d27c26fb8432f7b (patch)
treea7720fef45dd700374cda0843ed2d2354ac5bc28
parent1a9e9dc143b73b29113c5d22c0812f25c43cd34a (diff)
lib/mysql-joins.php new: it contains mysql_join_* functions similar to the ones in lib/mysql-functions of the build scripts
-rw-r--r--buildmaster/blacklist.php4
-rw-r--r--buildmaster/build-list-links.php18
-rw-r--r--buildmaster/build-list.php38
-rw-r--r--buildmaster/build-slaves.php12
-rw-r--r--buildmaster/deletion-links.php16
-rw-r--r--buildmaster/dependencies.php68
-rw-r--r--buildmaster/gpg-keys.php9
-rw-r--r--buildmaster/log.php9
-rw-r--r--buildmaster/mysql-issues.php56
-rw-r--r--buildmaster/status.php31
-rw-r--r--buildmaster/to-delete.php10
-rw-r--r--lib/mysql-joins.php1438
-rw-r--r--lib/mysql.php1
-rw-r--r--packages/index.php20
-rw-r--r--packages/pkginfo.php64
15 files changed, 1609 insertions, 185 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`"
);
diff --git a/lib/mysql-joins.php b/lib/mysql-joins.php
new file mode 100644
index 0000000..751f1a0
--- /dev/null
+++ b/lib/mysql-joins.php
@@ -0,0 +1,1438 @@
+<?php
+
+/**
+ * generate below content with
+ * php mysql-joins.php
+ * executed from the builder directory
+ **/
+
+if (!isset($_SERVER["SERVER_ADDR"])) {
+ foreach (array('.', '../builder', '../../builder') as $base_dir)
+ if (file_exists($base_dir . '/lib/mysql-functions')) {
+ putenv('base_dir=' . $base_dir);
+ break;
+ }
+ $new_output =
+ "\n" .
+ trim(
+ shell_exec(
+ '. ${base_dir}/lib/mysql-functions;' .
+ 'declare -f $(' .
+ 'declare -F | cut -d" " -f3 | grep "^mysql_join_[a-z]" | grep -v "with_version"' .
+ ')'
+ )
+ );
+ $output = "";
+ $i = 5;
+ while ((strcmp($new_output,$output)!=0) && ($i > 0)) {
+ $output = $new_output;
+ $new_output =
+ preg_replace(
+ array(
+ '/ \[ -n "([^"]+)" \]; then/',
+ '/(\n\s*printf '."'[^'%]*)%s([^']*'".') "(\$[0-9]+)"/',
+ '/(\n\s*if [^\n]*)(\n([^\n]*;\n)+\s*)(else)(\n([^\n]*;\n)+\s*)fi;?\n/',
+ '/(\n\s*if [^\n]*)(\n([^\n]*;\n)+\s*)fi;?\n/'
+ ),
+ array(
+ ' (!empty(\1))',
+ '\1'."'".'.\3.'."'".'\2',
+ '\1 {\2} \4 {\5}'."\n",
+ '\1 {\2}'."\n"
+ ),
+ $output
+ );
+ $i--;
+ }
+ $output =
+ preg_replace(
+ array(
+ '/\$1/',
+ '/\$2/',
+ '/(\n)(\S+) \(\)\s*\n{/',
+ '/(\n})/',
+ '/(\s)printf(\s)/'
+ ),
+ array(
+ '$table_left',
+ '$table_right',
+ '\1function \2 ($table_left="", $table_right="") {'."\n".' $result = "";',
+ "\n".' return $result;\1',
+ '\1$result .=\2'
+ ),
+ $output
+ );
+ print $output . "\n";
+ die();
+}
+
+// auto-generated content below
+
+function mysql_join_allowed_email_actions_email_actions ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `email_actions`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`action`=';
+ } else {
+ $result .= ' ON `allowed_email_actions`.`action`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`email_actions`.`id`';
+ }
+ return $result;
+}
+function mysql_join_allowed_email_actions_gpg_keys ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `gpg_keys`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`gpg_key`=';
+ } else {
+ $result .= ' ON `allowed_email_actions`.`gpg_key`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`gpg_keys`.`id`';
+ }
+ return $result;
+}
+function mysql_join_architectures_binary_packages ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `architectures`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`architecture`';
+ } else {
+ $result .= '`binary_packages`.`architecture`';
+ }
+ return $result;
+}
+function mysql_join_architectures_build_assignments ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_assignments`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `architectures`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`architecture`';
+ } else {
+ $result .= '`build_assignments`.`architecture`';
+ }
+ return $result;
+}
+function mysql_join_architectures_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `architectures`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`architecture`';
+ } else {
+ $result .= '`repositories`.`architecture`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_architectures ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `architectures`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`architecture`=';
+ } else {
+ $result .= ' ON `binary_packages`.`architecture`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`architectures`.`id`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_binary_packages_in_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages_in_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `binary_packages`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`package`';
+ } else {
+ $result .= '`binary_packages_in_repositories`.`package`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_build_assignments ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_assignments`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_assignment`=';
+ } else {
+ $result .= ' ON `binary_packages`.`build_assignment`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`build_assignments`.`id`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_build_dependency_loops ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_dependency_loops`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_assignment`=';
+ } else {
+ $result .= ' ON `binary_packages`.`build_assignment`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_assignment`';
+ } else {
+ $result .= '`build_dependency_loops`.`build_assignment`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_build_slaves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_slaves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_assignment`=';
+ } else {
+ $result .= ' ON `binary_packages`.`build_assignment`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`currently_building`';
+ } else {
+ $result .= '`build_slaves`.`currently_building`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_dependencies ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependencies`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `binary_packages`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`dependent`';
+ } else {
+ $result .= '`dependencies`.`dependent`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_in_repositories_binary_packages ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`package`=';
+ } else {
+ $result .= ' ON `binary_packages_in_repositories`.`package`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`binary_packages`.`id`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_in_repositories_dependencies ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependencies`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`package`=';
+ } else {
+ $result .= ' ON `binary_packages_in_repositories`.`package`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`dependent`';
+ } else {
+ $result .= '`dependencies`.`dependent`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_in_repositories_install_target_providers ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_target_providers`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`package`=';
+ } else {
+ $result .= ' ON `binary_packages_in_repositories`.`package`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`package`';
+ } else {
+ $result .= '`install_target_providers`.`package`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_in_repositories_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`repository`=';
+ } else {
+ $result .= ' ON `binary_packages_in_repositories`.`repository`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`repositories`.`id`';
+ }
+ return $result;
+}
+function mysql_join_binary_packages_install_target_providers ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_target_providers`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `binary_packages`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`package`';
+ } else {
+ $result .= '`install_target_providers`.`package`';
+ }
+ return $result;
+}
+function mysql_join_build_assignments_architectures ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `architectures`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`architecture`=';
+ } else {
+ $result .= ' ON `build_assignments`.`architecture`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`architectures`.`id`';
+ }
+ return $result;
+}
+function mysql_join_build_assignments_binary_packages ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `build_assignments`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_assignment`';
+ } else {
+ $result .= '`binary_packages`.`build_assignment`';
+ }
+ return $result;
+}
+function mysql_join_build_assignments_build_dependency_loops ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_dependency_loops`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `build_assignments`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_assignment`';
+ } else {
+ $result .= '`build_dependency_loops`.`build_assignment`';
+ }
+ return $result;
+}
+function mysql_join_build_assignments_build_slaves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_slaves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `build_assignments`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`currently_building`';
+ } else {
+ $result .= '`build_slaves`.`currently_building`';
+ }
+ return $result;
+}
+function mysql_join_build_assignments_failed_builds ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `failed_builds`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `build_assignments`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_assignment`';
+ } else {
+ $result .= '`failed_builds`.`build_assignment`';
+ }
+ return $result;
+}
+function mysql_join_build_assignments_package_sources ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `package_sources`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`package_source`=';
+ } else {
+ $result .= ' ON `build_assignments`.`package_source`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`package_sources`.`id`';
+ }
+ return $result;
+}
+function mysql_join_build_dependency_loops_binary_packages ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_assignment`=';
+ } else {
+ $result .= ' ON `build_dependency_loops`.`build_assignment`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_assignment`';
+ } else {
+ $result .= '`binary_packages`.`build_assignment`';
+ }
+ return $result;
+}
+function mysql_join_build_dependency_loops_build_assignments ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_assignments`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_assignment`=';
+ } else {
+ $result .= ' ON `build_dependency_loops`.`build_assignment`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`build_assignments`.`id`';
+ }
+ return $result;
+}
+function mysql_join_build_slaves_binary_packages ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`currently_building`=';
+ } else {
+ $result .= ' ON `build_slaves`.`currently_building`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_assignment`';
+ } else {
+ $result .= '`binary_packages`.`build_assignment`';
+ }
+ return $result;
+}
+function mysql_join_build_slaves_build_assignments ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_assignments`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`currently_building`=';
+ } else {
+ $result .= ' ON `build_slaves`.`currently_building`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`build_assignments`.`id`';
+ }
+ return $result;
+}
+function mysql_join_build_slaves_failed_builds ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `failed_builds`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `build_slaves`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_slave`';
+ } else {
+ $result .= '`failed_builds`.`build_slave`';
+ }
+ return $result;
+}
+function mysql_join_build_slaves_ssh_keys ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `ssh_keys`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`ssh_key`=';
+ } else {
+ $result .= ' ON `build_slaves`.`ssh_key`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`ssh_keys`.`id`';
+ }
+ return $result;
+}
+function mysql_join_build_slaves_ssh_log ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `ssh_log`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `build_slaves`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`build_slave`';
+ } else {
+ $result .= '`ssh_log`.`build_slave`';
+ }
+ return $result;
+}
+function mysql_join_dependencies_binary_packages ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`dependent`=';
+ } else {
+ $result .= ' ON `dependencies`.`dependent`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`binary_packages`.`id`';
+ }
+ return $result;
+}
+function mysql_join_dependencies_binary_packages_in_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages_in_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`dependent`=';
+ } else {
+ $result .= ' ON `dependencies`.`dependent`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`package`';
+ } else {
+ $result .= '`binary_packages_in_repositories`.`package`';
+ }
+ return $result;
+}
+function mysql_join_dependencies_dependency_types ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependency_types`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`dependency_type`=';
+ } else {
+ $result .= ' ON `dependencies`.`dependency_type`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`dependency_types`.`id`';
+ }
+ return $result;
+}
+function mysql_join_dependencies_install_target_providers ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_target_providers`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`depending_on`=';
+ } else {
+ $result .= ' ON `dependencies`.`depending_on`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`install_target`';
+ } else {
+ $result .= '`install_target_providers`.`install_target`';
+ }
+ return $result;
+}
+function mysql_join_dependencies_install_targets ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_targets`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`depending_on`=';
+ } else {
+ $result .= ' ON `dependencies`.`depending_on`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`install_targets`.`id`';
+ }
+ return $result;
+}
+function mysql_join_dependencies_versions ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `versions`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`version`=';
+ } else {
+ $result .= ' ON `dependencies`.`version`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`versions`.`id`';
+ }
+ return $result;
+}
+function mysql_join_dependency_types_dependencies ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependencies`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `dependency_types`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`dependency_type`';
+ } else {
+ $result .= '`dependencies`.`dependency_type`';
+ }
+ return $result;
+}
+function mysql_join_email_actions_allowed_email_actions ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `allowed_email_actions`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `email_actions`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`action`';
+ } else {
+ $result .= '`allowed_email_actions`.`action`';
+ }
+ return $result;
+}
+function mysql_join_email_actions_email_log ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `email_log`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `email_actions`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`action`';
+ } else {
+ $result .= '`email_log`.`action`';
+ }
+ return $result;
+}
+function mysql_join_email_log_email_actions ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `email_actions`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`action`=';
+ } else {
+ $result .= ' ON `email_log`.`action`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`email_actions`.`id`';
+ }
+ return $result;
+}
+function mysql_join_email_log_gpg_keys ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `gpg_keys`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`gpg_key`=';
+ } else {
+ $result .= ' ON `email_log`.`gpg_key`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`gpg_keys`.`id`';
+ }
+ return $result;
+}
+function mysql_join_fail_reasons_failed_builds ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `failed_builds`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `fail_reasons`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`reason`';
+ } else {
+ $result .= '`failed_builds`.`reason`';
+ }
+ return $result;
+}
+function mysql_join_failed_builds_build_assignments ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_assignments`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_assignment`=';
+ } else {
+ $result .= ' ON `failed_builds`.`build_assignment`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`build_assignments`.`id`';
+ }
+ return $result;
+}
+function mysql_join_failed_builds_build_slaves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_slaves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_slave`=';
+ } else {
+ $result .= ' ON `failed_builds`.`build_slave`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`build_slaves`.`id`';
+ }
+ return $result;
+}
+function mysql_join_failed_builds_fail_reasons ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `fail_reasons`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`reason`=';
+ } else {
+ $result .= ' ON `failed_builds`.`reason`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`fail_reasons`.`id`';
+ }
+ return $result;
+}
+function mysql_join_git_repositories_upstream_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `upstream_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `git_repositories`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`git_repository`';
+ } else {
+ $result .= '`upstream_repositories`.`git_repository`';
+ }
+ return $result;
+}
+function mysql_join_gpg_keys_allowed_email_actions ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `allowed_email_actions`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `gpg_keys`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`gpg_key`';
+ } else {
+ $result .= '`allowed_email_actions`.`gpg_key`';
+ }
+ return $result;
+}
+function mysql_join_gpg_keys_email_log ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `email_log`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `gpg_keys`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`gpg_key`';
+ } else {
+ $result .= '`email_log`.`gpg_key`';
+ }
+ return $result;
+}
+function mysql_join_gpg_keys_persons ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `persons`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`owner`=';
+ } else {
+ $result .= ' ON `gpg_keys`.`owner`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`persons`.`id`';
+ }
+ return $result;
+}
+function mysql_join_install_target_providers_binary_packages ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`package`=';
+ } else {
+ $result .= ' ON `install_target_providers`.`package`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`binary_packages`.`id`';
+ }
+ return $result;
+}
+function mysql_join_install_target_providers_binary_packages_in_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages_in_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`package`=';
+ } else {
+ $result .= ' ON `install_target_providers`.`package`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`package`';
+ } else {
+ $result .= '`binary_packages_in_repositories`.`package`';
+ }
+ return $result;
+}
+function mysql_join_install_target_providers_dependencies ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependencies`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`install_target`=';
+ } else {
+ $result .= ' ON `install_target_providers`.`install_target`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`depending_on`';
+ } else {
+ $result .= '`dependencies`.`depending_on`';
+ }
+ return $result;
+}
+function mysql_join_install_target_providers_install_targets ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_targets`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`install_target`=';
+ } else {
+ $result .= ' ON `install_target_providers`.`install_target`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`install_targets`.`id`';
+ }
+ return $result;
+}
+function mysql_join_install_target_providers_versions ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `versions`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`version`=';
+ } else {
+ $result .= ' ON `install_target_providers`.`version`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`versions`.`id`';
+ }
+ return $result;
+}
+function mysql_join_install_targets_dependencies ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependencies`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `install_targets`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`depending_on`';
+ } else {
+ $result .= '`dependencies`.`depending_on`';
+ }
+ return $result;
+}
+function mysql_join_install_targets_install_target_providers ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_target_providers`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `install_targets`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`install_target`';
+ } else {
+ $result .= '`install_target_providers`.`install_target`';
+ }
+ return $result;
+}
+function mysql_join_package_sources_build_assignments ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_assignments`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `package_sources`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`package_source`';
+ } else {
+ $result .= '`build_assignments`.`package_source`';
+ }
+ return $result;
+}
+function mysql_join_package_sources_repository_moves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `repository_moves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`upstream_package_repository`=';
+ } else {
+ $result .= ' ON `package_sources`.`upstream_package_repository`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`upstream_package_repository`';
+ } else {
+ $result .= '`repository_moves`.`upstream_package_repository`';
+ }
+ return $result;
+}
+function mysql_join_package_sources_toolchain_order ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `toolchain_order`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`pkgbase`=';
+ } else {
+ $result .= ' ON `package_sources`.`pkgbase`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`pkgbase`';
+ } else {
+ $result .= '`toolchain_order`.`pkgbase`';
+ }
+ return $result;
+}
+function mysql_join_package_sources_upstream_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `upstream_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`upstream_package_repository`=';
+ } else {
+ $result .= ' ON `package_sources`.`upstream_package_repository`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`upstream_repositories`.`id`';
+ }
+ return $result;
+}
+function mysql_join_persons_gpg_keys ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `gpg_keys`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `persons`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`owner`';
+ } else {
+ $result .= '`gpg_keys`.`owner`';
+ }
+ return $result;
+}
+function mysql_join_persons_ssh_keys ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `ssh_keys`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `persons`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`owner`';
+ } else {
+ $result .= '`ssh_keys`.`owner`';
+ }
+ return $result;
+}
+function mysql_join_repositories_architectures ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `architectures`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`architecture`=';
+ } else {
+ $result .= ' ON `repositories`.`architecture`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`architectures`.`id`';
+ }
+ return $result;
+}
+function mysql_join_repositories_binary_packages_in_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `binary_packages_in_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `repositories`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`repository`';
+ } else {
+ $result .= '`binary_packages_in_repositories`.`repository`';
+ }
+ return $result;
+}
+function mysql_join_repositories_repository_stabilities ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `repository_stabilities`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`stability`=';
+ } else {
+ $result .= ' ON `repositories`.`stability`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`repository_stabilities`.`id`';
+ }
+ return $result;
+}
+function mysql_join_repository_moves_package_sources ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `package_sources`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`upstream_package_repository`=';
+ } else {
+ $result .= ' ON `repository_moves`.`upstream_package_repository`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`upstream_package_repository`';
+ } else {
+ $result .= '`package_sources`.`upstream_package_repository`';
+ }
+ return $result;
+}
+function mysql_join_repository_moves_upstream_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `upstream_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`upstream_package_repository`=';
+ } else {
+ $result .= ' ON `repository_moves`.`upstream_package_repository`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`upstream_repositories`.`id`';
+ }
+ return $result;
+}
+function mysql_join_repository_stabilities_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `repository_stabilities`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`stability`';
+ } else {
+ $result .= '`repositories`.`stability`';
+ }
+ return $result;
+}
+function mysql_join_ssh_keys_build_slaves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_slaves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `ssh_keys`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`ssh_key`';
+ } else {
+ $result .= '`build_slaves`.`ssh_key`';
+ }
+ return $result;
+}
+function mysql_join_ssh_keys_persons ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `persons`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`owner`=';
+ } else {
+ $result .= ' ON `ssh_keys`.`owner`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`persons`.`id`';
+ }
+ return $result;
+}
+function mysql_join_ssh_log_build_slaves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `build_slaves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`build_slave`=';
+ } else {
+ $result .= ' ON `ssh_log`.`build_slave`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`build_slaves`.`id`';
+ }
+ return $result;
+}
+function mysql_join_toolchain_order_package_sources ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `package_sources`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`pkgbase`=';
+ } else {
+ $result .= ' ON `toolchain_order`.`pkgbase`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`pkgbase`';
+ } else {
+ $result .= '`package_sources`.`pkgbase`';
+ }
+ return $result;
+}
+function mysql_join_upstream_repositories_git_repositories ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `git_repositories`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`git_repository`=';
+ } else {
+ $result .= ' ON `upstream_repositories`.`git_repository`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`id`';
+ } else {
+ $result .= '`git_repositories`.`id`';
+ }
+ return $result;
+}
+function mysql_join_upstream_repositories_package_sources ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `package_sources`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `upstream_repositories`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`upstream_package_repository`';
+ } else {
+ $result .= '`package_sources`.`upstream_package_repository`';
+ }
+ return $result;
+}
+function mysql_join_upstream_repositories_repository_moves ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `repository_moves`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `upstream_repositories`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`upstream_package_repository`';
+ } else {
+ $result .= '`repository_moves`.`upstream_package_repository`';
+ }
+ return $result;
+}
+function mysql_join_versions_dependencies ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `dependencies`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `versions`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`version`';
+ } else {
+ $result .= '`dependencies`.`version`';
+ }
+ return $result;
+}
+function mysql_join_versions_install_target_providers ($table_left="", $table_right="") {
+ $result = "";
+ $result .= ' JOIN `install_target_providers`';
+ if (!empty($table_right)) {
+ $result .= ' AS `'.$table_right.'`';
+ }
+ if (!empty($table_left)) {
+ $result .= ' ON `'.$table_left.'`.`id`=';
+ } else {
+ $result .= ' ON `versions`.`id`=';
+ }
+ if (!empty($table_right)) {
+ $result .= '`'.$table_right.'`.`version`';
+ } else {
+ $result .= '`install_target_providers`.`version`';
+ }
+ return $result;
+}
diff --git a/lib/mysql.php b/lib/mysql.php
index 8255b33..ec0a1ba 100644
--- a/lib/mysql.php
+++ b/lib/mysql.php
@@ -6,6 +6,7 @@ if (isset($mysql))
require_once "../init.php";
include_once BASE . "/lib/http.php";
+include_once BASE . "/lib/mysql-joins.php";
$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster");
if ( $mysql -> connect_error ) {
diff --git a/packages/index.php b/packages/index.php
index a99744c..bb0aa94 100644
--- a/packages/index.php
+++ b/packages/index.php
@@ -109,12 +109,12 @@ require_once BASE . "/lib/format.php";
}
$query = " FROM `binary_packages`" .
- " 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`" .
+ mysql_join_binary_packages_architectures() .
+ mysql_join_binary_packages_binary_packages_in_repositories() .
+ mysql_join_binary_packages_in_repositories_repositories() .
" AND `repositories`.`is_on_master_mirror`" .
- " JOIN `build_assignments` ON `build_assignments`.`id`=`binary_packages`.`build_assignment`" .
- " JOIN `package_sources` ON `package_sources`.`id`=`build_assignments`.`package_source`" .
+ mysql_join_binary_packages_build_assignments() .
+ mysql_join_build_assignments_package_sources() .
$filter . $exact_filter .
" ORDER BY ";
@@ -187,12 +187,12 @@ require_once BASE . "/lib/format.php";
);
$query = " FROM `binary_packages`" .
- " 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`" .
+ mysql_join_binary_packages_architectures() .
+ mysql_join_binary_packages_binary_packages_in_repositories() .
+ mysql_join_binary_packages_in_repositories_repositories() .
" AND `repositories`.`is_on_master_mirror`" .
- " JOIN `build_assignments` ON `build_assignments`.`id`=`binary_packages`.`build_assignment`" .
- " JOIN `package_sources` ON `package_sources`.`id`=`build_assignments`.`package_source`" .
+ mysql_join_binary_packages_build_assignments() .
+ mysql_join_build_assignments_package_sources() .
$filter . $fuzzy_filter .
" ORDER BY ";
diff --git a/packages/pkginfo.php b/packages/pkginfo.php
index a20df02..882c766 100644
--- a/packages/pkginfo.php
+++ b/packages/pkginfo.php
@@ -46,15 +46,15 @@ require_once BASE . "/lib/style.php";
"MAX(`binary_packages_in_repositories`.`last_moved`) AS `last_moved`," .
"`sr`.`name` AS `stable_repo`" .
" 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`" .
- " JOIN `repository_stabilities` ON `repositories`.`stability`=`repository_stabilities`.`id`" .
- " JOIN `build_assignments` ON `binary_packages`.`build_assignment`=`build_assignments`.`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 `repository_moves` ON `upstream_repositories`.`id`=`repository_moves`.`upstream_package_repository`" .
+ 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() .
+ mysql_join_binary_packages_build_assignments() .
+ mysql_join_build_assignments_package_sources() .
+ mysql_join_package_sources_upstream_repositories() .
+ mysql_join_upstream_repositories_git_repositories() .
+ mysql_join_upstream_repositories_repository_moves() .
" JOIN `repositories` AS `sr` ON `sr`.`id`=`repository_moves`.`to_repository`" .
" WHERE `binary_packages`.`pkgname`=from_base64(\"" . base64_encode($_GET["pkgname"]) . "\")" .
" AND `architectures`.`name`=from_base64(\"" . base64_encode($_GET["arch"]) . "\")" .
@@ -122,18 +122,18 @@ require_once BASE . "/lib/style.php";
" FROM `dependencies`" .
" LEFT JOIN (".
"`binary_packages_in_repositories` AS `bpir`" .
- " JOIN `repositories` AS `r` ON `r`.`id`=`bpir`.`repository`" .
+ mysql_join_binary_packages_in_repositories_repositories('bpir','r') .
") ON `bpir`.`package`=`dependencies`.`dependent`" .
- " JOIN `dependency_types` ON `dependency_types`.`id`=`dependencies`.`dependency_type`" .
- " JOIN `install_targets` ON `install_targets`.`id`=`dependencies`.`depending_on`" .
+ mysql_join_dependencies_dependency_types() .
+ mysql_join_dependencies_install_targets() .
" AND `install_targets`.`name` NOT IN (\"base\",\"base-devel\")" .
- " JOIN `versions` ON `versions`.`id`=`dependencies`.`version`" .
+ mysql_join_dependencies_versions() .
" LEFT JOIN (" .
"`install_target_providers`" .
- " JOIN `binary_packages` ON `install_target_providers`.`package`=`binary_packages`.`id`" .
- " 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`" .
+ 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() .
" JOIN `repository_stability_relations` ON `repository_stability_relations`.`more_stable`=`repositories`.`stability`" .
" AND `repository_stability_relations`.`less_stable`=" . $mysql_content["repo_stability"] .
") ON `install_target_providers`.`install_target`=`dependencies`.`depending_on`" .
@@ -141,8 +141,8 @@ require_once BASE . "/lib/style.php";
" WHERE `dependencies`.`dependent`=" . $mysql_content["id"] .
" AND NOT EXISTS (" .
"SELECT 1 FROM `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') .
// the substitue must be truly less stable than the dependency
" JOIN `repository_stability_relations` AS `subst_rsr` ON `subst_rsr`.`less_stable`=`subst_r`.`stability`" .
" AND `subst_rsr`.`less_stable`!=`subst_rsr`.`more_stable`" .
@@ -219,24 +219,24 @@ require_once BASE . "/lib/style.php";
" FROM `install_target_providers`" .
" LEFT JOIN (".
"`binary_packages_in_repositories` AS `bpir`" .
- " JOIN `repositories` AS `r` ON `r`.`id`=`bpir`.`repository`" .
+ mysql_join_binary_packages_in_repositories_repositories('bpir','r') .
") ON `bpir`.`package`=`install_target_providers`.`package`" .
- " JOIN `install_targets` ON `install_targets`.`id`=`install_target_providers`.`install_target`" .
+ mysql_join_install_target_providers_install_targets() .
" AND `install_targets`.`name` NOT IN (\"base\",\"base-devel\")" .
- " JOIN `dependencies` ON `install_target_providers`.`install_target`=`dependencies`.`depending_on`" .
- " JOIN `dependency_types` ON `dependency_types`.`id`=`dependencies`.`dependency_type`" .
- " JOIN `binary_packages` ON `dependencies`.`dependent`=`binary_packages`.`id`" .
- " 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`" .
+ mysql_join_install_target_providers_dependencies() .
+ mysql_join_dependencies_dependency_types() .
+ 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() .
" AND `repositories`.`architecture`=`r`.`architecture`" .
" JOIN `repository_stability_relations` ON `repository_stability_relations`.`less_stable`=`repositories`.`stability`" .
" AND `repository_stability_relations`.`more_stable`=" . $mysql_content["repo_stability"] .
" WHERE `install_target_providers`.`package`=" . $mysql_content["id"] .
" AND NOT EXISTS (" .
"SELECT 1 FROM `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') .
// the substitue must be truly less stable than we
" JOIN `repository_stability_relations` AS `subst_rsr` ON `subst_rsr`.`less_stable`=`subst_r`.`stability`" .
" AND `subst_rsr`.`less_stable`!=`subst_rsr`.`more_stable`" .
@@ -281,9 +281,9 @@ require_once BASE . "/lib/style.php";
"`binary_packages`.`sub_pkgrel`" .
") AS `version`" .
" 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`" .
+ mysql_join_binary_packages_architectures() .
+ mysql_join_binary_packages_binary_packages_in_repositories() .
+ mysql_join_binary_packages_in_repositories_repositories() .
" JOIN `binary_packages` AS `original`" .
" ON `binary_packages`.`pkgname`=`original`.`pkgname`" .
" AND `binary_packages`.`id`!=`original`.`id`" .