summaryrefslogtreecommitdiff
path: root/buildmaster/deletion-links.php
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-06-01 09:50:05 +0200
committerErich Eckner <git@eckner.net>2018-06-01 09:50:05 +0200
commit380fe1437a2b3ea1def26bd3ce5e21ca32194bfa (patch)
treeb61c3e37c0d48b7f5a72a34bc6b71348aabdc28a /buildmaster/deletion-links.php
parentf1a6d7ddc580b913ba35532b4c701bfd8e320a16 (diff)
downloadarchweb32-380fe1437a2b3ea1def26bd3ce5e21ca32194bfa.tar.xz
buildmaster/deletion-links.php: operate on `binary_packages_in_repositories` instead of `binary_packages`
Diffstat (limited to 'buildmaster/deletion-links.php')
-rw-r--r--buildmaster/deletion-links.php85
1 files changed, 49 insertions, 36 deletions
diff --git a/buildmaster/deletion-links.php b/buildmaster/deletion-links.php
index 58673e8..39df340 100644
--- a/buildmaster/deletion-links.php
+++ b/buildmaster/deletion-links.php
@@ -6,63 +6,73 @@ $edges = "";
$knots = "";
mysql_run_query(
- "CREATE TEMPORARY TABLE `d_bp` (" .
+ "CREATE TEMPORARY TABLE `d_bpir` (" .
"`id` BIGINT, " .
+ "`arch` MEDIUMINT, " .
"UNIQUE KEY `id` (`id`)" .
")"
);
mysql_run_query(
- "INSERT IGNORE INTO `d_bp` (`id`)" .
- " SELECT `binary_packages`.`id`" .
- " FROM `binary_packages`" .
- " WHERE `binary_packages`.`is_to_be_deleted`" .
+ "INSERT IGNORE INTO `d_bpir` (`id`,`arch`)" .
+ " SELECT `binary_packages_in_repositories`.`id`,`repositories`.`architecture`" .
+ " 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`" .
+ " WHERE `binary_packages_in_repositories`.`is_to_be_deleted`" .
" AND `binary_packages`.`pkgname` NOT LIKE \"lib32-%\""
);
mysql_run_query(
- "CREATE TEMPORARY TABLE `d_bp_copy` (" .
+ "CREATE TEMPORARY TABLE `d_bpir_copy` (" .
"`id` BIGINT, " .
+ "`arch` MEDIUMINT, " .
"UNIQUE KEY `id` (`id`)" .
")"
);
mysql_run_query(
- "INSERT IGNORE INTO `d_bp_copy` (`id`)" .
- " SELECT `d_bp`.`id`" .
- " FROM `d_bp`"
+ "INSERT IGNORE INTO `d_bpir_copy` (`id`,`arch`)" .
+ " SELECT `d_bpir`.`id`,`d_bpir`.`arch`" .
+ " FROM `d_bpir`"
);
mysql_run_query(
"CREATE TEMPORARY TABLE `d_it` (" .
"`id` BIGINT, " .
+ "`arch` MEDIUMINT, " .
"UNIQUE KEY `id` (`id`)" .
")"
);
mysql_run_query(
- "INSERT IGNORE INTO `d_it` (`id`)" .
- " SELECT `install_target_providers`.`install_target`" .
- " FROM `install_target_providers`" .
- " JOIN `d_bp` ON `d_bp`.`id`=`install_target_providers`.`package`" .
+ "INSERT IGNORE INTO `d_it` (`id`,`arch`)" .
+ " SELECT `install_target_providers`.`install_target`,`d_bpir`.`arch`" .
+ " FROM `d_bpir`" .
+ " JOIN `binary_packages_in_repositories` ON `binary_packages_in_repositories`.`id`=`d_bpir`.`id`" .
+ " JOIN `install_target_providers` ON `binary_packages_in_repositories`.`package`=`install_target_providers`.`package`" .
" WHERE NOT EXISTS (" .
"SELECT 1 FROM `install_target_providers` AS `subst_itp`" .
- " JOIN `binary_packages` AS `subst_bp` ON `subst_itp`.`package`=`subst_bp`.`id`" .
- " WHERE NOT `subst_bp`.`is_to_be_deleted`" .
+ " JOIN `binary_packages_in_repositories` AS `subst_bpir` ON `subst_bpir`.`package`=`subst_itp`.`package`" .
+ " JOIN `repositories` ON `subst_bpir`.`repository`=`repositories`.`id`" .
+ " WHERE NOT `subst_bpir`.`is_to_be_deleted`" .
" AND `subst_itp`.`install_target`=`install_target_providers`.`install_target`" .
+ " AND `repositories`.`architecture`=`d_bpir`.`arch`" .
")"
);
$result = mysql_run_query(
- "SELECT `binary_packages`.`id`," .
+ "SELECT `binary_packages_in_repositories`.`id`," .
+ "`architectures`.`name` AS `arch`," .
"`binary_packages`.`pkgname`," .
"`repositories`.`name` AS `repo`," .
"IF(`build_assignments`.`is_black_listed` IS NULL,\"#800000\",\"#ff0000\") AS `color`" .
- " FROM `binary_packages`" .
- " JOIN `d_bp` ON `d_bp`.`id`=`binary_packages`.`id`" .
+ " 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 `build_assignments` ON `binary_packages`.`build_assignment`=`build_assignments`.`id`" .
- " JOIN `binary_packages_in_repositories` ON `binary_packages`.`id`=`bianry_packages_in_repositories`.`package`"
- " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`"
+ " JOIN `repositories` ON `binary_packages_in_repositories`.`repository`=`repositories`.`id`" .
+ " JOIN `architectures` ON `repositories`.`architecture`=`architectures`.`id`"
);
while ($row = $result->fetch_assoc())
@@ -70,6 +80,8 @@ while ($row = $result->fetch_assoc())
"\"p" .
$row["id"] .
"\" [label = \"" .
+ $row["arch"] .
+ "/" .
$row["repo"] .
"/" .
$row["pkgname"] .
@@ -79,14 +91,17 @@ while ($row = $result->fetch_assoc())
"\"];\n";
$result = mysql_run_query(
- "SELECT `dependencies`.`dependent`," .
+ "SELECT `d_bpir`.`id` AS `dependent`," .
"`dependency_types`.`name` AS `dep_type`," .
- "`install_target_providers`.`package` AS `depending_on`" .
- " FROM `dependencies`" .
- " JOIN `d_bp` ON `d_bp`.`id`=`dependencies`.`dependent`" .
+ "`itp_bpir`.`id` AS `depending_on`" .
+ " 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 `dependency_types` ON `dependencies`.`dependency_type`=`dependency_types`.`id`" .
" JOIN `install_target_providers` ON `install_target_providers`.`install_target`=`dependencies`.`depending_on`" .
" JOIN `d_it` ON `d_it`.`id`=`install_target_providers`.`install_target`" .
+ " JOIN `binary_packages_in_repositories` AS `itp_bpir` ON `itp_bpir`.`package`=`install_target_providers`.`package`" .
+ " JOIN `d_bpir_copy` ON `itp_bpir`.`id`=`d_bpir_copy`.`id`" .
" WHERE `dependencies`.`dependent`!=`install_target_providers`.`package`"
);
@@ -119,18 +134,16 @@ while ($row = $result->fetch_assoc()) {
"\"];\n";
}
-$knots = str_replace("\$","\\\$",$knots);
-$edges = str_replace("\$","\\\$",$edges);
-
-
header ("Content-type: image/png");
passthru(
- "dot -Tpng -o/dev/stdout /dev/stdin <<EOF\n" .
- "digraph dependencies {\n" .
- "rankdir=LR;\n" .
- "fontname=dejavu;\n" .
- $knots .
- $edges .
- "}\n" .
- "EOF\n"
+ "echo '" . base64_encode(
+ "digraph dependencies {\n" .
+ "rankdir=LR;\n" .
+ "fontname=dejavu;\n" .
+ $knots .
+ $edges .
+ "}\n"
+ ) . "' | " .
+ "base64 -d | " .
+ "dot -Tpng -o/dev/stdout /dev/stdin"
);