]> TLD Linux GIT Repositories - tld-ftp-admin.git/blob - html/qa.php
- raw from PLD
[tld-ftp-admin.git] / html / qa.php
1 <html>
2 <head>
3 <link rel="Shortcut Icon" href="//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="//srcbuilder.pld-linux.org/th/style.css">
6         <style>
7         .hidden { display: none; }
8         span#count { font-weight: bold; }
9         </style>
10 </head>
11 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
12 <script>
13 jQuery(function($) {
14         $('#q').on('change', function(e) {
15                 var el = e.target;
16                 var o = el.options;
17                 var v = o[o.selectedIndex].value;
18                 location.href = "?q=" + v;
19         });
20
21         var $lines = $('#lines>li');
22         var $count = $('#count');
23         $('#filter').on('keyup', function() {
24                 var search = $(this).val();
25                 var count = 0;
26                 $lines.each(function() {
27                         var $line = $(this);
28                         var text = $line.text();
29                         var fn = text.match(search) && ++count ? 'removeClass' : 'addClass';
30                         $line[fn]('hidden');
31                 });
32                 $count.html(count);
33         });
34         $count.html($lines.length);
35 });
36 </script>
37 <body>
38 <?php
39
40 $report = isset($_GET['q']) ? basename($_GET['q']) : null;
41 $reports = array(
42         "main" => "Main deps x86_64",
43         "main-ready" => "Main ready deps x86_64",
44         "main-ready-test" => "Main+ready+test deps x86_64",
45
46         "main-i686" => "Main deps i686",
47         "main-ready-i686" => "Main ready deps i686",
48         "main-ready-test-i686" => "Main+ready+test deps i686",
49
50         "main-x32" => "Main deps x32",
51         "main-ready-x32" => "Main ready deps x32",
52         "main-ready-test-x32" => "Main+ready+test deps x32",
53
54         "freshness" => "GIT vs FTP freshness",
55
56         "lint-PLD" => "rpmlint: main",
57         "lint-test" => "rpmlint: test",
58         "lint-ready" => "rpmlint: ready",
59 );
60
61 function reports_selection($reports) {
62         global $report;
63         echo "Select report:";
64         echo "<select id=q name=q>\n";
65         foreach ($reports as $q => $title) {
66                 printf("<option value=%s %s>%s</option>\n", $q, $q == $report ? 'selected' :'',  $title);
67         }
68         echo "</select>\n";
69 }
70
71 /**
72  * Create text input for filtering results
73  */
74 function filter_box() {
75         echo '<br>Filter results: <input id="filter">';
76         echo '<br><span id="count">?</span> errors';
77 }
78
79 function format_report($report) {
80         echo "<br>View the <a href=$report.txt>raw</a> report<br/>\n";
81         $file = "$report.txt";
82         $giturl = 'http://git.pld-linux.org/gitweb.cgi?p=packages/%1$s.git;f=%1$s.spec;h=HEAD;a=shortlog';
83         echo '<ol id="lines">';
84         foreach (file($file) as $line) {
85                 $line = preg_replace_callback('/^(?P<prefix>error:|GIT:)\s*\[(?P<spec>[^]]+)\]\s*(?P<msg>.+)$/', function($m) use ($giturl) {
86                         $package = basename($m['spec'], '.spec');
87                         $url = sprintf($giturl, $package);
88                         return sprintf('<li><font color=red>%s</font> [<a href="%s">%s</a>] %s', $m['prefix'], $url, $m['spec'], $m['msg']);
89                 }, $line);
90                 echo $line, "<br/>\n";
91         }
92         echo '</ol>';
93 }
94
95 reports_selection($reports);
96 filter_box();
97 if (isset($reports[$report])) {
98         format_report($report);
99 }
100
101 ?>
102 </body>
103 </html>