Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
path: root/web-scripts
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2018-03-23 20:18:01 +0100
committerAndreas Baumann <mail@andreasbaumann.cc>2018-03-23 20:18:01 +0100
commitc30de005f885202f24929bd4e3d3f5c885efbc0a (patch)
tree44b512356b80d3adad6521ad74f38ff9271f6c0d /web-scripts
parentff768f012bfef1bf264d06214aead70a58c0ff90 (diff)
parent497779257683e1c4ee2f2bf4c25687b34323c6be (diff)
Merge branch 'master' into opcodes
Diffstat (limited to 'web-scripts')
-rw-r--r--web-scripts/blacklist.php48
-rw-r--r--web-scripts/broken-packages.php157
-rw-r--r--web-scripts/build-list.php220
-rw-r--r--web-scripts/dependencies.php179
-rwxr-xr-xweb-scripts/mysql-issues.php136
-rw-r--r--web-scripts/statistics.php115
-rw-r--r--web-scripts/to-delete.php61
-rw-r--r--web-scripts/todos.php66
8 files changed, 764 insertions, 218 deletions
diff --git a/web-scripts/blacklist.php b/web-scripts/blacklist.php
new file mode 100644
index 0000000..c2810c6
--- /dev/null
+++ b/web-scripts/blacklist.php
@@ -0,0 +1,48 @@
+<html>
+<head>
+<title>Blacklisted packages</title>
+<link rel="stylesheet" type="text/css" href="/static/style.css">
+</head>
+<body>
+<table>
+<tr><th>architecture</th><th>package</th><th>reason</th></tr>
+<?php
+
+$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster");
+if ($mysql->connect_error) {
+ die("Connection failed: " . $mysql->connect_error);
+}
+if ( ! $result = $mysql -> query(
+ "SELECT DISTINCT `architectures`.`name` AS `architecture`,`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` " .
+ "WHERE `build_assignments`.`is_black_listed` IS NOT NULL " .
+ "ORDER BY `package_sources`.`pkgbase`")) {
+ die($mysql->error);
+}
+if ($result -> num_rows > 0) {
+ while($row = $result->fetch_assoc()) {
+ print "<tr><td>";
+ print $row["architecture"];
+ print "</td><td>";
+ print $row["pkgbase"];
+ print "</td><td>";
+ print preg_replace(
+ array (
+ "/FS32#(\\d+)/",
+ "/FS#(\\d+)/"
+ ),
+ array (
+ "<a href=\"https://bugs.archlinux32.org/index.php?do=details&task_id=$1\">$0</a>",
+ "<a href=\"https://bugs.archlinux.org/task/$1\">$0</a>"
+ ),
+ $row["is_black_listed"]
+ );
+ print "</td></tr>\n";
+ }
+}
+?>
+</table>
+</body>
+</html>
diff --git a/web-scripts/broken-packages.php b/web-scripts/broken-packages.php
deleted file mode 100644
index 268e296..0000000
--- a/web-scripts/broken-packages.php
+++ /dev/null
@@ -1,157 +0,0 @@
-<html>
-<head>
-<title>List of broken package builds</title>
-<link rel="stylesheet" type="text/css" href="/static/style.css">
-</head>
-<body>
-<a href="build-logs/">build logs</a><br>
-<?php
-
-$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster");
-if ($mysql->connect_error) {
- die("Connection failed: " . $mysql->connect_error);
-}
-
-$result = $mysql -> query(
- "SELECT " .
- "`build_assignments`.`id`," .
- "`build_assignments`.`is_blocked`," .
- "`package_sources`.`pkgbase`," .
- "`package_sources`.`git_revision`," .
- "`package_sources`.`mod_git_revision`," .
- "`upstream_repositories`.`name`," .
- "EXISTS (SELECT * " .
- "FROM `binary_packages` `broken_bin` " .
- "JOIN `dependencies` ON `dependencies`.`dependent` = `broken_bin`.`id` " .
- "JOIN `install_target_providers` ON `install_target_providers`.`install_target` = `dependencies`.`depending_on` " .
- "JOIN `binary_packages` `to_be_built` ON `to_be_built`.`id` = `install_target_providers`.`package` " .
- "JOIN `repositories` ON `to_be_built`.`repository` = `repositories`.`id` " .
- "WHERE `broken_bin`.`build_assignment`=`build_assignments`.`id` ".
- "AND `repositories`.`name`=\"community-testing\"" .
- ") AS `dependencies_pending`," .
- "(SELECT count(*) " .
- "FROM `build_dependency_loops` " .
- "WHERE `build_dependency_loops`.`build_assignment`=`build_assignments`.`id`" .
- ") AS `loops` " .
- "FROM `build_assignments` " .
- "JOIN `package_sources` ON `build_assignments`.`package_source` = `package_sources`.`id` " .
- "JOIN `upstream_repositories` ON `package_sources`.`upstream_package_repository` = `upstream_repositories`.`id` " .
- "WHERE `build_assignments`.`is_broken` OR `build_assignments`.`is_blocked` IS NOT NULL"
-);
-if ($result -> num_rows > 0) {
-
- $count = 0;
-
- while($row = $result->fetch_assoc()) {
-
-foreach ($row as $key => $val)
-
- $fail_result = $mysql -> query(
- "SELECT " .
- "`fail_reasons`.`name`, " .
- "`failed_builds`.`log_file` " .
- "FROM `failed_builds` " .
- "JOIN `build_assignments` ON `failed_builds`.`build_assignment`=`build_assignments`.`id` ".
- "JOIN `fail_reasons` ON `failed_builds`.`reason`=`fail_reasons`.`id` ".
- "WHERE `build_assignments`.`id`=".$row["id"]." " .
- "ORDER BY `failed_builds`.`date`"
- );
-
- unset($reasons);
- unset($last_log);
- $rows[$count]["trials"] = $fail_result -> num_rows;
- if ($rows[$count]["trials"] > 0) {
- while($fail_row = $fail_result->fetch_assoc()) {
- $reasons[$fail_row["name"]] = $fail_row["name"];
- $last_log = $fail_row["log_file"];
- }
- }
- if (isset($reasons)) {
- $to_print="";
- foreach ($reasons as $reason) {
- $to_print=$to_print.", ".$reason;
- }
- $rows[$count]["fail_reasons"]=substr($to_print,2);
- } else {
- $rows[$count]["fail_reasons"]="&nbsp;";
- }
-
- $rows[$count]["loops"] = $row["loops"];
- $rows[$count]["pkgbase"] = $row["pkgbase"];
- if ($row["dependencies_pending"]=="1")
- $rows[$count]["pkgbase_print"] = "(" . $rows[$count]["pkgbase"] . ")";
- else
- $rows[$count]["pkgbase_print"] = $rows[$count]["pkgbase"];
- $rows[$count]["git_revision"] = $row["git_revision"];
- $rows[$count]["mod_git_revision"] = $row["mod_git_revision"];
- $rows[$count]["name"] = $row["name"];
- if (isset($last_log))
- $rows[$count]["print_trials"]="<a href=\"/build-logs/error/".$last_log."\">". $rows[$count]["trials"] ."</a>";
- else
- $rows[$count]["print_trials"]=$rows[$count]["trials"];
- if ($row["is_blocked"]=="") {
- $rows[$count]["is_blocked"]="&nbsp;";
- }
- else {
- $rows[$count]["is_blocked"] = preg_replace(
- array (
- "/FS32#(\\d+)/",
- "/FS#(\\d+)/"
- ),
- array (
- "<a href=\"https://bugs.archlinux32.org/index.php?do=details&task_id=$1\">$0</a>",
- "<a href=\"https://bugs.archlinux.org/task/$1\">$0</a>"
- ),
- $row["is_blocked"]
- );
- }
- $count++;
- }
-
- usort(
- $rows,
- function (array $a, array $b) {
- if ($a["trials"] < $b["trials"])
- return -1;
- if ($a["trials"] > $b["trials"])
- return 1;
- return strcmp($a["pkgbase"],$b["pkgbase"]);
- }
- );
-
- print "<table>\n";
- print "<tr>";
- print "<th>package</th>";
- print "<th>git revision</th>";
- print "<th>modification git revision</th>";
- print "<th>package repository</th>";
- print "<th>compilations</th>";
- print "<th>loops</th>";
-// print "<th>dependent</th>";
- print "<th>build error</th>";
- print "<th>blocked</th>";
- print "</tr>\n";
-
- foreach($rows as $row) {
-
- print "<tr>";
-
- print "<td><a href=\"/graphs/".$row["pkgbase"].".png\">".$row["pkgbase_print"]."</a></td>";
- print "<td><p style=\"font-size:8px\">".$row["git_revision"]."</p></td>";
- print "<td><p style=\"font-size:8px\">".$row["mod_git_revision"]."</p></td>";
- print "<td>".$row["name"]."</td>";
- print "<td>".$row["print_trials"]."</td>";
- print "<td>".$row["loops"]."</td>";
-// <td>0</td>
- print "<td>".$row["fail_reasons"]."</td>";
- print "<td>".$row["is_blocked"]."</td>";
-
- print "</tr>\n";
- }
-
- print "</table>\n";
-}
-
-?>
-</body>
-</html>
diff --git a/web-scripts/build-list.php b/web-scripts/build-list.php
new file mode 100644
index 0000000..5cc7a47
--- /dev/null
+++ b/web-scripts/build-list.php
@@ -0,0 +1,220 @@
+<html>
+<head>
+<?php
+
+if (isset($_GET["show"]))
+ $to_show=$_GET["show"];
+else
+ $to_show="all";
+
+if ($to_show == "all")
+ $match = "";
+elseif ($to_show == "broken")
+ $match = " AND (`build_assignments`.`is_broken` OR `build_assignments`.`is_blocked` IS NOT NULL)";
+elseif ($to_show == "next")
+ $match = "";
+else
+ die();
+
+print "<title>List of " . $to_show . " package builds</title>\n";
+print "<link rel=\"stylesheet\" type=\"text/css\" href=\"/static/style.css\">\n";
+print "</head>\n";
+print "<body>\n";
+print "<a href=\"/\">Start page</a>\n";
+print "<a href=\"/build-logs/\">build logs</a><br>\n";
+
+$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster");
+if ($mysql->connect_error) {
+ die("Connection failed: " . $mysql->connect_error);
+}
+
+$result = $mysql -> query(
+ "SELECT DISTINCT " .
+ "`build_assignments`.`id`," .
+ "`build_assignments`.`is_blocked`," .
+ "`package_sources`.`pkgbase`," .
+ "`package_sources`.`git_revision`," .
+ "`package_sources`.`mod_git_revision`," .
+ "`package_sources`.`uses_upstream`," .
+ "`package_sources`.`uses_modification`," .
+ "`upstream_repositories`.`name` AS `package_repository`," .
+ "`git_repositories`.`name` AS `git_repository`," .
+ "`architectures`.`name` AS `arch`," .
+ "EXISTS (SELECT * " .
+ "FROM `binary_packages` `broken_bin` " .
+ "JOIN `dependencies` ON `dependencies`.`dependent` = `broken_bin`.`id` " .
+ "JOIN `install_target_providers` ON `install_target_providers`.`install_target` = `dependencies`.`depending_on` " .
+ "JOIN `binary_packages` `to_be_built` ON `to_be_built`.`id` = `install_target_providers`.`package` " .
+ "JOIN `repositories` ON `to_be_built`.`repository` = `repositories`.`id` " .
+ "WHERE `broken_bin`.`build_assignment`=`build_assignments`.`id` ".
+ "AND `repositories`.`name`=\"build-list\" " .
+ "AND `to_be_built`.`build_assignment`!=`build_assignments`.`id`" .
+ ") AS `dependencies_pending`," .
+ "(SELECT count(*) " .
+ "FROM `build_dependency_loops` " .
+ "WHERE `build_dependency_loops`.`build_assignment`=`build_assignments`.`id`" .
+ ") AS `loops`, " .
+ "`build_slaves`.`name` AS `build_slave` " .
+ "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 `repositories` ON `binary_packages`.`repository` = `repositories`.`id` " .
+ "LEFT JOIN `build_slaves` ON `build_slaves`.`currently_building`=`build_assignments`.`id` " .
+ "WHERE `repositories`.`name`=\"build-list\"" . $match
+);
+if ($result -> num_rows > 0) {
+
+ $count = 0;
+
+ while($row = $result->fetch_assoc()) {
+
+ if (($to_show == "next") &&
+ ($row["loops"]==0) &&
+ ($row["dependencies_pending"]==1))
+ continue;
+
+ $fail_result = $mysql -> query(
+ "SELECT " .
+ "`fail_reasons`.`name`, " .
+ "`failed_builds`.`log_file` " .
+ "FROM `failed_builds` " .
+ "JOIN `fail_reasons` ON `failed_builds`.`reason`=`fail_reasons`.`id` " .
+ "WHERE `failed_builds`.`build_assignment`=".$row["id"]." " .
+ "ORDER BY `failed_builds`.`date`"
+ );
+
+ unset($reasons);
+ $rows[$count]["trials"] = $fail_result -> num_rows;
+ if ($rows[$count]["trials"] > 0) {
+ while($fail_row = $fail_result->fetch_assoc()) {
+ $reasons[$fail_row["name"]] = $fail_row["log_file"];
+ }
+ }
+ if (isset($reasons)) {
+ $to_print="";
+ foreach ($reasons as $reason => $last_log) {
+ if (file_exists("/srv/http/build-logs/error/".$last_log)) {
+ $to_print= $to_print .
+ ", <a href=\"/build-logs/error/" .
+ $last_log .
+ "\">" .
+ $reason .
+ "</a>";
+ } else {
+ $to_print= $to_print . ", " . $reason;
+ }
+ }
+ $rows[$count]["fail_reasons"]=substr($to_print,2);
+ } else {
+ $rows[$count]["fail_reasons"]="&nbsp;";
+ }
+
+ $rows[$count]["loops"] = $row["loops"];
+ $rows[$count]["pkgbase"] = $row["pkgbase"];
+ if ($row["dependencies_pending"]=="0")
+ $rows[$count]["pkgbase_print"] = $rows[$count]["pkgbase"];
+ else
+ $rows[$count]["pkgbase_print"] = "(" . $rows[$count]["pkgbase"] . ")";
+ if ($row["uses_upstream"]) {
+ $rows[$count]["git_revision"] =
+ "<a href=\"https://git.archlinux.org/svntogit/" .
+ $row["git_repository"] . ".git/tree/" .
+ $row["pkgbase"] . "/repos/" .
+ $row["package_repository"] . "-";
+ if ($row["arch"]=="any")
+ $rows[$count]["git_revision"] =
+ $rows[$count]["git_revision"] . "any";
+ else
+ $rows[$count]["git_revision"] =
+ $rows[$count]["git_revision"] . "x86_64";
+ $rows[$count]["git_revision"] =
+ $rows[$count]["git_revision"] . "?id=" .
+ $row["git_revision"];
+ $rows[$count]["git_revision"] =
+ $rows[$count]["git_revision"] . "\">" .
+ $row["git_revision"] . "</a>";
+ } else
+ $rows[$count]["git_revision"] = $row["git_revision"];
+ if ($row["uses_modification"])
+ $rows[$count]["mod_git_revision"] =
+ "<a href=\"https://github.com/archlinux32/packages/tree/" .
+ $row["mod_git_revision"] . "/" .
+ $row["package_repository"] . "/" .
+ $row["pkgbase"] . "\">" .
+ $row["mod_git_revision"] . "</a>";
+ else
+ $rows[$count]["mod_git_revision"] = $row["mod_git_revision"];
+ $rows[$count]["package_repository"] = $row["package_repository"];
+ if ($row["is_blocked"]=="") {
+ $rows[$count]["is_blocked"]="&nbsp;";
+ }
+ else {
+ $rows[$count]["is_blocked"] = preg_replace(
+ array (
+ "/FS32#(\\d+)/",
+ "/FS#(\\d+)/"
+ ),
+ array (
+ "<a href=\"https://bugs.archlinux32.org/index.php?do=details&task_id=$1\">$0</a>",
+ "<a href=\"https://bugs.archlinux.org/task/$1\">$0</a>"
+ ),
+ $row["is_blocked"]
+ );
+ }
+ if (isset($row["build_slave"]))
+ $rows[$count]["build_slave"] = $row["build_slave"];
+ else
+ $rows[$count]["build_slave"] = "&nbsp;";
+ $count++;
+ }
+
+ usort(
+ $rows,
+ function (array $a, array $b) {
+ if ($a["trials"] < $b["trials"])
+ return -1;
+ if ($a["trials"] > $b["trials"])
+ return 1;
+ return strcmp($a["pkgbase"],$b["pkgbase"]);
+ }
+ );
+
+ print "<table>\n";
+ print "<tr>";
+ print "<th>package</th>";
+ print "<th>git revision</th>";
+ print "<th>modification git revision</th>";
+ print "<th>package repository</th>";
+ print "<th>compilations</th>";
+ print "<th>loops</th>";
+ print "<th>build error</th>";
+ print "<th>blocked</th>";
+ print "<th>handed out to</th>";
+ print "</tr>\n";
+
+ foreach($rows as $row) {
+
+ print "<tr>";
+
+ print "<td><a href=\"/scripts/dependencies.php?b=".$row["pkgbase"]."&r=build-list\">".$row["pkgbase_print"]."</a></td>";
+ print "<td><p style=\"font-size:8px\">".$row["git_revision"]."</p></td>";
+ print "<td><p style=\"font-size:8px\">".$row["mod_git_revision"]."</p></td>";
+ print "<td>".$row["package_repository"]."</td>";
+ print "<td>".$row["trials"]."</td>";
+ print "<td>".$row["loops"]."</td>";
+ print "<td>".$row["fail_reasons"]."</td>";
+ print "<td>".$row["is_blocked"]."</td>";
+ print "<td>".$row["build_slave"]."</td>";
+
+ print "</tr>\n";
+ }
+
+ print "</table>\n";
+}
+
+?>
+</body>
+</html>
diff --git a/web-scripts/dependencies.php b/web-scripts/dependencies.php
new file mode 100644
index 0000000..3a38ac8
--- /dev/null
+++ b/web-scripts/dependencies.php
@@ -0,0 +1,179 @@
+<?php
+
+$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster");
+if ($mysql->connect_error) {
+ die("Connection failed: " . $mysql->connect_error);
+}
+
+$match = "";
+
+if (isset($_GET["a"]))
+ $match .= " AND `architectures`.`name`=from_base64(\"" . base64_encode($_GET["a"]) . "\")";
+if (isset($_GET["b"]))
+ $match .= " AND `package_sources`.`pkgbase`=from_base64(\"" . base64_encode($_GET["b"]) . "\")";
+if (isset($_GET["p"]))
+ $match .= " AND `binary_packages`.`pkgname`=from_base64(\"" . base64_encode($_GET["p"]) . "\")";
+if (isset($_GET["r"]))
+ $match .= " AND `repositories`.`name`=from_base64(\"" . base64_encode($_GET["r"]) . "\")";
+
+$ignore_install_targets = " AND NOT `install_targets`.`name` IN (\"base\",\"base-devel\")";
+
+$colors["stable"]="#000000";
+$colors["testing"]="#008000";
+$colors["staging"]="#00ff00";
+$colors["standalone"]="#000000";
+$colors["unbuilt"]="#ff0000";
+$colors["forbidden"]="#808080";
+$colors["virtual"]="#800080";
+
+$limit=200;
+
+if (! $result = $mysql -> query(
+ "CREATE TEMPORARY TABLE `cons` (" .
+ "`dep` BIGINT, " .
+ "`itp` BIGINT, " .
+ "UNIQUE KEY `content` (`dep`,`itp`)" .
+ ")"))
+ die($mysql->error);
+
+if (! $result = $mysql -> query(
+ "INSERT IGNORE INTO `cons` (`dep`,`itp`)" .
+ " SELECT `dependencies`.`id`,`install_target_providers`.`id`".
+ " FROM `binary_packages`" .
+ " JOIN `repositories` ON `binary_packages`.`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`" .
+ $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`" .
+ $ignore_install_targets .
+ " JOIN `install_target_providers` ON `install_target_providers`.`install_target`=`dependencies`.`depending_on`" .
+ " WHERE (`dependency_types`.`relevant_for_binary_packages` OR `repository_stabilities`.`name`=\"unbuilt\")" .
+ " LIMIT " . $limit
+ ))
+ die($mysql->error);
+
+if (! $result = $mysql -> query(
+ "INSERT IGNORE INTO `cons` (`dep`,`itp`)" .
+ " SELECT `dependencies`.`id`,`install_target_providers`.`id`".
+ " FROM `binary_packages`" .
+ " JOIN `repositories` ON `binary_packages`.`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`" .
+ $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 `repositories` AS `d_r` ON `d_bp`.`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`" .
+ " WHERE (`dependency_types`.`relevant_for_binary_packages` OR `d_rs`.`name`=\"unbuilt\")" .
+ " LIMIT " . $limit
+ ))
+ die($mysql->error);
+
+unset($knots);
+unset($edges);
+
+if (! $result = $mysql -> query(
+ "SELECT DISTINCT `install_target_providers`.`install_target`,`install_target_providers`.`package`" .
+ " FROM `cons`" .
+ " JOIN `install_target_providers` ON `cons`.`itp`=`install_target_providers`.`id`"
+ ))
+ die($mysql->error);
+
+if ($result -> num_rows > 0)
+ while ($row = $result->fetch_assoc())
+ $edges .= "\"p" . $row["package"] . "\" -> \"i" . $row["install_target"] . "\" [color = \"#000080\"];\n";
+
+if (! $result = $mysql -> 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`"
+ ))
+ die($mysql->error);
+
+if ($result -> num_rows > 0)
+ while ($row = $result->fetch_assoc())
+ $edges .= "\"i" . $row["depending_on"] . "\" -> \"p" . $row["dependent"] . "\" [taillabel = \"" . $row["name"] . "\"];\n";
+
+if (! $result = $mysql -> 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`"
+ ))
+ die($mysql->error);
+
+if ($result -> num_rows > 0)
+ while ($row = $result->fetch_assoc())
+ $knots .= "\"i" . $row["id"] . "\" [label = \"" . $row["name"] . "\", fontcolor = \"#000080\"];\n";
+
+$pkgfile_query =
+ "CONCAT(".
+ "`repositories`.`name`,\"/\"," .
+ "`binary_packages`.`pkgname`,\"-\"," .
+ "IF(`binary_packages`.`epoch`=0,\"\",CONCAT(`binary_packages`.`epoch`,\":\"))," .
+ "`binary_packages`.`pkgver`,\"-\"," .
+ "`binary_packages`.`pkgrel`,\".\"," .
+ "`binary_packages`.`sub_pkgrel`,\"-\"," .
+ "`architectures`.`name`" .
+ ") AS `filename`";
+
+if (! $result = $mysql -> query(
+ "SELECT DISTINCT " .
+ "`binary_packages`.`id`," .
+ "`repository_stabilities`.`name` AS `stability`," .
+ $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 `repositories` ON `repositories`.`id`=`binary_packages`.`repository`" .
+ " JOIN `repository_stabilities` ON `repository_stabilities`.`id`=`repositories`.`stability`"
+ ))
+ die($mysql->error);
+
+if ($result -> num_rows > 0)
+ while ($row = $result->fetch_assoc())
+ $knots .= "\"p" . $row["id"] . "\" [label = \"" . $row["filename"] . "\", fontcolor = \"" . $colors[$row["stability"]] . "\"];\n";
+
+if (! $result = $mysql -> query(
+ "SELECT DISTINCT " .
+ "`binary_packages`.`id`," .
+ "`repository_stabilities`.`name` AS `stability`," .
+ $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 `repositories` ON `repositories`.`id`=`binary_packages`.`repository`" .
+ " JOIN `repository_stabilities` ON `repository_stabilities`.`id`=`repositories`.`stability`"
+ ))
+ die($mysql->error);
+
+if ($result -> num_rows > 0)
+ while ($row = $result->fetch_assoc())
+ $knots .= "\"p" . $row["id"] . "\" [label = \"" . $row["filename"] . "\", fontcolor = \"" . $colors[$row["stability"]] . "\"];\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"
+);
+
+?>
diff --git a/web-scripts/mysql-issues.php b/web-scripts/mysql-issues.php
new file mode 100755
index 0000000..2f1d99d
--- /dev/null
+++ b/web-scripts/mysql-issues.php
@@ -0,0 +1,136 @@
+<html>
+<head>
+<title>More and less critical issues with the database</title>
+<link rel="stylesheet" type="text/css" href="/static/style.css">
+</head>
+<body>
+<a href="/">Start page</a><br>
+<?php
+
+ if (isset($_GET["ignore-haskell"]))
+ $ignore = " AND `install_targets`.`name` NOT LIKE \"libHS%\"";
+ else
+ $ignore = "";
+
+ $mysql = new mysqli("localhost", "webserver", "empty", "buildmaster");
+ if ($mysql->connect_error) {
+ die("Connection failed: " . $mysql->connect_error);
+ }
+
+ if (! $result = $mysql -> query(
+ "SELECT CONCAT(" .
+ "`repositories`.`name`,\"/\"," .
+ "`binary_packages`.`pkgname`,\"-\"," .
+ "IF(`binary_packages`.`epoch`=0,\"\",CONCAT(`binary_packages`.`epoch`,\":\"))," .
+ "`binary_packages`.`pkgver`,\"-\"," .
+ "`binary_packages`.`pkgrel`,\".\"," .
+ "`binary_packages`.`sub_pkgrel`,\"-\"," .
+ "`architectures`.`name`) AS `pkgfile`," .
+ "`install_targets`.`name` AS `install_target`," .
+ "IF(`binary_packages`.`is_to_be_deleted`,1,0) AS `is_to_be_deleted`," .
+ "`subst_r`.`name` AS `subst_repository`," .
+ "`subst_buildlist_bp`.`id` AS `subst_buildlist`" .
+ " FROM `binary_packages`" .
+ " JOIN `repositories` ON `binary_packages`.`repository`=`repositories`.`id`" .
+ " AND `repositories`.`is_on_master_mirror`" .
+ " JOIN `dependencies` ON `dependencies`.`dependent`=`binary_packages`.`id`" .
+ " JOIN `dependency_types` ON `dependencies`.`dependency_type`=`dependency_types`.`id`" .
+ " 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`" .
+ " LEFT JOIN (`binary_packages` AS `subst_bp`" .
+ " JOIN `repositories` AS `subst_r` ON `subst_bp`.`repository`=`subst_r`.`id`" .
+ " JOIN `repository_stability_relations` ON `repository_stability_relations`.`less_stable`=`subst_r`.`id`" .
+ ")" .
+ " ON `subst_bp`.`pkgname`=`binary_packages`.`pkgname`" .
+ " AND `subst_bp`.`id`!=`binary_packages`.`id`" .
+ " AND `repository_stability_relations`.`more_stable`=`repositories`.`id`" .
+ " LEFT JOIN (`binary_packages` AS `subst_buildlist_bp`" .
+ " JOIN `repositories` AS `subst_buildlist_r`" .
+ " ON `subst_buildlist_bp`.`repository`=`subst_buildlist_r`.`id`" .
+ " AND `subst_buildlist_r`.`name`=\"build-list\"".
+ ") ON `subst_buildlist_bp`.`pkgname`=`binary_packages`.`pkgname`" .
+ " WHERE NOT EXISTS (" .
+ "SELECT * FROM `install_target_providers`" .
+ " WHERE `install_target_providers`.`install_target` = `dependencies`.`depending_on`" .
+ ")" .
+ $ignore .
+ " ORDER BY `is_to_be_deleted`, `binary_packages`.`pkgname`"
+ ))
+ die($mysql -> error);
+
+ print "Found " . ($result -> num_rows) . " serious issues.<br>\n";
+
+ if ($result -> num_rows > 0) {
+
+ while ($row = $result->fetch_assoc()) {
+ if ($row["is_to_be_deleted"]==1)
+ print "<font color=\"#00ff00\">(marked as to-be-deleted) ";
+ else
+ print "<font color=\"#ff0000\">";
+ print $row["pkgfile"] . " depends on " . $row["install_target"] . " which is not provided by any package";
+ if (isset($row["subst_repository"]))
+ print " - but can be replaced by the one in " . $row["subst_repository"];
+ elseif (isset($row["subst_buildlist"]))
+ print " - but is already rescheduled";
+ print ".<br>";
+ print "</font>\n";
+ }
+
+ }
+
+ if (! $result = $mysql -> query(
+ "SELECT CONCAT(" .
+ "`repositories`.`name`,\"/\"," .
+ "`binary_packages`.`pkgname`,\"-\"," .
+ "IF(`binary_packages`.`epoch`=0,\"\",CONCAT(`binary_packages`.`epoch`,\":\"))," .
+ "`binary_packages`.`pkgver`,\"-\"," .
+ "`binary_packages`.`pkgrel`,\".\"," .
+ "`binary_packages`.`sub_pkgrel`,\"-\"," .
+ "`architectures`.`name`) AS `pkgfile`," .
+ "`install_targets`.`name` AS `install_target`," .
+ "`repository_stabilities`.`name` AS `stability`," .
+ "IF(`binary_packages`.`is_to_be_deleted`,1,0) AS `is_to_be_deleted`" .
+ " FROM `binary_packages`" .
+ " JOIN `repositories` ON `binary_packages`.`repository`=`repositories`.`id`" .
+ " AND `repositories`.`is_on_master_mirror`" .
+ " 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`" .
+ " 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`" .
+ " WHERE EXISTS (" .
+ "SELECT * FROM `install_target_providers`" .
+ " WHERE `install_target_providers`.`install_target` = `dependencies`.`depending_on`" .
+ ")" .
+ " AND NOT EXISTS (" .
+ "SELECT * FROM `install_target_providers`" .
+ " JOIN `binary_packages` AS `prov_bp` ON `prov_bp`.`id`=`install_target_providers`.`package`" .
+ " JOIN `repositories` AS `prov_r` ON `prov_bp`.`repository`=`prov_r`.`id`" .
+ " 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`" .
+ ")" .
+ $ignore .
+ " ORDER BY `is_to_be_deleted`, `binary_packages`.`pkgname`"
+ ))
+ die($mysql -> error);
+
+ print "Found " . ($result -> num_rows) . " stability issues.<br>\n";
+
+ if ($result -> num_rows > 0) {
+ while ($row = $result->fetch_assoc()) {
+ if ($row["is_to_be_deleted"]==1)
+ print "<font color=\"#00ff00\">(marked as to-be-deleted) ";
+ else
+ print "<font color=\"#800000\">";
+ print $row["pkgfile"] . " depends on " . $row["install_target"] . " which is not provided by any package installable from enabled " . $row["stability"] . " repositories.<br>";
+ print "</font>\n";
+ }
+
+ }
+
+?>
+</body>
+</html>
diff --git a/web-scripts/statistics.php b/web-scripts/statistics.php
index 279aa39..c919f93 100644
--- a/web-scripts/statistics.php
+++ b/web-scripts/statistics.php
@@ -1,54 +1,49 @@
<?php
-$columns = array(
- 'stable',
- 'tasks',
- 'pending_packages',
- 'staging',
- 'testing',
- 'broken',
- 'loops',
- 'looped_packages',
- 'locked',
- 'blocked',
- 'next_pending',
- 'tested'
-);
-
-$print_columns = array(
- 'tasks',
- 'pending_packages',
- 'staging',
- 'testing',
- 'tested',
- 'broken',
- 'loops',
- 'looped_packages',
- 'locked',
- 'blocked',
- 'next_pending'
-);
+if (isset($_GET["from"]))
+ $min_time="from_base64(\"" . base64_encode("-".$_GET["from"]) . "\")";
+else
+ $min_time="\"-7 00:00:00\"";
+
+$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster");
+if ($mysql->connect_error) {
+ die("Connection failed: " . $mysql->connect_error);
+}
+if (! $result = $mysql -> query(
+ "SELECT DISTINCT ".
+ "UNIX_TIMESTAMP(`statistics`.`date`) AS `date`," .
+ "`statistics`.`pending_tasks_count`," .
+ "`statistics`.`pending_packages_count`," .
+ "`statistics`.`staging_packages_count`," .
+ "`statistics`.`testing_packages_count`," .
+ "`statistics`.`tested_packages_count`," .
+ "`statistics`.`broken_tasks_count`," .
+ "`statistics`.`dependency_loops_count`," .
+ "`statistics`.`dependency_looped_tasks_count`," .
+ "`statistics`.`locked_tasks_count`," .
+ "`statistics`.`blocked_tasks_count`," .
+ "`statistics`.`next_tasks_count`" .
+ "FROM `statistics` " .
+ "WHERE `statistics`.`date`>=ADDTIME(NOW()," . $min_time . ") " .
+ "ORDER BY `statistics`.`date`"
+ ))
+ die($mysql->error);
$t_min = -1;
$t_max = -1;
$val_max = -1;
-foreach (explode("\n",trim(file_get_contents('/srv/http/statistics'))) as $val) {
- $val = explode(" ",$val);
- if (($t_min == -1) || ($t_min > $val[0]))
- $t_min = $val[0];
- if (($t_max == -1) || ($t_max < $val[0]))
- $t_max = $val[0];
- foreach ($columns as $id => $column) {
- if (count($val) > $id+1)
- $values[$column][$val[0]] = $val[$id+1];
- };
- foreach ($print_columns as $column) {
- if (array_key_exists($column,$values))
- if (($val_max == -1) || ($val_max < $values[$column][$val[0]]))
- $val_max = $values[$column][$val[0]];
- }
+while($vals = $result->fetch_assoc()) {
+ if ($t_min == -1)
+ $t_min = $vals["date"];
+ $t_max = $vals["date"];
+ foreach ($vals as $column => $val)
+ if ($column != "date") {
+ $values[$column][$vals["date"]] = $val;
+ $val_max = max($val_max,$val);
+ }
};
+$print_columns = array_keys($values);
$max_len = 0;
foreach ($print_columns as $column) {
@@ -61,7 +56,7 @@ $width = 1600;
$height = 600;
$border = 5;
$legend_line_length = 10;
-$legend_height = 3 * ImageFontHeight(5) + $legend_line_length;
+$legend_height = 4 * ImageFontHeight(5) + $legend_line_length;
$im = @ImageCreate ($width + $legend_line_length + $max_len * ImageFontWidth(5), $height + $legend_height)
or die ("Cannot create new gd-image-stream");
@@ -69,18 +64,18 @@ $im = @ImageCreate ($width + $legend_line_length + $max_len * ImageFontWidth(5),
$background_color = ImageColorAllocate ($im, 255, 255, 255);
$foreground_color = ImageColorAllocate ($im, 0, 0, 0);
-$colors['stable'] = ImageColorAllocate ($im, 0, 0, 0);
-$colors['tasks'] = ImageColorAllocate ($im, 0, 0, 128);
-$colors['pending_packages'] = ImageColorAllocate ($im, 0, 0, 255);
-$colors['staging'] = ImageColorAllocate ($im, 0, 100, 0);
-$colors['testing'] = ImageColorAllocate ($im, 0, 200, 0);
-$colors['tested'] = ImageColorAllocate ($im, 100, 255, 0);
-$colors['broken'] = ImageColorAllocate ($im, 255, 0, 0);
-$colors['loops'] = ImageColorAllocate ($im, 128, 128, 0);
-$colors['looped_packages'] = ImageColorAllocate ($im, 255, 128, 128);
-$colors['locked'] = ImageColorAllocate ($im, 128, 128, 128);
-$colors['blocked'] = ImageColorAllocate ($im, 128, 0, 0);
-$colors['next_pending'] = ImageColorAllocate ($im, 0, 255, 255);
+$colors['stable_packages_count'] = ImageColorAllocate ($im, 0, 0, 0);
+$colors['pending_tasks_count'] = ImageColorAllocate ($im, 0, 0, 128);
+$colors['pending_packages_count'] = ImageColorAllocate ($im, 0, 0, 255);
+$colors['staging_packages_count'] = ImageColorAllocate ($im, 0, 100, 0);
+$colors['testing_packages_count'] = ImageColorAllocate ($im, 0, 200, 0);
+$colors['tested_packages_count'] = ImageColorAllocate ($im, 100, 255, 0);
+$colors['broken_tasks_count'] = ImageColorAllocate ($im, 255, 0, 0);
+$colors['dependency_loops_count'] = ImageColorAllocate ($im, 128, 128, 0);
+$colors['dependency_looped_tasks_count'] = ImageColorAllocate ($im, 255, 128, 128);
+$colors['locked_tasks_count'] = ImageColorAllocate ($im, 128, 128, 128);
+$colors['blocked_tasks_count'] = ImageColorAllocate ($im, 128, 0, 0);
+$colors['next_tasks_count'] = ImageColorAllocate ($im, 0, 255, 255);
function scale($x, $x_min, $x_max, $scale, $log) {
if ($log) {
@@ -128,13 +123,13 @@ function print_graph($data, $color) {
ImageRectangle($im, $legend_line_length, 0, $width-1+$legend_line_length, $height-1, $foreground_color);
-ImageString($im, 5, $legend_line_length, $height + $legend_line_length + 2*ImageFontHeight(5), "( ".trim(shell_exec("uptime | sed 's|^.*\\s\\(load\\)|\\1|'"))." )", $foreground_color);
+ImageString($im, 5, $legend_line_length, $height + 2*$legend_line_length + 2*ImageFontHeight(5), "( ".trim(shell_exec("uptime | sed 's|^.*\\s\\(load\\)|\\1|'"))." )", $foreground_color);
$xpos = $legend_line_length;
foreach ($print_columns as $column) {
print_graph($values[$column], $colors[$column]);
- ImageString($im, 5, $xpos, $height + $legend_line_length + ImageFontHeight(5), $column, $colors[$column]);
- $xpos += (strlen($column) + 1.75) * ImageFontWidth(5);
+ ImageString($im, 5, $xpos, $height + $legend_line_length + ImageFontHeight(5), substr($column,0,-strlen("_count")), $colors[$column]);
+ $xpos += (strlen($column) - strlen("_count") + 1.75) * ImageFontWidth(5);
}
ImageString($im, 5, $legend_line_length, $height + $legend_line_length, date('Y-m-d H:i', $t_min), $foreground_color);
@@ -174,6 +169,4 @@ header ("Content-type: image/png");
ImagePNG ($im);
-// passthru('wc -l /srv/http/statistics');
-
?>
diff --git a/web-scripts/to-delete.php b/web-scripts/to-delete.php
new file mode 100644
index 0000000..dfa5a39
--- /dev/null
+++ b/web-scripts/to-delete.php
@@ -0,0 +1,61 @@
+<html>
+<head>
+<title>List of packages to be deleted</title>
+<link rel="stylesheet" type="text/css" href="/static/style.css">
+</head>
+<body>
+<?php
+
+$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster");
+if ($mysql->connect_error) {
+ die("Connection failed: " . $mysql->connect_error);
+}
+
+$result = $mysql -> query(
+ "SELECT " .
+ "`repositories`.`name` AS `repo`," .
+ "`binary_packages`.`pkgname`," .
+ "`binary_packages`.`epoch`," .
+ "`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 `repositories` ON `binary_packages`.`repository`=`repositories`.`id` " .
+ "WHERE `binary_packages`.`is_to_be_deleted` " .
+ "AND NOT `repositories`.`name` IN (\"build-support\",\"build-list\",\"deletion-list\")"
+);
+if ($result -> num_rows > 0) {
+
+ $count = 0;
+
+ while ($row = $result->fetch_assoc()) {
+ $rows[$count] =
+ $row["repo"] . "/" .
+ $row["pkgname"] . "-";
+ if ($row["epoch"] != "0")
+ $rows[$count] =
+ $rows[$count] .
+ $row["epoch"] . ":";
+ $rows[$count] =
+ $rows[$count] .
+ $row["pkgver"] . "-" .
+ $row["pkgrel"] . "." .
+ $row["sub_pkgrel"] . "-" .
+ $row["arch"] . ".pkg.tar.xz";
+ $count++;
+ }
+
+ sort($rows);
+
+ foreach ($rows as $row) {
+ print $row."<br>\n";
+ }
+} else {
+ print "No packages are to be deleted.\n";
+}
+
+?>
+</body>
+</html>
diff --git a/web-scripts/todos.php b/web-scripts/todos.php
new file mode 100644
index 0000000..e4ab2c9
--- /dev/null
+++ b/web-scripts/todos.php
@@ -0,0 +1,66 @@
+<?php
+
+$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster");
+if ($mysql->connect_error) {
+ die("Connection failed: " . $mysql->connect_error);
+}
+
+$result = $mysql -> query(
+ "SELECT DISTINCT " .
+ "`todos`.`id`," .
+ "`todos`.`file`," .
+ "`todos`.`line`," .
+ "`todos`.`description` " .
+ "FROM `todos`;"
+);
+
+if ($result -> num_rows > 0) {
+
+ while ($row = $result->fetch_assoc())
+ $knot_rows[$row["id"]] =
+ $row["file"]. " (line ".$row["line"]."):\\n".$row["description"];
+
+ unset($knots);
+ foreach ($knot_rows as $knot)
+ $knots=$knots . "\"" . $knot . "\";\n";
+
+}
+
+$result = $mysql -> query(
+ "SELECT DISTINCT " .
+ "`todo_links`.`dependent`," .
+ "`todo_links`.`depending_on` " .
+ "FROM `todo_links`;"
+);
+
+if ($result -> num_rows > 0) {
+ $count = 0;
+ while ($row = $result->fetch_assoc()) {
+ $link_rows[$count]["dependent"] =
+ $knot_rows[$row["dependent"]];
+ $link_rows[$count]["depending_on"] =
+ $knot_rows[$row["depending_on"]];
+ $count++;
+ }
+
+ unset($edges);
+ foreach ($link_rows as $link)
+ $edges=$edges . "\"" . $link["depending_on"] . "\" -> \"" . $link["dependent"] . "\";\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"
+);
+
+?>