summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Savoye <rob.savoye@linaro.org>2014-12-09 12:04:17 -0700
committerRob Savoye <rob.savoye@linaro.org>2014-12-09 12:04:17 -0700
commit88498c4bfa915a1261a44326f6371cf349f0e03e (patch)
tree454da3c9ce3d28f40b7a6f4ac1e7e860dbc3205c
parent25a153977c58e5f7befbf65d657d02db3b76fa14 (diff)
heavily refactor to use functions from diff.php
-rw-r--r--index.php228
1 files changed, 94 insertions, 134 deletions
diff --git a/index.php b/index.php
index ed9ac1f..24b5aae 100644
--- a/index.php
+++ b/index.php
@@ -19,7 +19,7 @@ session_start();
include "support.php";
//include "xml.php";
-include "diff.php";
+//include "diff.php";
?>
@@ -29,33 +29,26 @@ include "diff.php";
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="TCWG Validation">
<title>TCWG Validation</title>
-</head>
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></meta>
+ <link rel="stylesheet" href="layersmenu-demo.css" type="text/css"></link>
+ <link rel="stylesheet" href="layerstreemenu.css" type="text/css"></link>
+ <style type="text/css">
+ <!--
+ @import url("layerstreemenu-hidden.css");
+//-->
+ </style>
+ <link rel="shortcut icon" href="LOGOS/shortcut_icon_phplm.png"></link>
+ <script language="JavaScript" type="text/javascript">
+ <!--
+<?php require_once 'libjs/layersmenu-browser_detection.js'; ?>
+// -->
+ </script>
+ <script language="JavaScript" type="text/javascript" src="libjs/layerstreemenu-cookies.js"></script>
+ </head>
<body>
<?php
-// echo "<p>This is so I can easily see if it's working at all</p>";
-
-function get_xml_files($dir)
-{
-
- $array = array();
-
- if ($handle = opendir($dir)) {
- while (false !== ($entry = readdir($handle))) {
- $len = strlen($entry);
- $suffix = substr($entry, $len-4, $len);
- if ($entry != "." && $entry != ".." && $suffix == ".xml") {
-// echo "$len - $entry<br>";
- $array[] = "$dir/$entry";
- }
- }
- closedir($handle);
- }
-
- return $array;
-}
-
# A build directory looks like this: x86_64.aarch64-linux-gnu-BuildFarm488
function parse_build_dir ($dir)
{
@@ -71,130 +64,97 @@ function parse_build_dir ($dir)
return $array;
}
-function selectmenu()
-{
- echo "<form action=test.php?foo method=POST>";
- echo "<div align=center>";
- echo "<select name=select-test>";
-
- for ($i=0; $i<count($dirs); $i++) {
- echo "$dirs[$i]<br>";
- echo "<option>$dirs[$i]</option>";
- $files = get_xml_files($dirs[$i]);
- for ($j=0; $j<count($files); $j++) {
- echo "<option>$files[$j]</option>";
- }
-// var_dump($files);
- }
-
- echo "</select>";
- echo "</div>";
-//echo "</form>";
-}
-
// FIXME: for now, all files are accessible via the normal documentation root
// for the web server.
$docroot = $_SERVER["DOCUMENT_ROOT"];
$dir = "${docroot}abe/logs";
-// var_dump(is_dir($dir));
-
-// Should return something like this: /var/www/abe/logs/gcc-linaro-5.0.0
-$topdir = glob($dir . '/*' , GLOB_ONLYDIR)[0];
-//print_r($topdir);
-$revdirs = glob($topdir . '/*' , GLOB_ONLYDIR);
-//var_dump($revdirs);
-
-for ($i=0; $i<count($revdirs); $i++) {
-// echo "$revdirs[$i]<br>";
- $archdirs = glob($revdirs[$i] . '/*' , GLOB_ONLYDIR);
- for ($j=0; $j<count($archdirs); $j++) {
-// echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$archdirs[$i]<br>";
- $dir = basename($archdirs[$i]);
- $files[$dir] = get_xml_files($archdirs[$i]);
-// var_dump($files);
-// print_r($files);
-// echo "<p>";
+
+$foodir = new DirectoryIterator($dir);
+$files = new RegexIterator($foodir, '/^gcc-linaro-[0-9].[0-9].[0-9]/');
+foreach($files as $file) {
+ if ($file->isDot()) {
+ continue;
}
-// echo "<p>";
+// echo "file = " . $file->getPathName() . "<br>";
+ $topdirs[] = $file->getPathName();
+ $foodir2 = new DirectoryIterator($file->getPathName());
+ foreach($foodir2 as $file2) {
+ if ($file2->isDot()) {
+ continue;
+ }
+// echo "file 2 = " . $file2->getPathName() . "<br>";
+ $foodir3 = new DirectoryIterator($file2->getPathName());
+ $revdirs[$file->getPathName()][] = $file2->getPathName();
+
+ foreach($foodir3 as $file3) {
+// echo $file3->getPathName() . "<br>";
+ if ($file3->isDot()) {
+ continue;
+ }
+ $foodir4 = new DirectoryIterator($file3->getPathName());
+ $files4 = new RegexIterator($foodir4, '/.*sum*/');
+ $archdirs[$file2->getPathName()][] = $file3->getPathName();
+ foreach($files4 as $file4) {
+// echo "file4 = " . $file4->getPathName() . "<br>";
+ $sums[$file3->getPathName()][] = $file4->getPathName();
+ }
+ sort($sums[$file3->getPathName()]);
+ }
+ }
+ sort($topdirs);
}
-$build = parse_build_dir("x86_64.aarch64-linux-gnu-BuildFarm488");
-//var_dump($build);
-
-$dir1 = "/var/www/abe/logs/gcc-linaro-5.0.0/gcc.git-02c7697d8819ada4bafbf2fb85b78cd8873c94e8/x86_64.armeb-linux-gnueabihf-BuildFarm486/libstdc++.sum";
-$dir2 = "/var/www/abe/logs/gcc-linaro-5.0.0/gcc.git-02C7697D8819ADA4BAFBF2FB85B78CD8873C94E8/x86_64.aarch64-linux-gnu-BuildFarm488/libstdc++.sum";
-
-// Print the header main header
-$tool = basename($dir1, ".sum");
-echo "<h1 align=center>Comparing Test results for $tool</h1>";
-
-// Extract the differences
-$unresolved = difftwofiles("UNRESOLVED", $dir1, $dir2);
-$untested = difftwofiles("UNTESTED", $dir1, $dir2);
-$xfailures = difftwofiles("XFAIL", $dir1, $dir2);
-$xpasses = difftwofiles("XPASS", $dir1, $dir2);
-$failures = difftwofiles("FAIL", $dir1, $dir2);
-//$unsupported = difftwofiles("UNSUPPORTED", $dir1, $dir2);
-
-# Display the total number of Changes
-$output = "";
-if ($unresolved[FIRSTFILE] > 0 || $unresolved[SECONDFILE] > 0) {
- echo "$unresolved[KEYWORD] $unresolved[FIRSTFILE] $unresolved[SECONDFILE]<br>";
- $output .= "$unresolved[OUTPUT]<p>";
-}
-if ($xfailures[FIRSTFILE] > 0 || $xfailures[SECONDFILE] > 0) {
- echo "$xfailures[KEYWORD] $xfailures[FIRSTFILE] $xfailures[SECONDFILE]<br>";
- $output .= "$xfailures[OUTPUT]<p>";
-}
-if ($failures[FIRSTFILE] > 0 || $xfailures[SECONDFILE] > 0) {
- echo "$failures[KEYWORD] $failures[FIRSTFILE] $xfailures[SECONDFILE]<br>";
- $output .= "$failures[OUTPUT]<p>";
-}
-if ($passes[FIRSTFILE] > 0 || $passes[SECONDFILE] > 0) {
- echo "$passes[KEYWORD] $passes[FIRSTFILE] $passes[SECONDFILE]<br>";
- $output .= "$passes[OUTPUT]<p>";
-}
-if ($xpasses[FIRSTFILE] > 0 || $xpasses[SECONDFILE] > 0) {
- echo "$xpasses[KEYWORD] $xpasses[FIRSTFILE] $xpasses[SECONDFILE]<br>";
- $output .= "$xpasses[OUTPUT]<p>";
-}
-if ($untested[FIRSTFILE] > 0 || $untested[SECONDFILE] > 0) {
- echo "$untested[KEYWORD] $untested[FIRSTFILE] $untested[SECONDFILE]<br>";
- $output .= "untested[OUTPUT]<p>";
+echo "<hr>";
+
+// HTML doesn't have real tabs, but sometimes we need a lazy way to indent
+// a line.
+$tab = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
+
+foreach ($topdirs as $dir) {
+ $menutxt[] = ".|" . basename($dir) . "|||||1\n";
+ foreach ($revdirs[$dir] as $rev) {
+ $man[$rev] = new SplFileObject($archdirs[$rev][0] . '/manifest.txt');
+ foreach ($man[$rev] as $line => $content) {
+ if (strpos($content, "commit ") !== false) {
+ $commit[$rev] = $tab . strstr(rtrim($content), 'Author');
+ // Word wrap so it's readable.
+ $commit[$rev] = wordwrap($commit[$rev], 150, "<br>" . $tab);
+ // Truncate cause sometimes the commit message is huge!
+ $commit[$rev] = substr($commit[$rev], 0, 500);
+ break;
+ }
+ }
+ $menutxt[] = "..|" . basename($rev) . "<br>" . $commit[$rev] . "|||||2\n";
+ foreach ($archdirs[$rev] as $arch) {
+ $menutxt[] = "...|" . basename($arch) . "|||||2\n";
+ foreach ($sums[$arch] as $sum) {
+ $build = parse_build_dir($arch);
+ $input = "<input type='radio' name=$build[JOB] value=$sum>";
+ $menutxt[] = "....|" . $input . basename($sum) . "|||||2\n";
+ }
+ }
+ }
}
+echo "<hr>";
-//dodiff();
-
-$dir1 = "/var/www/abe/logs/gcc-linaro-5.0.0/gcc.git-02c7697d8819ada4bafbf2fb85b78cd8873c94e8/x86_64.armeb-linux-gnueabihf-BuildFarm486/libstdc++.log";
-$dir2 = "/var/www/abe/logs/gcc-linaro-5.0.0/gcc.git-02C7697D8819ADA4BAFBF2FB85B78CD8873C94E8/x86_64.aarch64-linux-gnu-BuildFarm488/libstdc++.log";
+echo "<form action='diff.php'>";
-// $fulldiff = array_merge($unresolved[PATTERN], $untested[PATTERN], $xpasses[PATTERN], $xfailures[PATTERN]);
-// $file = new SplFileObject("$dir1");
-// foreach ($fulldiff as $pattern) {
-// foreach ($file as $line => $content) {
-// if (strpos($content, $pattern) !== false) {
-// echo "LINENO = $line: $pattern<br>";
-// // echo "$content<br>";
-// // $file->seek($line);
-// // break;
-// }
-// }
-// }
+require_once 'lib/PHPLIB.php';
+require_once 'lib/layersmenu-common.inc.php';
+require_once 'lib/treemenu.inc.php';
+$mid = new TreeMenu();
+$mid->setMenuStructureString(implode("",$menutxt));
+$mid->setIconsize(16, 16);
+$mid->parseStructureForMenu('treemenu1');
+$mid->setSelectedItemByUrl('treemenu1', basename(__FILE__));
+print $mid->newTreeMenu('treemenu1');
-// echo "<a href=diff.php target=_blank>link text</a> ";
+echo "<p><p><input type='submit' value='Diff Sum files'>";
-
-echo "$output";
-
-echo "<hr><br>";
-echo "FIXME: $build[BUILD]<br>";
-echo "FIXME: $build[TARGET]<br>";
-echo "FIXME: $build[JOB]<br>";
+echo "</form>";
?>
-<hr>
-
</body>
</html>
- \ No newline at end of file
+