From 1658d4718631b4186a405602596e344e0ab5cb05 Mon Sep 17 00:00:00 2001 From: Erich Eckner Date: Fri, 9 Mar 2018 14:09:51 +0100 Subject: unify web-scripts/broken-packages.php and web-scripts/build-list.php --- web-scripts/broken-packages.php | 194 ---------------------------------------- web-scripts/build-list.php | 54 +++++++++-- 2 files changed, 48 insertions(+), 200 deletions(-) delete mode 100644 web-scripts/broken-packages.php (limited to 'web-scripts') diff --git a/web-scripts/broken-packages.php b/web-scripts/broken-packages.php deleted file mode 100644 index 4dabf5c..0000000 --- a/web-scripts/broken-packages.php +++ /dev/null @@ -1,194 +0,0 @@ - - -List of broken package builds - - - -build logs
-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` " . - "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` " . - "WHERE (`build_assignments`.`is_broken` OR `build_assignments`.`is_blocked` IS NOT NULL) AND `repositories`.`name`=\"build-list\"" -); -if ($result -> num_rows > 0) { - - $count = 0; - - while($row = $result->fetch_assoc()) { - - $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); - $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 . - ", " . - $reason . - ""; - } else { - $to_print= $to_print . ", " . $reason; - } - } - $rows[$count]["fail_reasons"]=substr($to_print,2); - } else { - $rows[$count]["fail_reasons"]=" "; - } - - $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"] = - "" . - $row["git_revision"] . ""; - } else - $rows[$count]["git_revision"] = $row["git_revision"]; - if ($row["uses_modification"]) - $rows[$count]["mod_git_revision"] = - "" . - $row["mod_git_revision"] . ""; - 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"]=" "; - } - else { - $rows[$count]["is_blocked"] = preg_replace( - array ( - "/FS32#(\\d+)/", - "/FS#(\\d+)/" - ), - array ( - "$0", - "$0" - ), - $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 "\n"; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; -// print ""; - print ""; - print ""; - print "\n"; - - foreach($rows as $row) { - - print ""; - - print ""; - print ""; - print ""; - print ""; - print ""; - print ""; -// - print ""; - print ""; - - print "\n"; - } - - print "
packagegit revisionmodification git revisionpackage repositorycompilationsloopsdependentbuild errorblocked
".$row["pkgbase_print"]."

".$row["git_revision"]."

".$row["mod_git_revision"]."

".$row["package_repository"]."".$row["trials"]."".$row["loops"]."0".$row["fail_reasons"]."".$row["is_blocked"]."
\n"; -} - -?> - - diff --git a/web-scripts/build-list.php b/web-scripts/build-list.php index 1b5c359..0ca36b8 100644 --- a/web-scripts/build-list.php +++ b/web-scripts/build-list.php @@ -1,6 +1,11 @@ -List of scheduled package builds +List of scheduled package builds\n"; + else + print "List of broken package builds\n"; +?> @@ -12,6 +17,11 @@ if ($mysql->connect_error) { die("Connection failed: " . $mysql->connect_error); } +if (isset($_GET["all"])) + $match_broken = ""; +else + $match_broken = "AND (`build_assignments`.`is_broken` OR `build_assignments`.`is_blocked` IS NOT NULL)"; + $result = $mysql -> query( "SELECT DISTINCT " . "`build_assignments`.`id`," . @@ -45,7 +55,7 @@ $result = $mysql -> query( "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` " . - "WHERE `repositories`.`name`=\"build-list\"" + "WHERE `repositories`.`name`=\"build-list\"" . $match_broken ); if ($result -> num_rows > 0) { @@ -55,12 +65,39 @@ if ($result -> num_rows > 0) { $fail_result = $mysql -> query( "SELECT " . - "`failed_builds`.`id` " . + "`fail_reasons`.`name`, " . + "`failed_builds`.`log_file` " . "FROM `failed_builds` " . - "WHERE `failed_builds`.`build_assignment`=".$row["id"] + "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 . + ", " . + $reason . + ""; + } else { + $to_print= $to_print . ", " . $reason; + } + } + $rows[$count]["fail_reasons"]=substr($to_print,2); + } else { + $rows[$count]["fail_reasons"]=" "; + } $rows[$count]["loops"] = $row["loops"]; $rows[$count]["pkgbase"] = $row["pkgbase"]; @@ -81,7 +118,10 @@ if ($result -> num_rows > 0) { $rows[$count]["git_revision"] = $rows[$count]["git_revision"] . "x86_64"; $rows[$count]["git_revision"] = - $rows[$count]["git_revision"] . "/\">" . + $rows[$count]["git_revision"] . "?id=" . + $row["git_revision"]; + $rows[$count]["git_revision"] = + $rows[$count]["git_revision"] . "\">" . $row["git_revision"] . ""; } else $rows[$count]["git_revision"] = $row["git_revision"]; @@ -133,6 +173,7 @@ if ($result -> num_rows > 0) { print "package repository"; print "compilations"; print "loops"; + print "build error"; print "blocked"; print "\n"; @@ -140,12 +181,13 @@ if ($result -> num_rows > 0) { print ""; - print "".$row["pkgbase_print"].""; + print "".$row["pkgbase_print"].""; print "

".$row["git_revision"]."

"; print "

".$row["mod_git_revision"]."

"; print "".$row["package_repository"].""; print "".$row["trials"].""; print "".$row["loops"].""; + print "".$row["fail_reasons"].""; print "".$row["is_blocked"].""; print "\n"; -- cgit v1.2.3-54-g00ecf