]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blob - html/qa.php
- colorize and link to gitweb
[projects/pld-ftp-admin.git] / html / qa.php
1 <html>
2 <head>
3 <link rel="Shortcut Icon" href="http://www.pld-linux.org/favicon.ico"/>
4         <title>PLD QA Reports</title>
5         <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="http://src.th.pld-linux.org/style.css">
6 </head>
7 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
8 <script>
9 jQuery(function($) {
10         $('#q').on('change', function(e) {
11                 var el = e.target;
12                 var o = el.options;
13                 var v = o[o.selectedIndex].value;
14                 location.href = "?q=" + v;
15         });
16 });
17 </script>
18 <body>
19 <?php
20
21 $report = isset($_GET['q']) ? basename($_GET['q']) : null;
22 $reports = array(
23         "main" => "Main deps x86_64",
24         "main-ready" => "Main ready deps x86_64",
25         "main-ready-test" => "Main+ready+test deps x86_64",
26
27         "main-i686" => "Main deps i686",
28         "main-ready-i686" => "Main ready deps i686",
29         "main-ready-test-i686" => "Main+ready+test deps i686",
30
31         "main-i486" => "Main deps i486",
32         "main-ready-i486" => "Main ready deps i486",
33         "main-ready-test-i486" => "Main+ready+test deps i486",
34 );
35
36 echo "Select report:";
37 echo "<select id=q name=q>\n";
38 foreach ($reports as $q => $title) {
39         printf("<option value=%s %s>%s</option>\n", $q, $q == $report ? 'selected' :'',  $title);
40 }
41 echo "</select><br/>\n";
42
43 if (isset($reports[$report])) {
44         $file = "$report.txt";
45         $giturl = 'http://git.pld-linux.org/gitweb.cgi?p=packages/%1$s.git;f=%1$s.spec;h=HEAD;a=shortlog';
46         foreach (file($file) as $line) {
47                 $line = preg_replace_callback('/^(?P<prefix>error:)\s*\[(?P<spec>[^]]+)\]\s*(?P<msg>.+)$/', function($m) use ($giturl) {
48                         $package = basename($m['spec'], '.spec');
49                         $url = sprintf($giturl, $package);
50                         return sprintf('<font color=red>%s</font> [<a href="%s">%s</a>] %s', $m['prefix'], $url, $m['spec'], $m['msg']);
51                 }, $line);
52                 echo $line, "<br/>\n";
53         }
54 }
55
56 ?>
57 </body>
58 </html>
This page took 0.035929 seconds and 4 git commands to generate.