]> git.pld-linux.org Git - projects/pld-ftp-admin.git/blob - html/qa.php
61c014d6b7b322e4b08d6294bc512ff1261d4b3d
[projects/pld-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         echo "Select report:";
63         echo "<select id=q name=q>\n";
64         foreach ($reports as $q => $title) {
65                 printf("<option value=%s %s>%s</option>\n", $q, $q == $report ? 'selected' :'',  $title);
66         }
67         echo "</select>\n";
68 }
69
70 /**
71  * Create text input for filtering results
72  */
73 function filter_box() {
74         echo '<br>Filter results: <input id="filter">';
75         echo '<br><span id="count">?</span> errors';
76 }
77
78 function format_report($report) {
79         echo "<br>View the <a href=$report.txt>raw</a> report<br/>\n";
80         $file = "$report.txt";
81         $giturl = 'http://git.pld-linux.org/gitweb.cgi?p=packages/%1$s.git;f=%1$s.spec;h=HEAD;a=shortlog';
82         echo '<ol id="lines">';
83         foreach (file($file) as $line) {
84                 $line = preg_replace_callback('/^(?P<prefix>error:|GIT:)\s*\[(?P<spec>[^]]+)\]\s*(?P<msg>.+)$/', function($m) use ($giturl) {
85                         $package = basename($m['spec'], '.spec');
86                         $url = sprintf($giturl, $package);
87                         return sprintf('<li><font color=red>%s</font> [<a href="%s">%s</a>] %s', $m['prefix'], $url, $m['spec'], $m['msg']);
88                 }, $line);
89                 echo $line, "<br/>\n";
90         }
91         echo '</ol>';
92 }
93
94 reports_selection($reports);
95 filter_box();
96 if (isset($reports[$report])) {
97         format_report($report);
98 }
99
100 ?>
101 </body>
102 </html>
This page took 0.041753 seconds and 2 git commands to generate.