index : archweb32 | |
Archlinux32 website | gitolite user |
summaryrefslogtreecommitdiff |
-rw-r--r-- | buildmaster/blacklist.php | 61 | ||||
-rw-r--r-- | buildmaster/build-slaves.php | 46 | ||||
-rw-r--r-- | buildmaster/dependencies.php | 73 | ||||
-rw-r--r-- | buildmaster/mysql-issues.php | 93 | ||||
-rw-r--r-- | buildmaster/packages.php | 20 | ||||
-rw-r--r-- | buildmaster/statistics.php | 43 | ||||
-rw-r--r-- | buildmaster/status.php | 22 | ||||
-rw-r--r-- | buildmaster/to-delete.php | 41 | ||||
-rw-r--r-- | buildmaster/todos.php | 9 |
diff --git a/buildmaster/blacklist.php b/buildmaster/blacklist.php index c2810c6..274d769 100644 --- a/buildmaster/blacklist.php +++ b/buildmaster/blacklist.php @@ -1,33 +1,41 @@ +<?php + + include "lib/mysql.php"; + + $result = mysql_run_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`" + ); + +?> <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> + <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 " <tr>\n"; + print " <td>"; print $row["architecture"]; - print "</td><td>"; + print "</td>\n"; + print " <td>"; print $row["pkgbase"]; - print "</td><td>"; + print "</td>\n"; + print " <td>"; print preg_replace( array ( "/FS32#(\\d+)/", @@ -39,10 +47,11 @@ if ($result -> num_rows > 0) { ), $row["is_black_listed"] ); - print "</td></tr>\n"; + print "</td>\n"; + print " </tr>\n"; } } ?> -</table> -</body> + </table> + </body> </html> diff --git a/buildmaster/build-slaves.php b/buildmaster/build-slaves.php index b6afc2d..9a45afd 100644 --- a/buildmaster/build-slaves.php +++ b/buildmaster/build-slaves.php @@ -1,28 +1,30 @@ -<html><head><title>list of build slaves</title></head><body> <?php - $conn = new mysqli("localhost","webserver","empty","buildmaster"); - if ($conn->connect_error) { - die("Connection to mysql database failed: " . $conn->connect_error); - } + include "lib/mysql.php"; + + $result = mysql_run_query( + "SELECT" . + " `build_slaves`.`name`," . + "`build_slaves`.`operator`," . + "`package_sources`.`pkgbase`," . + "`build_slaves`.`last_connection`," . + "`build_slaves`.`logged_lines`," . + "`build_slaves`.`last_action`" . + " FROM `build_slaves`" . + " LEFT JOIN `build_assignments` ON" . + " `build_slaves`.`currently_building`=`build_assignments`.`id`" . + " LEFT JOIN `package_sources` ON" . + " `build_assignments`.`package_source`=`package_sources`.`id`" . + " ORDER BY `build_slaves`.`last_connection`" + ); - if (!$result = - $conn->query( - "SELECT" . - " `build_slaves`.`name`," . - "`build_slaves`.`operator`," . - "`package_sources`.`pkgbase`," . - "`build_slaves`.`last_connection`," . - "`build_slaves`.`logged_lines`," . - "`build_slaves`.`last_action`" . - " FROM `build_slaves`" . - " LEFT JOIN `build_assignments` ON" . - " `build_slaves`.`currently_building`=`build_assignments`.`id`" . - " LEFT JOIN `package_sources` ON" . - " `build_assignments`.`package_source`=`package_sources`.`id`" . - " ORDER BY `build_slaves`.`last_connection`" - )) - die($conn->error); +?> +<html> + <head> + <title>list of build slaves</title> + </head> + <body> +<?php print "<table border=1>\n"; if ($result->num_rows > 0) { diff --git a/buildmaster/dependencies.php b/buildmaster/dependencies.php index 3a38ac8..af37e5e 100644 --- a/buildmaster/dependencies.php +++ b/buildmaster/dependencies.php @@ -1,9 +1,6 @@ <?php -$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster"); -if ($mysql->connect_error) { - die("Connection failed: " . $mysql->connect_error); -} +include "lib/mysql.php"; $match = ""; @@ -28,15 +25,15 @@ $colors["virtual"]="#800080"; $limit=200; -if (! $result = $mysql -> query( +mysql_run_query( "CREATE TEMPORARY TABLE `cons` (" . "`dep` BIGINT, " . "`itp` BIGINT, " . "UNIQUE KEY `content` (`dep`,`itp`)" . - ")")) - die($mysql->error); + ")" +); -if (! $result = $mysql -> query( +mysql_run_query( "INSERT IGNORE INTO `cons` (`dep`,`itp`)" . " SELECT `dependencies`.`id`,`install_target_providers`.`id`". " FROM `binary_packages`" . @@ -53,10 +50,9 @@ if (! $result = $mysql -> query( " 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( +mysql_run_query( "INSERT IGNORE INTO `cons` (`dep`,`itp`)" . " SELECT `dependencies`.`id`,`install_target_providers`.`id`". " FROM `binary_packages`" . @@ -73,46 +69,39 @@ if (! $result = $mysql -> query( " 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( +$result = mysql_run_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"; +while ($row = $result->fetch_assoc()) + $edges .= "\"p" . $row["package"] . "\" -> \"i" . $row["install_target"] . "\" [color = \"#000080\"];\n"; -if (! $result = $mysql -> query( +$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`" - )) - 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"; +while ($row = $result->fetch_assoc()) + $edges .= "\"i" . $row["depending_on"] . "\" -> \"p" . $row["dependent"] . "\" [taillabel = \"" . $row["name"] . "\"];\n"; -if (! $result = $mysql -> query( +$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`" - )) - die($mysql->error); +); -if ($result -> num_rows > 0) - while ($row = $result->fetch_assoc()) - $knots .= "\"i" . $row["id"] . "\" [label = \"" . $row["name"] . "\", fontcolor = \"#000080\"];\n"; +while ($row = $result->fetch_assoc()) + $knots .= "\"i" . $row["id"] . "\" [label = \"" . $row["name"] . "\", fontcolor = \"#000080\"];\n"; $pkgfile_query = "CONCAT(". @@ -125,7 +114,7 @@ $pkgfile_query = "`architectures`.`name`" . ") AS `filename`"; -if (! $result = $mysql -> query( +$result = mysql_run_query( "SELECT DISTINCT " . "`binary_packages`.`id`," . "`repository_stabilities`.`name` AS `stability`," . @@ -136,14 +125,12 @@ if (! $result = $mysql -> query( " 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"; +while ($row = $result->fetch_assoc()) + $knots .= "\"p" . $row["id"] . "\" [label = \"" . $row["filename"] . "\", fontcolor = \"" . $colors[$row["stability"]] . "\"];\n"; -if (! $result = $mysql -> query( +$result = mysql_run_query( "SELECT DISTINCT " . "`binary_packages`.`id`," . "`repository_stabilities`.`name` AS `stability`," . @@ -154,12 +141,10 @@ if (! $result = $mysql -> query( " 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"; +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); @@ -175,5 +160,3 @@ passthru( "}\n" . "EOF\n" ); - -?> diff --git a/buildmaster/mysql-issues.php b/buildmaster/mysql-issues.php index 5342ba4..2b54c34 100644 --- a/buildmaster/mysql-issues.php +++ b/buildmaster/mysql-issues.php @@ -1,23 +1,13 @@ -<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="https://buildmaster.archlinux32.org/">Start page</a><br> <?php + include "lib/mysql.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( + $result = mysql_run_query( "SELECT CONCAT(" . "`repositories`.`name`,\"/\"," . "`binary_packages`.`pkgname`,\"-\"," . @@ -56,30 +46,13 @@ ")" . $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"; - } - - } + $serious_issues = array(); + while ( $row = $result -> fetch_assoc() ) + $serious_issues[] = $row; - if (! $result = $mysql -> query( + $result = mysql_run_query( "SELECT CONCAT(" . "`repositories`.`name`,\"/\"," . "`binary_packages`.`pkgname`,\"-\"," . @@ -114,21 +87,47 @@ ")" . $ignore . " ORDER BY `is_to_be_deleted`, `binary_packages`.`pkgname`" - )) - die($mysql -> error); + ); - print "Found " . ($result -> num_rows) . " stability issues.<br>\n"; + $stability_issues = array(); + while ( $row = $result -> fetch_assoc() ) + $stability_issues[] = $row; + +?> +<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="https://buildmaster.archlinux32.org/">Start page</a><br> +<?php + + print "Found " . count( $serious_issues ) . " serious issues.<br>\n"; + + foreach ( $serious_issues as $row ) { + 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 -> 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"; - } + print "Found " . count( $stability_issues ) . " stability issues.<br>\n"; + foreach ( $stability_issues as $row ) { + 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"; } ?> diff --git a/buildmaster/packages.php b/buildmaster/packages.php deleted file mode 100644 index b7c0196..0000000 --- a/buildmaster/packages.php +++ /dev/null @@ -1,20 +0,0 @@ -<?php - - $mysql = new mysqli("localhost", "webserver", "empty", "buildmaster"); - if ($mysql->connect_error) { - die("Connection to mysql database failed: " . $mysql->connect_error); - } - - $result = $mysql -> query("SELECT * FROM `binary_packages`"); - if ($result -> num_rows > 0) { - while($row = $result->fetch_assoc()) { - foreach ($row as $key => $val) { - print $key .": ".$val." - "; - } - print "<br>\n"; - } - } - - print 'OK'; - -?> diff --git a/buildmaster/statistics.php b/buildmaster/statistics.php index 47f1418..8c13548 100644 --- a/buildmaster/statistics.php +++ b/buildmaster/statistics.php @@ -1,33 +1,30 @@ <?php +include "lib/mysql.php"; + 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); +$result = mysql_run_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`" +); $t_min = -1; $t_max = -1; diff --git a/buildmaster/status.php b/buildmaster/status.php index 32f386d..28eee69 100644 --- a/buildmaster/status.php +++ b/buildmaster/status.php @@ -1,3 +1,13 @@ +<?php + + include "lib/mysql.php"; + + $result = mysql_run_query( + "SELECT MAX(`package_sources`.`commit_time`) AS `last`" . + "FROM `package_sources`" + ); + +?> <html> <head> <title>Build master status</title> @@ -7,19 +17,7 @@ <a href="https://buildmaster.archlinux32.org/">Start page</a><br> <?php -$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster"); -if ($mysql->connect_error) { - die("Connection failed: " . $mysql->connect_error); -} - -if ( ! $result = $mysql -> query( - "SELECT MAX(`package_sources`.`commit_time`) AS `last`" . - "FROM `package_sources`" - )) - die($mysql->error); - if ($result -> num_rows > 0) { - $row = $result->fetch_assoc(); print "latest package source is from " . $row["last"] . ".<br>\n"; } diff --git a/buildmaster/to-delete.php b/buildmaster/to-delete.php index dfa5a39..4da10a2 100644 --- a/buildmaster/to-delete.php +++ b/buildmaster/to-delete.php @@ -1,3 +1,24 @@ +<?php + + include "lib/mysql.php"; + + $result = mysql_run_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\")" + ); + +?> <html> <head> <title>List of packages to be deleted</title> @@ -6,26 +27,6 @@ <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; diff --git a/buildmaster/todos.php b/buildmaster/todos.php index 99e991c..ba870fc 100644 --- a/buildmaster/todos.php +++ b/buildmaster/todos.php @@ -1,11 +1,8 @@ <?php -$mysql = new mysqli("localhost", "webserver", "empty", "buildmaster"); -if ($mysql->connect_error) { - die("Connection failed: " . $mysql->connect_error); -} +include "lib/mysql.php"; -$result = $mysql -> query( +$result = mysql_run_query( "SELECT DISTINCT " . "`todos`.`id`," . "`todos`.`file`," . @@ -28,7 +25,7 @@ if (isset($_GET["graph"])) { } - $result = $mysql -> query( + $result = mysql_run_query( "SELECT DISTINCT " . "`todo_links`.`dependent`," . "`todo_links`.`depending_on` " . |