/[qa]/trunk/wml/developer.wml
ViewVC logotype

Contents of /trunk/wml/developer.wml

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1107 - (show annotations) (download)
Sun Oct 30 22:36:27 2005 UTC (7 years, 6 months ago) by myon
File size: 60411 byte(s)
s/additional/url/
1 <?
2 # keep the header in php generated file
3 <protect>/*
4 +-------------------------------------------------------------------------+
5 | Copyright (C) 2002 Igor Genibel |
6 | |
7 | This program is free software; you can redistribute it and/or |
8 | modify it under the terms of the GNU General Public License |
9 | as published by the Free Software Foundation; either version 2 |
10 | of the License, or (at your option) any later version. |
11 | |
12 | This program is distributed in the hope that it will be useful, |
13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
15 | GNU General Public License for more details. |
16 +-------------------------------------------------------------------------+
17 | This code is currently maintained and debugged by Igor Genibel, any |
18 | questions or comments regarding this code should be directed to: |
19 | - igor@genibel.org |
20 +-------------------------------------------------------------------------+
21 | - Igor Genibel - http://genibel.org/ |
22 | $Id$
23 +-------------------------------------------------------------------------+
24
25 */</protect>
26 header('Content-Type: text/html; charset="utf-8"');
27 header('Content-Script-Type: text/javascript');
28 header('Content-Style-Type: text/css');
29 header('Pragma: no-cache');
30
31 // global variables
32 $arg_cookie = array();
33 $prefix="/org/qa.debian.org/data/ddpo/results";
34 $counter_span = 0;
35 $already_displayed = false;
36 $no_packages = false;
37
38 error_reporting(0);
39 $time = microtime();
40
41 $branch = array ("main",
42 "contrib",
43 "non-free",
44 "non-US/main",
45 "non-US/contrib",
46 "non-US/non-free" );
47
48 setlocale(LC_ALL, 'fr_FR');
49 setlocale(LC_TIME, 'C');
50 setlocale(LC_NUMERIC, 'C');
51
52 /* pick up cookies information or generate default one */
53 if (!empty($_COOKIE['columnsinfo']) and ($_GET['reset'] != 'yes'))
54 {
55 $tmp = $_COOKIE['columnsinfo'];
56 $arg_cookie = unserialize(base64_decode($tmp));
57 }else{
58 $arg_cookie = array ( bugs => 1,
59 version => 1,
60 excuses => 1,
61 watch => 1,
62 bin => 1,
63 buildd => 1,
64 security => 1,
65 problems => 1,
66 section => 1,
67 priority => 1,
68 pool => 1,
69 uninstallable => 1);
70 }
71 /* always set cookie with that values in order to keep it 3 months old since the last visit */
72 setcookie('columnsinfo', base64_encode(serialize($arg_cookie)), strtotime('+3 month'));
73
74
75 /* if the "reset" arg is passed, need to extract action parameter in order to store the
76 value into the new cookie */
77 if($_GET['reset'] != 'yes')
78 {
79 foreach(array_keys($_GET) as $key)
80 {
81 if (($key == 'comaint') or ($key == 'login') or ($key == 'package') or ($key == 'wnpp') or ($key == 'gpg_key') or ($key == 'popcon'))
82 {
83 continue;
84 }else{
85 $arg_cookie[$key] = $_GET[$key];
86 }
87 }
88 if ($_GET['set'] == 'yes') setcookie('columnsinfo', base64_encode(serialize($arg_cookie)), strtotime('+3 month'));
89 }
90
91 ?>
92
93
94 #use wml::templ::template title="Debian Developer's Packages Overview" author="Igor Genibel"
95
96 {#style#:
97 <style type="text/css">
98 a.dash:link,a.dash:visited,a.dash:active {text-decoration: none;}
99 .general {color:black}
100 .span_general { text-align:left;
101 cursor:pointer;
102 border-bottom-style:dashed;
103 border-width:thin}
104 h3 { font-family: Arial, Helvetica, sans-serif;
105 margin-left:10px }
106 </style>
107 :##}
108
109 {#script#:
110 <script type="text/javascript" language="JavaScript">
111 function objectOver(x){
112 x.style.color="blue";
113 }
114 function objectOut(x){
115 x.style.color="black";
116 }
117 function collapse(x, txt){
118 var oTemp=document.getElementById("text_"+x) ;
119 var oClick=document.getElementById("click_"+x);
120
121 if(oTemp.style.display=="block"){
122 oTemp.style.display="none";
123 oClick.innerHTML=txt+"&nbsp<small>(click to expand)<\/small><br>";
124 }
125 else{
126 oTemp.style.display="block";
127 oClick.innerHTML=txt+"&nbsp<small>(click to collapse)<\/small><br>";
128 }
129 }
130 </script>
131 :##}
132
133 <?
134
135
136 /* Used to return a file line while I didn't find such a function
137 in php
138 Args:
139 $fp: opened file
140 return:
141 String: line
142 */
143 function freadline($fp)
144 {
145 $line = "";
146 do
147 {
148 $line .= fgets($fp, "10240");
149 }
150 while($line != "" && $line[strlen($line)-1] != "\n");
151 return $line;
152 }
153
154
155 /*
156 All generated page are html 4.0 and css1 compliant
157 Action:
158 print the links to w3c
159 */
160 function print_validator()
161 {
162 print '<p><a href="http://jigsaw.w3.org/css-validator/validator/?uri=qa.debian.org/developer.php"><img style="border:0;width:88px;height:31px" src="http://jigsaw.w3.org/css-validator/images/vcss" alt="Valid CSS!"></a>
163 <a href="http://validator.w3.org/check?uri=referer"><img border="0" src="http://www.w3.org/Icons/valid-html40" alt="Valid HTML 4.0!" height="31" width="88"></a></p>';
164 }
165
166
167 /*
168 Print the footer information such as page generating time.
169 */
170 function print_footer()
171 {
172 global $time;
173 global $prefix;
174 $fp = fopen("$prefix/extract.date", "r");
175 $general = freadline($fp, "512");
176 fclose($fp);
177 $fp = fopen("$prefix/bugs.date", "r");
178 $bugs = freadline($fp, "512");
179 fclose($fp);
180
181 $footer .= "General information: $general (updated once per day)" . html_br();
182 $footer .= "Bug information: $bugs (updated every 15 minutes)" . html_br();
183 list($micro,$sec) = explode(' ', microtime());
184 list($smicro,$ssec) = explode(' ', $time);
185 $footer .= sprintf("Time needed to generate page: %.2fs", $sec-$ssec+$micro-$smicro);
186
187 print html_p(html_small($footer));
188 print html_hr(). print_validator();
189 }
190
191 /*
192 form function
193 Args:
194 $method: "GET" "POST"
195 $preamble: inner form data not considered as visible
196 parameters
197 $data: visible parameters
198 $name: submit button name
199 Returns:
200 an valid html form
201 */
202 function html_form($method, $preamble, $fields, $name)
203 {
204 $form = "<form method=\"$method\" action=\"developer.php\">";
205 $form .= $preamble;
206 $form .= $fields;
207 $form .= html_input_submit($name);
208 $form .= "</form>\n";
209 return $form;
210 }
211
212 /*
213 label function
214 Args:
215 $text: text to be labelized
216 Return:
217 labelized text
218 */
219 function html_label($text)
220 {
221 return "<label>$text</label>\n";
222 }
223
224 /*
225 submit button function
226 Args:
227 $name: submit button name
228 Returns:
229 a valid html submit button
230 */
231 function html_input_submit($name)
232 {
233 return "<input type=\"submit\" value=\"$name\">\n";
234 }
235
236 /*
237 text field unction
238 Args:
239 $name: the text field name
240 Returns:
241 a valid html text field
242 */
243 function html_input_text($name)
244 {
245 return "<input type=\"text\" size=\"30\" maxlength=\"40\" name=\"$name\">\n";
246 }
247
248 /*
249 hidden field unction
250 Args:
251 $name: the hidden field name
252 $value: hidden field value
253 Returns:
254 a valid html hidden field
255 */
256 function html_input_hidden($name,$value)
257 {
258 return "<input type=\"hidden\" name=\"$name\" value=\"$value\">\n";
259 }
260
261 /*
262 radio button function
263 Args:
264 $name: the radio button field name
265 $value: radio button field value
266 $checked: boolean
267 $text: text to explain the radio button
268 Returns:
269 a valid html radio button
270 */
271 function html_input_radio($name,$value,$checked,$text)
272 {
273 $data = "<input type=\"radio\" name=\"$name\" value=\"$value\"";
274 if($checked) $data .= " checked";
275 $data .= ">$text";
276 return "$data\n";
277 }
278
279 /*
280 table header element
281 Args:
282 $title: header text
283 $extra: th args (align, ...)
284 $rowspan: how many rows in the table the header covers
285 $colspan: how many cols in the table the header covers
286 Returns:
287 A valid table header element
288 */
289 function html_th($title, $extra, $rowspan, $colspan)
290 {
291 if($colspan == "") $colspan = 1;
292 if($rowspan == "") $rowspan = 1;
293 if ($extra != "")
294 {
295 return "<th rowspan=\"$rowspan\" colspan=\"$colspan\">" . html_small_color("$title ", "green") . html_small_color("($extra)", "black") . "</th>\n";
296 }else{
297 return "<th rowspan=\"$rowspan\" colspan=\"$colspan\">" . html_small_color($title, "green") . "</th>\n";
298 }
299 }
300
301 /*
302 table element
303 Args:
304 $data: text element
305 $width: width in %
306 $rowspan: how many rows in the table the element covers
307 $colspan: how many cols in the table the element covers
308 Returns:
309 A valid table element
310 */
311 function html_td($data, $width, $colspan, $rowspan)
312 {
313 if($colspan == "") $colspan = 1;
314 if($rowspan == "") $rowspan = 1;
315 if($width == "")
316 {
317 return "<td rowspan=\"$rowspan\" colspan=\"$colspan\">$data</td>\n";
318 }else{
319 return "<td width=\"$width\" rowspan=\"$rowspan\" colspan=\"$colspan\">$data</td>";
320 }
321 }
322
323 /*
324 table line
325 Args:
326 $data: all tds
327 $align: center, left, right
328 $bgcolor: background color
329 Returns:
330 A valid table line
331 */
332 function html_tr($data, $align, $bgcolor)
333 {
334 if($align == "") $align = "center";
335 if($bgcolor == "")
336 {
337 return "<tr align=\"$align\">$data</tr>\n";
338 }else{
339 return "<tr align=\"$align\" bgcolor=\"$bgcolor\">$data</tr>\n";
340 }
341 }
342
343 /*
344 table
345 Args:
346 $header: all table headers (a tr)
347 $data: array of data lines
348 $width: table width in %
349 Returns:
350 A valid html table
351 */
352 function html_table($header, $data, $width)
353 {
354 if($width == "") $width = 100;
355 $table = "<table width=\"${width}%\" border=\"1\" cellpadding=\"3\" cellspacing=\"1\" summary=\"\">";
356 $table .= $header ;
357 foreach ($data as $line) $table .= $line;
358 return "$table\n</table>\n";
359 }
360
361 /*
362 Html Anchor
363 Args:
364 $text: anchor text
365 $link: anchor link
366 $class: anchor class
367 $title: info bullet text
368 Returns:
369 A valid html anchor
370 */
371 function html_a($text,$link,$class, $title)
372 {
373 if($title != "") $title = " title=\"$title\"";
374 if($class != "")
375 {
376 return "<a class=\"$class\" href=\"$link\"$title>$text</a>";
377 }else{
378 return "<a href=\"$link\"$title>$text</a>";
379 }
380 }
381
382 /*
383 Html headers
384 Args:
385 $text: header text
386 $level: header level
387 $align: header align
388 Returns:
389 A valid html header
390 */
391 function html_h($text, $level, $align)
392 {
393 if ($align == "")
394 {
395 return "<h$level>$text</h$level>\n";
396 }else{
397 return "<h$level align=\"$align\">$text</h$level>\n";
398 }
399 }
400
401 /* The following function are basic html functions (from html_tt to html_span */
402 function html_tt($text)
403 {
404 return "<tt>$text</tt>";
405 }
406
407 function html_b($text)
408 {
409 return "<b>$text</b>";
410 }
411
412 function html_u($text)
413 {
414 return "<u>$text</u>";
415 }
416
417 function html_em($text)
418 {
419 return "<em>$text</em>";
420 }
421
422 function html_p($text)
423 {
424 return "<p>$text</p>";
425 }
426
427
428 function html_blank()
429 {
430 return "&nbsp;";
431 }
432
433 function html_br()
434 {
435 return "<br>\n";
436 }
437
438 function html_hr()
439 {
440 return "<hr>\n";
441 }
442
443 function html_small($text)
444 {
445 return "<small>$text</small>";
446 }
447
448 function html_font($text, $data)
449 {
450 return "<font $data>$text</font>";
451 }
452
453 function html_color($text, $color)
454 {
455 return "<font color=\"$color\">$text</font>";
456 }
457
458 function html_small_color($text,$color)
459 {
460 return html_small(html_color($text, $color));
461 }
462
463 function html_div($text,$id,$class,$extra)
464 {
465 if($class != "")
466 {
467 return "<div id=\"$id\" class=\"$class\" $extra>$text</div>\n";
468 }else{
469 return "<div id=\"$id\" $extra>$text</div>\n";
470 }
471 }
472
473 function html_span($text,$id,$class,$extra)
474 {
475 if($id != "") $id = "id=\"$id\"";
476 if($class != "")
477 {
478 return "<span $id class=\"$class\" $extra>$text</span>\n";
479 }else{
480 return "<span $id $extra>$text</span>\n";
481 }
482 }
483
484 function html_ul($text)
485 {
486 return "<ul>$text</ul>";
487 }
488
489 function html_li($text)
490 {
491 return "<li>$text</li>";
492 }
493
494 function html_wrap2lines($text)
495 {
496 $list = explode(",", $text);
497 if(count($list) < 2)
498 {
499 return $text;
500 }
501 $half = (int)(count($list)/2);
502 return implode(html_blank(), array_slice($list, 0, $half)) . " " .
503 implode(html_blank(), array_slice($list, $half));
504 }
505
506
507 /*
508 This funtion is used to provide the collapsable areas and their title
509 You need to use an auto incremented number in order not to have collisions
510 when expand/collapse an area
511 You need to have a css style class named span_<something>
512 This function return a html valid block
513 */
514 function html_collexp($number, $text, $class, $collapsed, $data)
515 {
516 if($collapsed)
517 {
518 $info = html_blank() . "(click to expand)";
519 $display = "none";
520 }else{
521 $info = html_blank() . "(click to collapse)";
522 $display = "block";
523 }
524 $result = html_span($text . html_small("$info") . html_br(),"click_$number", "span_$class", "onmouseover='javascript:objectOver(this)' onmouseout='javascript:objectOut(this)' onclick='javascript:collapse($number,\"$text\")'");
525 $result .= html_div($data, "text_$number", $class, "style='margin-left:0;display:$display'") ;
526 return $result;
527 }
528
529 /*
530 Function needed to know if the columns has to be displayed or not
531 */
532 function isdisplayed($value)
533 {
534 global $arg_cookie;
535 return $arg_cookie[$value];
536 }
537
538 /*
539 This function is used for the display settings table
540 Note that there is a exception with bugs
541 */
542 function checkbox($value)
543 {
544 global $arg_cookie;
545 if($arg_cookie[$value] == 1)
546 {
547 $data = html_input_radio($value,1,true,"Show\n") . html_br();
548 $data .= html_input_radio($value,0,false,"Hide") . html_br();
549 }else{
550 $data = html_input_radio($value,1,false,"Show\n") . html_br();
551 $data .= html_input_radio($value,0,true,"Hide") . html_br();
552 }
553 /* if($value == 'version')
554 {
555 if($arg_cookie[$value] == 2)
556 {
557 $data = html_input_radio($value,1,false,"Show\n") . html_br();
558 $data .= html_input_radio($value,0,false,"Hide\n") . html_br();
559 $data .= html_input_radio($value,2,true,"Without Exp. &amp; Prop. Upt.\n") . html_br();
560 }elseif($arg_cookie[$value] == 1)
561 {
562 $data = html_input_radio($value,1,true,"Show\n") . html_br();
563 $data .= html_input_radio($value,0,false,"Hide\n") . html_br();
564 $data .= html_input_radio($value,2,false,"Without Exp. &amp; Prop. Upt.\n") . html_br();
565 }else{
566 $data = html_input_radio($value,1,false,"Show\n") . html_br();
567 $data .= html_input_radio($value,0,true,"Hide\n") . html_br();
568 $data .= html_input_radio($value,2,false,"Without Exp. &amp; Prop. Upt.\n") . html_br();
569 }
570 } */
571 if($value == 'bugs')
572 {
573 if($arg_cookie[$value] == 2)
574 {
575 $data = html_input_radio($value,1,false,"Show\n") . html_br();
576 $data .= html_input_radio($value,0,false,"Hide\n") . html_br();
577 $data .= html_input_radio($value,2,true,"Sum.\n") . html_br();
578 $data .= html_input_radio($value,3,false,"Sum. &amp; RC\n") . html_br();
579 }elseif($arg_cookie[$value] == 3)
580 {
581 $data = html_input_radio($value,1,false,"Show\n") . html_br();
582 $data .= html_input_radio($value,0,false,"Hide\n") . html_br();
583 $data .= html_input_radio($value,2,false,"Sum.\n") . html_br();
584 $data .= html_input_radio($value,3,true,"Sum. &amp; RC\n") . html_br();
585 }elseif($arg_cookie[$value] == 1)
586 {
587 $data = html_input_radio($value,1,true,"Show\n") . html_br();
588 $data .= html_input_radio($value,0,false,"Hide\n") . html_br();
589 $data .= html_input_radio($value,2,false,"Sum.\n") . html_br();
590 $data .= html_input_radio($value,3,false,"Sum. &amp; RC\n") . html_br();
591 }else{
592 $data = html_input_radio($value,1,false,"Show\n") . html_br();
593 $data .= html_input_radio($value,0,true,"Hide\n") . html_br();
594 $data .= html_input_radio($value,2,false,"Sum.\n") . html_br();
595 $data .= html_input_radio($value,3,false,"Sum. &amp; RC\n") . html_br();
596 }
597 }
598 $data = html_small_color($data,"green");
599 return $data;
600 }
601
602
603 /*
604 return hidden fields with action parameters to be provided for the form validation
605 */
606 function setaction()
607 {
608 $action = "";
609 global $_GET;
610 foreach(array_keys($_GET) as $key)
611 {
612 if (($key == 'login') or ($key == 'package') or ($key == 'gpg_key') or ($key == 'comaint'))
613 {
614 $action .= html_input_hidden($key,$_GET[$key]);
615 }
616 }
617 return $action;
618 }
619
620
621 function process_wnpp_owner($name, $email)
622 {
623 $null = exec("ldapsearch -h bugs.debian.org -p 10101 -LLL -x -b dc=current,dc=bugs,dc=debian,dc=org '(&(debbugsOwner=*$email*)(debbugsState=open)(debbugsPackage=wnpp))' debbugsID debbugsTitle", $data, $ret);
624 if(($ret != 0) or (count($data) == 0)) return;
625 $display = "";
626 $temp = "";
627 $title = "";
628 print html_h("$name &lt;$email&gt; is owner:", 3);
629 foreach ($data as $elem)
630 {
631 if (strstr($elem, "debbugsID"))
632 {
633 $temp = str_replace("debbugsID: ", "", $elem);
634 }elseif(strstr($elem, "debbugsTitle"))
635 {
636 $title = str_replace("debbugsTitle: ", "", $elem);
637 }elseif(preg_match('/^\s(.+)$/', $elem, $matches))
638 {
639 $title .= $matches[1];
640 }elseif($elem == "")
641 {
642 $display .= html_li(html_a("#" . $temp . ": " . $title, "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=" . $temp));
643 $temp = "";
644 $title = "";
645 }
646 }
647 print html_ul($display);
648 }
649
650 /* These functions provides links to the bts for a maintainer */
651 function bugs_nonfixed($login)
652 {
653 return html_a("Non-fixed bugs, most recent first", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=maint&amp;data=". urlencode($login) . "&amp;archive=no&amp;raw=yes&amp;bug-rev=yes&amp;pend-exc=fixed&amp;pend-exc=done");
654 }
655
656 function bugs_all_related($login)
657 {
658 return html_a("All bugs related to &lt;$login&gt;", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?maint=". urlencode($login));
659 }
660
661 function bugs_rc($login)
662 {
663 return html_a("RC Bugs related to &lt;$login&gt;", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=maint&amp;data=" . urlencode($login) . "&amp;archive=no&amp;pend-exc=done&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious");
664 }
665
666 function bugs_submitter($login)
667 {
668 return html_a("All bugs submitted by &lt;$login&gt;", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?submitter=" . urlencode($login));
669 }
670
671 /* Functions used to construct the correct links in several fields (from bugs_display to stat_bug_link) */
672 function bugs_display($bug_number, $base_url)
673 {
674 $bug_link="";
675 preg_match("/(\d+)\((\d+)\)/", $bug_number, $result);
676 if (strcmp($result[1], $result[2]) == 0)
677 {
678 $bug_link = html_a($result[1], $base_url, "a");
679 }else{
680 $bug_link = html_a($result[1], "${base_url}&amp;repeatmerged=no", "a");
681 $bug_link .= html_blank() . html_color("(", "blue") . html_a($result[2], "${base_url}&amp;repeatmerged=yes", "a") . html_color(")", "blue");
682 }
683 return $bug_link;
684 }
685
686 function lintian_link($lintian)
687 {
688 return html_a("Lintian report", "http://lintian.debian.org/reports/m${lintian}.html");
689 }
690
691 function buildd_link($buildd, $login)
692 {
693 return html_a("Buildd report", "http://buildd.debian.org/bymaint.php?maint=$buildd") . html_blank() . html_a("Igloo's buildd report", "http://people.debian.org/~igloo/status.php?email=". urlencode($login));
694 }
695
696 function stat_bug_link($login)
697 {
698 return html_a("Bug statistics", "http://www.debian.gr.jp/~kitame/maint.cgi?num=srcs&amp;limit=0&amp;showpkgs=on&amp;maint=" . urlencode($login));
699 }
700
701 /* Function is used to display or not the extra features such as pocon, wnpp, and excuses */
702 function do_extra($data, $data_prefix, $error)
703 {
704 global $prefix;
705 $data = str_replace(" ", "+", $data);
706 $filepath = "$prefix/$data_prefix/" . $data{0} . "/$data";
707 if(file_exists($filepath))
708 {
709 require "$filepath";
710 }else{
711 print html_h($error, 2);
712 }
713 if($data_prefix == "excuses")
714 {
715 print html_br() . html_a("More excuses", "http://bjorn.haxx.se/debian/testing.pl?package=$data");
716 }
717 }
718
719
720 function printBackLink() {
721 print html_p(html_a("Back to main page", "developer.php", ""));
722 }
723
724 /* function used to display the main maintainer links in a collapsable area */
725 function print_header_entries_body($keys, $name, $comaint, $login)
726 {
727 global $counter_span;
728 global $prefix;
729 $add_comaint = "&amp;comaint=$comaint";
730 $lintian = preg_replace('/%../', "_", urlencode($name));
731 $lintian = preg_replace('/\+/', "_", $lintian);
732 $lintian = preg_replace('/-/', "_", $lintian);
733 $fp = fopen("$prefix/../../ftp/Maintainers", "r");
734 $ok = 0;
735 while(!feof($fp))
736 {
737 $line = freadline($fp, "10240");
738 if (preg_match("/$login/", $line))
739 {
740 $ok = 1;
741 $login = preg_replace('/\\\\/', '', $login);
742 if (preg_match("/$login \(/", $line))
743 {
744 $buildd=urlencode("$login ($name) ");
745 }else{
746 $buildd=urlencode("$name <$login> ");
747 }
748 }
749 if ($ok == 1 )
750 {
751 break;
752 }
753 }
754 fclose($fp);
755 $counter_span += 1;
756 $title = html_b("General information for Id: $login");
757 $maintainer_data = "";
758 /* GPG is broken
759 if ($keys == "NOID")
760 {
761 $maintainer_data = html_font("GPG key id not found!", 'size="+1" color="red"');
762 $maintainer_data .= html_blank() . html_font("(key id was not found neither in the Debian keyring nor on a public keyserver)", 'size="-2"');
763 $maintainer_data .= html_br();
764 }else{
765 $maintainer_data .= "GPG key id: ";
766 foreach (explode(",", $keys) as $key)
767 {
768 $maintainer_data .= html_small(html_a($key, "developer.php?gpg_key=" .$key . $add_comaint)) . " ";
769 }
770 $maintainer_data .= html_br();
771 }
772 */
773 $maintainer_data .= html_small(bugs_nonfixed($login)) . html_br();
774 $maintainer_data .= html_small(bugs_all_related($login)) . html_br();
775 $maintainer_data .= html_small(bugs_rc($login)) . html_br();
776 $maintainer_data .= html_small(bugs_submitter($login)) . html_br();
777 $maintainer_data .= html_small(lintian_link($lintian)) . html_br();
778 $maintainer_data .= html_small(buildd_link($buildd, $login)) . html_br();
779 $maintainer_data .= html_small(stat_bug_link($login));
780 if(file_exists("$prefix/wnpp/" . $login{0} . "/$login"))
781 {
782 $maintainer_data .= html_br() . html_small(html_a("Wnpp bugs opened by &lt;$login&gt;", "developer.php?wnpp=$login"));
783 }
784
785 print html_collexp($counter_span, $title, "general", false, $maintainer_data);
786 }
787
788 /* Function used to display the generic information (help and display settings) */
789 function print_header_entries_top($login, $key, $name)
790 {
791 global $counter_span;
792 global $already_displayed;
793 print html_h("Packages overview for $name", 1, "center");
794
795 if(! $already_displayed)
796 {
797 $counter_span += 1;
798 $display_data = "You are able to display only the columns you want/need.". html_br();
799 $display_data .= html_b(html_em("You need to allow cookies if you want the configuration to be stored. If not, remember/bookmark the right url that will be provided after submitting changes.")) . html_br();
800 $display_data .= "You can override the settings by providing an extra arg to the url (e.g. &amp;buildd=1 if you want to display the buildd column). These args will not change the custom settings you defined before (the cookie is not modified). In each column in the bo ttom table you can see in " .html_b("black") . " the arg to be passed. Put 1 if you want to show the corresponding column, 0 to hide and 2 to have a summary if column is " . html_em("bugs") . "." . html_br();
801 $display_data .= "Please select the configuration you want (check the boxes corresponding to columns name if you want to keep it displayed):";
802 $display_data = html_small($display_data);
803 $display_table_th = html_th("Bugs","&amp;bugs=");
804 $display_table_th .= html_th("Version","&amp;version=");
805 $display_table_th .= html_th("Excuses","&amp;excuses=");
806 $display_table_th .= html_th("Binary" . html_br() . "Package Page","&amp;bin=");
807 $display_table_th .= html_th("Buildd","&amp;buildd=");
808 $display_table_th .= html_th("Security","&amp;security=");
809 $display_table_th .= html_th("Problems","&amp;problems=");
810 $display_table_th .= html_th("Uninstallable","&amp;uninstallable=");
811 $display_table_th .= html_th("Watch","&amp;watch=");
812 $display_table_th .= html_th("Section","&amp;section=");
813 $display_table_th .= html_th("Priority","&amp;priority=");
814 $display_table_th .= html_th("Pool","&amp;pool=");
815
816 $display_table_tds = html_td(checkbox('bugs'));
817 $display_table_tds .= html_td(checkbox('version'));
818 $display_table_tds .= html_td(checkbox('excuses'));
819 $display_table_tds .= html_td(checkbox('bin'));
820 $display_table_tds .= html_td(checkbox('buildd'));
821 $display_table_tds .= html_td(checkbox('security'));
822 $display_table_tds .= html_td(checkbox('problems'));
823 $display_table_tds .= html_td(checkbox('uninstallable'));
824 $display_table_tds .= html_td(checkbox('watch'));
825 $display_table_tds .= html_td(checkbox('section'));
826 $display_table_tds .= html_td(checkbox('priority'));
827 $display_table_tds .= html_td(checkbox('pool'));
828
829 $display_table_tr = html_tr($display_table_tds, "left");
830
831 $display_data .= html_table(html_tr($display_table_th), array($display_table_tr));
832
833 $preamble = setaction() . html_input_hidden("set", "yes");
834 $display_data = html_form("GET", $preamble, $display_data, "Submit");
835
836 $preamble = setaction() . html_input_hidden("reset", "yes");
837 $display_data .= html_form("GET", $preamble, "", "Show all");
838
839 //$display_data = html_small($display_data);
840 $title = html_b("Display configuration:");
841 print html_br() . html_collexp($counter_span, $title, "general", true, $display_data);
842
843 $counter_span += 1;
844 $help_data = html_color("Blue", "blue") . " packages are co-maintained by developer (reference to Uploaders: field)" . html_br();
845 $help_data .= "The bug columns display the real number of bugs. If there are merged bugs, the total is in parentheses." . html_br();
846 $help_data .= html_color("Red", "red") . " version numbers are NMUs" . html_br();
847 $help_data .= html_color("Magenta", "#ff00ff") . " version numbers are packages where the unstable version differs from the testing version" . html_br();
848 $help_data .= "Watch columns:" . html_br();
849 $help_data .= html_blank().html_blank(). html_color("green", "green") . ": upstream found version is in sync with version unstable/experimental" . html_br();
850 $help_data .= html_blank().html_blank(). html_color("magenta", "#ff00ff") . ": upstream found version is greater than version in unstable" . html_br();
851 $help_data .= html_blank().html_blank(). html_color("navy blue", "#2222AA") . ": upstream found version is lower than version in unstable (a bug in the watch file)" . html_br();
852 $help_data .= html_blank().html_blank(). html_color("error", "red") . ": uscan had problems following the watch file" . html_br();
853 $help_data .= html_blank().html_blank(). "Watch is N/A: package does not have a watch file" . html_br();
854 $help_data .= html_blank().html_blank(). "Wwiz is N/A: package does not have a copyright file suitable to automatically generate a watch file" . html_br();
855 $help_data .= html_blank().html_blank(). "Wwiz is " . html_color("notmatch", "red") . ": package had a copyright file but no useful URL download link was found to automatically generate a watch file" . html_br();
856 $help_data .= html_blank().html_blank(). html_color("no value", "grey") . ": there is a problem with the dehs database files" . html_br().html_br();
857 $help_data = html_small($help_data);
858
859 $title = html_b("Help");
860 print html_collexp($counter_span, $title, "general", true, $help_data);
861 $already_displayed = true;
862 }
863 }
864
865
866 function print_notfound($login)
867 {
868 print html_h("No information available for $login", 2);
869 }
870
871
872 /* Construct page provided when no command is provided */
873 function print_form()
874 {
875 $form = html_h("Debian Developer's Packages Overview", 1);
876 $form .= html_p("Use the following search forms to determine the Debian developer whose packages overview you wish to see:");
877
878 $preamble = "Search based on the Maintainer field in packages:" . html_br();
879 $preamble .= html_small("If a single username is provided, @debian.org is automatically appended.") . html_br();
880 $preamble .= html_small("If you start with an uppercase letter or type two words, it is assumed that you want to do a (partial) match on the maintainer name.") . html_br();
881
882 $preamble .= html_input_text("login");
883 $preamble = html_label($preamble) . html_br();
884
885 $form_data = "Display co-maintained packages:" . html_blank();
886 $form_data .= html_input_radio("comaint", "yes", true, "yes");
887 $form_data .= html_input_radio("comaint", "no", false, "no");
888 $form_data .= html_input_radio("comaint", "only", false, "only");
889 $form_data = html_label($form_data) . html_br();
890
891 $form .= html_form("GET", $preamble, $form_data, "Find");
892
893 #$preamble = "Search based on the " . html_tt("GPG key ID:") . html_br();
894 #$preamble .= html_input_text("gpg_key");
895 #$preamble = html_label($preamble) . html_br();
896
897 #$form_data = "Display co-maintained packages:" . html_blank();
898 #$form_data .= html_input_radio("comaint", "yes", true, "yes");
899 #$form_data .= html_input_radio("comaint", "no", false, "no");
900 #$form_data .= html_input_radio("comaint", "only", false, "only");
901 #$form_data = html_label($form_data) .html_br();
902
903 #$form .= html_form("GET", $preamble, $form_data, "Find") . html_br();
904
905 $preamble = "Search based on a source package name:" . html_br();
906 $preamble .= html_input_text("package");
907 $preamble = html_label($preamble) . html_br();
908
909 $form_data = "Display co-maintained packages:" . html_blank();
910 $form_data .= html_input_radio("comaint", "yes", true, "yes");
911 $form_data .= html_input_radio("comaint", "no", false, "no");
912 $form_data .= html_input_radio("comaint", "only", false, "only");
913 $form_data = html_label($form_data) .html_br();
914
915 $form .= html_form("GET", $preamble, $form_data, "Find");
916
917 $query = "Show complete, sorted list of developers (600kB)";
918 $hidden = html_input_hidden("all", "1");
919 $form .= $query . html_form("GET", $hidden, "", "Show the list") . html_br();
920
921 $form .= "Report problems to the ". html_a("qa.debian.org pseudopackage", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=qa.debian.org") .".";
922 print $form;
923 }
924
925 /* Construct the page where all maintainer are displayed */
926 function print_all()
927 {
928 global $prefix;
929 $maint = file("$prefix/ddpo_maintainers");
930 $html = html_h("Sorted developer list", 2);
931
932 $display_table_th = html_th("Name and email");
933 $display_table_th .= html_th("main");
934 $display_table_th .= html_th("non-us");
935 $display_table_th .= html_th("Other" . html_br(), html_small("all contrib &amp;" . html_br() . "non-free packages"));
936 $display_table_th .= html_th("Total");
937 $trs = array();
938 foreach($maint as $line)
939 {
940 if($line != "")
941 {
942 $count = 0;
943 $line = preg_replace("/, /", ",", $line);
944 preg_match("/;([^;]+?);([^;]+?);([^;]*?);([^;]*?);([^;]*?);([^;]*?);([^;]*?);([^;]*?);([^;]*)$/", $line, $info_array);
945
946 $tds = html_td(html_b(html_a(str_replace(" ", html_blank(), "$info_array[3]") . html_blank() . "&lt;$info_array[1]&gt;", "developer.php?login=" . rawurlencode($info_array[1]))), 15);
947 $main = 0;
948 $nonUS = 0;
949 $other = 0;
950 if($info_array[4] != "")
951 {
952 $main += count(explode(" ", $info_array[4]));
953 $count += count(explode(" ", $info_array[4]));
954 }
955 if($info_array[5] != "")
956 {
957 $other += count(explode(" ", $info_array[5]));
958 $count += count(explode(" ", $info_array[5]));
959 }
960 if($info_array[6] != "")
961 {
962 $nonUS += count(explode(" ", $info_array[6]));
963 $count += count(explode(" ", $info_array[6]));
964 }
965 if($info_array[7] != "")
966 {
967 $other += count(explode(" ", $info_array[7]));
968 $count += count(explode(" ", $info_array[7]));
969 }
970 if($info_array[8] != "")
971 {
972 $other += count(explode(" ", $info_array[8]));
973 $count += count(explode(" ", $info_array[8]));
974 }
975 if($info_array[9] != "")
976 {
977 $other += count(explode(" ", $info_array[9]));
978 $count += count(explode(" ", $info_array[9]));
979 }
980
981 $tds .= html_td($main) . html_td($nonUS) . html_td($other) . html_td(html_b($count));
982 $trs[] = html_tr($tds, "center");
983 }
984 }
985 print html_table(html_tr($display_table_th), $trs, "80");
986 }
987
988 /* Small useful function to construct the link to the excuses */
989 function get_rep($package_name)
990 {
991 if(preg_match("/^lib/", $package_name)) {
992 return substr($package_name, 0, 4);
993 }else{
994 return substr($package_name, 0, 1);
995 }
996 }
997 # Begin of Dehs functions
998 function dehsdb_conn ($dbname,$mode)
999 {
1000 $id = dba_open($dbname, $mode, "db4");
1001 return $id;
1002 }
1003
1004 function dehsdb_xml($xml)
1005 {
1006 $p = xml_parser_create();
1007 xml_parse_into_struct($p, $xml, $vals, $index);
1008 xml_parser_free($p);
1009 $values=array("id"=>$vals[1][value],"up_version"=>$vals[2][value],"wwiz"=>$vals[3][value]);
1010 return $values;
1011 }
1012 function dehs_value($pkg_name,$dist)
1013 {
1014 $id = dehsdb_conn("/org/qa.debian.org/data/dehs/dehs_qa_" . $dist . ".db","r");
1015 if(!$id) return "error";
1016 if (!dba_exists($pkg_name,$id)) return array("id"=>"-","up_version"=>"-","wwiz"=>"-");
1017 $xml=dba_fetch($pkg_name,$id);
1018 dba_close($id);
1019 return dehsdb_xml($xml);
1020 }
1021 function vers_conv($debvers) {
1022 preg_match("/(.+:)?([^-]+)(ds|dsfg|debian)/",$debvers,$matches);
1023 if (!$matches[3]) {
1024 unset($matches);
1025 preg_match("/(.+:)?([^-]+)/",$debvers,$matches);
1026 }
1027 if (substr($matches[2],-1)=='.') $matches[2]=substr($matches[2],0,-1);
1028 return $matches[2];
1029 }
1030 function ver_comp($a,$b) {
1031 exec("dpkg --compare-versions '$a' gt '" . vers_conv($b) . "'",$output,$res);
1032 if ($res==0) return 1;
1033 exec("dpkg --compare-versions '$a' lt '" . vers_conv($b) . "'",$output,$res);
1034 if ($res==0) return 2;
1035 else return 3;
1036 }
1037 function print_dehs($package,$version,$dist,$type)
1038 {
1039 $dehs_values=dehs_value($package,$dist);
1040 if($dehs_values=="error") return html_td(html_small_color("no value", "grey"));
1041 if ($type=="up_version")
1042 {
1043 $dehs_link= html_small(html_br() . html_a("Details", "http://dehs.alioth.debian.org/maintainer.php?name=" . rawurlencode($package)));
1044 if($dehs_values[up_version]=="-")
1045 {
1046 $dehs_values[up_version] = html_small("-");
1047 $dehs_link='';
1048 }
1049 elseif ($dehs_values[up_version]=='N/A')
1050 {
1051 $color="black";
1052 }
1053 elseif ($dehs_values[up_version]=='Error') $color="red";
1054 elseif(ver_comp($dehs_values[up_version],$version)==1) $color="magenta";
1055 elseif(ver_comp($dehs_values[up_version],$version)==2) $color="#2222AA";
1056 else {
1057 $color="green";
1058 $dehs_link='';
1059 }
1060 $upstream_print = html_td(html_small_color($dehs_values[up_version], $color) . $dehs_link, "", 1, 1);
1061 return $upstream_print;
1062 }else{
1063 $wwiz_link_desc="Details";
1064 if($dehs_values[wwiz]=='-' or !$dehs_values[wwiz])
1065 {
1066 $dehs_values[wwiz] = html_small("-");
1067 $dehs_link='';
1068 }
1069 elseif ($dehs_values[wwiz]=='N/A') $color="black";
1070 elseif ($dehs_values[wwiz]=='error' OR $dehs_values[wwiz]=='notmatch') $color="red";
1071 elseif(ver_comp($dehs_values[wwiz],$version)==1)
1072 {
1073 $color="magenta";
1074 $wwiz_link_desc="Watch";
1075 }
1076 elseif(ver_comp($dehs_values[wwiz],$version)==2)
1077 {
1078 $color="#2222AA";
1079 $wwiz_link_desc="Watch";
1080 }else{
1081 $color="green";
1082 $wwiz_link_desc="Watch";
1083 }
1084 if(!isset($dehs_link))
1085 {
1086 $dehs_link= html_br() . html_small(html_a($wwiz_link_desc, "http://dehs.alioth.debian.org/wwiz_detail.php?id=" . $dehs_values[id] . "&amp;type=watch"));
1087 }
1088 $wwiz_print= html_td(html_small_color($dehs_values[wwiz], $color, "", 1, 1));
1089 return $wwiz_print;
1090 }
1091 }
1092 # Check whether there is a debcheck entry for that package
1093 function debcheckavailable($branch, $package_name)
1094 {
1095 $package = ereg_replace ("\.", "_", $package_name);
1096 if(ereg ("[^a-zA-Z0-9+_-]", $package) ||
1097 ($branch != "oldstable" && $branch != "stable" && $branch != "testing" && $branch != "unstable"))
1098 {
1099 return 0;
1100 }
1101 $BASEDIR='/org/qa.debian.org/data/debcheck/result/';
1102 return file_exists($BASEDIR.'/'.$branch.'/packages/'.$package);
1103 }
1104
1105 /*
1106 Print possible wnpp entries and/or removal requests for this source package
1107 as consise links, or nothing if there are none
1108 */
1109 function get_wnpp_rm($package)
1110 {
1111 static $db;
1112 if (!$db) $db = dba_open("/org/qa.debian.org/data/bts/wnpp_rm.db", 'r-', 'db4');
1113 if (!$db) return;
1114 $entries = dba_fetch($package, $db);
1115 if (!$entries) return;
1116 $entries = explode('|', $entries);
1117 $ret = "";
1118 foreach ($entries as $entry) {
1119 preg_match('/(\\S+)\\s+(\\S+)/', $entry, $m);
1120 $ret .= "<a href=\"http://bugs.debian.org/$m[2]\"><strong>[$m[1]]</strong></a>";
1121 }
1122 return $ret;
1123 }
1124
1125 /*
1126 This function prints a package table information row
1127 */
1128 function print_package_entry($branch, $package, $comaint, $back_tr_color)
1129 {
1130 global $prefix;
1131 static $pack_db;
1132
1133 # open package info db
1134 # source(binary, binary)[versions]{uninstalable_stable}{_testing}{_unstable}|priority|:section:
1135 if (!$pack_db) $pack_db = dba_open("$prefix/ddpo_packages.db", 'r-', 'db4');
1136
1137 # handle co-maintained packages
1138 $uploader = false;
1139 if(strstr($package, "#"))
1140 {
1141 $uploader = 1;
1142 $package = str_replace("#", "", $package);
1143 }
1144 if ((($uploader == 1) && ( $comaint == "no")) ||
1145 (($uploader == 0) && ( $comaint == "only"))) return "";
1146
1147 # get package data
1148 $package = dba_fetch($package, $pack_db);
1149 preg_match("/(.+)\((.+)\)/", $package, $result);
1150 $list = split (",", $result[2]);
1151 $package_name = $result[1];
1152
1153 if(strstr($package, "%"))
1154 {
1155 $arch_all = 1;
1156 $package = str_replace("%", "", $package);
1157 }
1158 preg_match("/(.+?)\[(.+)\]\{(.+)\}\{(.+)\}\{(.+)\}\|(.*)\|:(.*):/", $package, $results);
1159 $package = $package_name;
1160 $version = $results[2];
1161 $versions = explode (",", $version);
1162 $version_stable = $versions[0];
1163 $version_testing = $versions[1];
1164 $version_unstable = $versions[2];
1165 $version_prop = $versions[3];
1166 $version_experimental = $versions[4];
1167 $version_experimental_backup= $versions[4];
1168 $security_stable = $versions[5];
1169 $security_testing = $versions[6];
1170 $uninstalable_stable = html_wrap2lines($results[3]);
1171 $uninstalable_testing = html_wrap2lines($results[4]);
1172 $uninstalable_unstable = html_wrap2lines($results[5]);
1173 $priority = $results[6];
1174 $section = $results[7];
1175
1176 // make $bugsdb link persistent during this pagerequest, we don't lock, so
1177 // this doesn't matter at all
1178 static $bugsdb;
1179 if (!$bugsdb) $bugsdb = dba_open("$prefix/bugs.db", 'r-', 'db4');
1180
1181 if (!($bug_list = dba_fetch($package, $bugsdb))) $bug_list = '0(0) 0(0) 0(0) 0(0)';
1182 $bug_list = explode(' ', $bug_list);
1183
1184 if(strcmp($version_stable, "-") == 0 || !debcheckavailable('stable', $package))
1185 {
1186 $stable_dep = html_small("-");
1187 }else{
1188 $stable_dep = html_small(html_a("Stable", "http://qa.debian.org/debcheck.php?dist=stable&amp;package=" . rawurlencode($package)));
1189 }
1190
1191 if(strcmp($version_testing, "-")== 0 || !debcheckavailable('testing', $package))
1192 {
1193 $testing_dep = html_small("-");
1194 }else{
1195 $testing_dep = html_small(html_a("Testing", "http://qa.debian.org/debcheck.php?dist=testing&amp;package=" . rawurlencode($package)));
1196 }
1197
1198 if(strcmp($version_unstable, "-")== 0 || !debcheckavailable('unstable', $package))
1199 {
1200 $sid_dep = html_small("-");
1201 }else{
1202 $sid_dep = html_small(html_a("Unstable", "http://qa.debian.org/debcheck.php?dist=unstable&amp;package=" . rawurlencode($package)));
1203 }
1204
1205 $buildd = "http://buildd.debian.org/build.php?pkg=".$package;
1206 if(strstr($branch, "non-US"))
1207 {
1208 $pool = "http://non-us.debian.org/debian-non-US/pool/". $branch . "/" .get_rep($package) . "/" . $package . "/";
1209 }else{
1210 $pool = "http://ftp.debian.org/debian/pool/". $branch . "/" .get_rep($package) . "/" . $package . "/";
1211 }
1212
1213 if(file_exists("$prefix/excuses/" . $package{0} . "/$package"))
1214 {
1215 $excuse = html_a("Excuses", "developer.php?excuse=$package") . " ";
1216 $excuse .= html_a("More", "http://bjorn.haxx.se/debian/testing.pl?package=$package");
1217 }else{
1218 $excuse = "-";
1219 }
1220 if(strcmp($version_prop, "-"))
1221 {
1222 $version_prop = html_color(html_b($version_prop), "#2222AA");
1223 }
1224 $prop = html_td(html_small($version_prop));
1225
1226 if(strcmp($version_experimental, "-"))
1227 {
1228 $version_experimental = html_color(html_b($version_experimental), "#2222AA");
1229 }
1230 $experimental = html_td(html_small($version_experimental));
1231
1232
1233 if((strcmp ($version_stable, $version_testing) == 0) &&
1234 (strcmp ($version_stable, "/") != 0))
1235 {
1236 if((strcmp ($version_unstable, $version_testing) == 0))
1237 {
1238 $version_print = html_td(html_small($version_stable), "", 3, 1) . $prop . $experimental;
1239 }else{
1240 $version_print = html_td(html_small($version_stable), "", 2, 1) . html_td(html_small($version_unstable)) . $prop . $experimental;
1241 }
1242 $ver = explode("-", $version_unstable);
1243 if((preg_match("/(.+\..+?)$/", $ver[count($ver) - 1], $toto)) && (count($ver) != 1))
1244 {
1245 $version_print = str_replace("$version_unstable", html_color($version_unstable, "red"), $version_print);
1246 }
1247 }elseif(strcmp ($version_testing, $version_unstable) == 0)
1248 {
1249 if(strcmp($version_stable, "/") != 0)
1250 {
1251 $version_stable = html_color($version_stable, "#00AADD");
1252 }
1253 $version_print = html_td(html_small($version_stable)) . html_td(html_small($version_testing), "", 2, 1) . $prop . $experimental;
1254 $ver = explode("-", $version_unstable);
1255 if((preg_match("/(.+\..+?)$/", $ver[count($ver) - 1], $toto)) && (count($ver) != 1))
1256 {
1257 $version_print = str_replace("$version_unstable", html_color($version_unstable, "red"), $version_print);
1258 }
1259 }else{
1260 if(strcmp($version_stable, "/") != 0)
1261 {
1262 $version_stable = html_small_color($version_stable, "#00AADD");
1263 }else{
1264 $version_stable = html_small($version_stable);
1265 }
1266 $version_print = html_td($version_stable) . html_td(html_small_color($version_testing, "#ff00ff")) . html_td(html_small($version_unstable)) . $prop . $experimental;
1267 $ver = explode("-", $version_unstable);
1268 if((preg_match("/(.+\..+?)$/", $ver[count($ver) - 1], $toto)) && (count($ver) != 1))
1269 {
1270 $version_print = str_replace("$version_unstable", html_color($version_unstable, "red"), $version_print);
1271 }
1272 }
1273
1274 $line = "";
1275 $line_data = html_b($package) . get_wnpp_rm($package) . html_br() . html_a("[pts]", "http://packages.qa.debian.org/".get_rep($package)."/$package.html") . html_blank() . html_a("[popcon]", "developer.php?popcon=$package");
1276 if($uploader == 1)
1277 {
1278 $line = html_td(html_small_color($line_data, "blue"));
1279 }else{
1280 $line = html_td(html_small($line_data));
1281 }
1282
1283
1284 /* if bugs >= 1 always print the summary */
1285 if(isdisplayed('bugs'))
1286 {
1287 $bugs = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=". rawurlencode($package)."&amp;archive=no&amp;pend-exc=pending-fixed&amp;pend-exc=fixed&amp;pend-exc=done";
1288 $bugs_all = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=". rawurlencode($package);
1289 $bug_count = $bug_list[0] + $bug_list[1] + $bug_list[2] + $bug_list[3];
1290 $real_bug_count = 0;
1291 $bug_data = "";
1292 foreach($bug_list as $bug_item)
1293 {
1294 preg_match("/\d+\((\d+)\)/", $bug_item, $count_array);
1295 $real_bug_count += $count_array[1];
1296 }
1297 if($bug_count == 0)
1298 {
1299 $bug_data = html_a("-", $bugs_all, "dash");
1300 }else{
1301 $bug_data = bugs_display("$bug_count($real_bug_count)", $bugs_all);
1302 }
1303 $line .= html_td(html_small($bug_data));
1304
1305 /* user want to display all the bugs info */
1306 if(isdisplayed('bugs') == 1)
1307 {
1308 if(!strcmp($bug_list[0], "0(0)"))
1309 {
1310 $bug_data = html_a("-", $bugs_all . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious", "dash");
1311 }else{
1312 $bug_data = bugs_display($bug_list[0], "$bugs" . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious");
1313 }
1314 $line .= html_td(html_small($bug_data));
1315
1316 if(!strcmp($bug_list[1], "0(0)"))
1317 {
1318 $bug_data = html_a("-", $bugs_all . "&amp;sev-inc=important&amp;sev-inc=normal", "dash");
1319 }else{
1320 $bug_data = bugs_display($bug_list[1], "$bugs" . "&amp;sev-inc=important&amp;sev-inc=normal");
1321 }
1322 $line .= html_td(html_small($bug_data));
1323
1324 if(!strcmp($bug_list[2], "0(0)"))
1325 {
1326 $bug_data = html_a("-", $bugs_all . "&amp;sev-inc=minor&amp;sev-inc=wishlist", "dash");
1327 }else{
1328 $bug_data = bugs_display($bug_list[2], "$bugs" . "&amp;sev-inc=minor&amp;sev-inc=wishlist");
1329 }
1330 $line .= html_td(html_small($bug_data));
1331
1332 if(!strcmp($bug_list[3], "0(0)"))
1333 {
1334 $bug_data = html_a("-", $bugs_all . "&amp;archive=no&amp;pend-inc=pending-fixed&amp;pend-inc=fixed", "dash");
1335 }else{
1336 $bug_data = bugs_display($bug_list[3], $bugs_all ."&amp;archive=no&amp;pend-inc=pending-fixed&amp;pend-inc=fixed");
1337 }
1338 $line .= html_td(html_small($bug_data));
1339 /* user only wants summary + rc bugs count */
1340 }elseif(isdisplayed('bugs') == 3)
1341 {
1342 if(!strcmp($bug_list[0], "0(0)"))
1343 {
1344 $bug_data = html_a("-", $bugs_all . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious", "dash");
1345 }else{
1346 $bug_data = bugs_display($bug_list[0], "$bugs" . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious");
1347 }
1348 $line .= html_td(html_small($bug_data));
1349
1350 }
1351 }
1352
1353 if(isdisplayed('version')) $line .= $version_print;
1354 if(isdisplayed('excuses')) $line .= html_td(html_small($excuse));
1355 if(isdisplayed('bin'))
1356 {
1357 $bin_display = "";
1358 for ($i = 1; $i <= count($list); $i++)
1359 {
1360 $bin_package = $list[$i - 1];
1361 $bin_display .= html_a($i, "http://packages.debian.org/" . rawurlencode($bin_package), "", $bin_package);
1362 if(($i % 3 ) == 0)
1363 {
1364 $bin_display .= " ";
1365 }else{
1366 $bin_display .= html_blank();
1367 }
1368 }
1369 $line .= html_td(html_small($bin_display));
1370 }
1371
1372 if(isdisplayed('buildd'))
1373 {
1374 $buildd_display = "";
1375 if(@$arch_all || preg_match("/non-free/", $branch) || (strcmp($version_unstable, "-") == 0))
1376 {
1377 $buildd_display = html_td(html_small("-"));
1378 $arch_all = 0;
1379 }else{
1380 $buildd_display = html_td(html_small(html_a("Buildd", $buildd)
1381 . html_br() . html_a("More",
1382 "http://people.debian.org/~igloo/status.php?packages=$package")));
1383 }
1384 $line .= $buildd_display;
1385 }
1386
1387 if(isdisplayed('security'))
1388 {
1389 if(strcmp($security_stable,"-")) $security_stable = html_color($security_stable, "red");
1390 if(strcmp($security_testing,"-")) $security_testing = html_color($security_testing, "red");
1391 $line .= html_td(html_small($security_stable)) . html_td(html_small($security_testing));
1392 }
1393 if(isdisplayed('problems')) $line .= html_td($stable_dep) . html_td($testing_dep) . html_td($sid_dep);
1394 if(isdisplayed('uninstallable')) $line .= html_td(html_small($uninstalable_stable)) . html_td(html_small($uninstalable_testing)) . html_td(html_small($uninstalable_unstable));
1395 if(isdisplayed('watch'))
1396 {
1397 $line .= print_dehs($package,$version_unstable,"unstable","up_version");
1398 $line .= print_dehs($package,$version_unstable,"unstable","wwiz");
1399 $line .= print_dehs($package,$version_experimental_backup,"experimental","up_version");
1400 $line .= print_dehs($package,$version_experimental_backup,"experimental","wwiz");
1401 }
1402 if(isdisplayed('section')) $line .= html_td(html_small($section));
1403 if(isdisplayed('priority')) $line .= html_td(html_small($priority));
1404 if(isdisplayed('pool')) $line .= html_td(html_a(html_small("Pool"), $pool));
1405 return html_tr($line, "center", $back_tr_color);
1406 }
1407
1408 /*
1409 This function prints a package table information for specific branch
1410 given in argument
1411 */
1412 function print_package_entries($branch, $packages, $comaint)
1413 {
1414 global $prefix;
1415 $packages = preg_replace ("/, /", ",", $packages);
1416 $pack_array = split(" ", $packages);
1417 $global_count = count($pack_array);
1418 $arch_all = 0;
1419
1420 if ($comaint == "no")
1421 /* don't display co-maintained packages */
1422 {
1423 $result = 0;
1424 for ($i = 0; $i < strlen($packages); $i++)
1425 {
1426 if ($packages[$i] == '#')
1427 {
1428 $result += 1;
1429 }
1430 }
1431 $global_count -= $result;
1432 }elseif($comaint == "only")
1433 /* Only display co-maintained packages */
1434 {
1435 $result = 0;
1436 for ($i = 0; $i < strlen($packages); $i++)
1437 {
1438 if ($packages[$i] == '#')
1439 {
1440 $result += 1;
1441 }
1442 }
1443 $global_count = $result;
1444 }
1445
1446 print html_h("Packages in " . html_em($branch) . " ($global_count)", 3);
1447
1448
1449 /* contruct the table header */
1450 $ths = html_th("Source" . html_blank(). "Name", "", 2);
1451 if(isdisplayed('bugs') == 1)
1452 {
1453 $ths .= html_th("Bugs (see above)", "", 1, 5);
1454 }elseif(isdisplayed('bugs') == 2)
1455 {
1456 $ths .= html_th("Bugs (see above)", "", 1, 1);
1457 }elseif(isdisplayed('bugs') == 3)
1458 {
1459 $ths .= html_th("Bugs (see above)", "", 1, 2);
1460 }
1461 if(isdisplayed('version')) $ths .= html_th("Version", "", 1, 5);
1462 if(isdisplayed('excuses')) $ths .= html_th(html_span("Excuses", "", "", "title=\"Raw excuse and Björn Stenberg analysis\""), "", 2, 1);
1463 if(isdisplayed('bin')) $ths .= html_th("Binary" . html_br() . " Package Page", "", 2, 1);
1464 if(isdisplayed('buildd')) $ths .= html_th("Buildd", "", 2, 1);
1465 if(isdisplayed('security')) $ths .= html_th("Security", "", 1, 2);
1466 if(isdisplayed('problems')) $ths .= html_th("Problems", "", 1, 3);
1467 if(isdisplayed('uninstallable')) $ths .= html_th(html_a("Uninstallable", "http://www.debian.org/devel/testing"), "", 1, 3);
1468 if(isdisplayed('watch')) $ths .= html_th("Watch", "", 1, 4);
1469 if(isdisplayed('section')) $ths .= html_th("Section", "", 2, 1);
1470 if(isdisplayed('priority')) $ths .= html_th("Priority", "", 2, 1);
1471 if(isdisplayed('pool')) $ths .= html_th("Pool", "", 2, 1);
1472
1473 $th_level1 = html_tr($ths);
1474 $ths = "";
1475
1476 /* the second header line */
1477 if(isdisplayed('bugs') == 1)
1478 {
1479 $ths .= html_th(html_span("All", "", "", "title=\"All opened bugs\""));
1480 $ths .= html_th(html_span("RC", "", "", "title=\"Release Critical bugs\""));
1481 $ths .= html_th(html_span("I&amp;N", "", "", "title=\"Important &amp; Normal bugs\""));
1482 $ths .= html_th(html_span("M&amp;W", "", "", "title=\"Minor &amp; Wishlist bugs\""));
1483 $ths .= html_th(html_span("F&amp;P", "", "", "title=\"Fixed &amp; Pending bugs\""));
1484 }
1485 elseif(isdisplayed('bugs') == 2)
1486 {
1487 $ths .= html_th(html_span("All", "", "", "title=\"All opened bugs\""));
1488 }
1489 elseif(isdisplayed('bugs') == 3)
1490 {
1491 $ths .= html_th(html_span("All", "", "", "title=\"All opened bugs\""));
1492 $ths .= html_th(html_span("RC", "", "", "title=\"Release Critical bugs\""));
1493 }
1494
1495 if(isdisplayed('version'))
1496 {
1497 $ths .= html_th("Stable");
1498 $ths .= html_th("Testing");
1499 $ths .= html_th("Unstable");
1500 $ths .= html_th(html_span("Prop. Up.", "", "", "title=\"Stable Proposed Updates\""));
1501 $ths .= html_th("Exp.");
1502 }
1503 if(isdisplayed('security'))
1504 {
1505 $ths .= html_th("Stable");
1506 $ths .= html_th("Testing");
1507 }
1508 if(isdisplayed('problems'))
1509 {
1510 $ths .= html_th("Stable");
1511 $ths .= html_th("Testing");
1512 $ths .= html_th("Unstable");
1513 }
1514 if(isdisplayed('uninstallable'))
1515 {
1516 $ths .= html_th("Stable");
1517 $ths .= html_th("Testing");
1518 $ths .= html_th("Unstable");
1519 }
1520 if(isdisplayed('watch'))
1521 {
1522 $ths .= html_th("Watch Unstable");
1523 $ths .= html_th("WWiz Unstable");
1524 $ths .= html_th("Watch Exp.");
1525 $ths .= html_th("WWiz Exp.");
1526 }
1527
1528 $ths = $th_level1 . html_tr($ths);
1529
1530 $trs = array();
1531 $package_line = "";
1532 $back_tr_color = "";
1533 foreach($pack_array as $package)
1534 {
1535 $tr = print_package_entry($branch, $package, $comaint, $back_tr_color);
1536 if($tr){ $trs[] = $tr; }
1537 if ($back_tr_color == "")
1538 {
1539 $back_tr_color = "#dcdcdc";
1540 }else{
1541 $back_tr_color = "";
1542 }
1543 }
1544 print html_table($ths, $trs);
1545 }
1546
1547 function print_subscribed_packages($login, $comaint)
1548 {
1549 global $prefix;
1550 static $subscribe_db;
1551
1552 # section1:pkg1 pkg2;section2:pkg3
1553 if (!$subscribe_db) $subscribe_db = dba_open("$prefix/ddpo_subscribe.db", 'r-', 'db4');
1554
1555 $data = dba_fetch($login, $subscribe_db);
1556 if(!$data) { return; }
1557
1558 $sections = explode(";", $data);
1559 foreach($sections as $section)
1560 {
1561 preg_match("/^([^:]*):(.*)/", $section, $secarray);
1562 print_package_entries($secarray[1], $secarray[2], $comaint);
1563 }
1564 }
1565
1566 # main program
1567
1568 if($comaint == "")
1569 {
1570 $comaint = "yes";
1571 }
1572
1573 if(@$excuse)
1574 {
1575 do_extra($excuse, "excuses", "No excuse for $excuse");
1576 }elseif(@$popcon)
1577 {
1578 do_extra($popcon, "popcon", "No Popularity contest entry for $popcon");
1579 }elseif(@$wnpp)
1580 {
1581 do_extra($wnpp, "wnpp", "No Wnpp entries for $wnpp");
1582 }else if(@$gpg_key)
1583 {
1584 $contents = file("$prefix/ddpo_maintainers");
1585
1586 $match = 0;
1587 $gpg_key = preg_replace ("/0x/i", "", $gpg_key);
1588 foreach ($contents as $line)
1589 {
1590 if(preg_match("/^;[^;]*;[^;]*$gpg_key/i", $line))
1591 {
1592 preg_match("/^;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array);
1593 $match += 1;
1594 print_header_entries_top($pack_array[1], $pack_array[2], $pack_array[3]);
1595 print_header_entries_body($pack_array[2], $pack_array[3], $comaint, $pack_array[1]);
1596 $count = 4;
1597 foreach ($branch as $value)
1598 {
1599 if($pack_array[$count] != "")
1600 {
1601 print_package_entries($value, $pack_array[$count], $comaint);
1602 $no_packages = true;
1603 }elseif(! $no_packages){
1604 print html_h("No packages in unstable", 3);
1605 $no_packages = true;
1606 }
1607 $count += 1;
1608 }
1609 print html_br();
1610 if($match > 10){ break; }
1611 }
1612 }
1613 if($match == 0)
1614 {
1615 print_notfound($gpg_key);
1616 }
1617
1618 printBackLink();
1619 }elseif(@$login)
1620 {
1621 $login = preg_replace ("/\+/", "\+", $login);
1622 if (preg_match("/^[a-z0-9]+$/", $login)) $login .= "@debian.org";
1623
1624 $contents = file("$prefix/ddpo_maintainers");
1625
1626 $match = 0;
1627 foreach($contents as $line)
1628 {
1629 if (preg_match("/^;[^;]*;[^;]*;[^;]*$login/i", $line) || # substring for name
1630 preg_match("/^;$login;/i", $line)) # exact match for mail
1631 {
1632 preg_match("/^;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array);
1633 $match += 1;
1634 print_header_entries_top($pack_array[1], $pack_array[2], $pack_array[3]);
1635 print_header_entries_body($pack_array[2], $pack_array[3], $comaint, $pack_array[1]);
1636 $count = 4;
1637 foreach ($branch as $value)
1638 {
1639 if($pack_array[$count] != "")
1640 {
1641 print_package_entries($value, $pack_array[$count], $comaint);
1642 $no_packages = true;
1643 }elseif(! $no_packages){
1644 print html_h("No packages in unstable", 3);
1645 $no_packages = true;
1646 }
1647 $count += 1;
1648 }
1649 print_subscribed_packages($pack_array[1], $comaint);
1650 if($arg_cookie[packages])
1651 {
1652 print_package_entries("url", $arg_cookie[packages], $comaint);
1653 }
1654 print html_br();
1655 if($match > 10){ break; }
1656 }
1657 }
1658 if($match == 0)
1659 {
1660 print_notfound($login);
1661 }
1662 printBackLink();
1663 }elseif(@$package)
1664 {
1665 $contents = file("$prefix/ddpo_maintainers");
1666 $package_re = preg_replace("/\+/", ".", $package);
1667
1668 $match = 0;
1669 foreach($contents as $line)
1670 {
1671 if (preg_match("/[; ]${package_re}[; \#]/i", $line))
1672 {
1673 preg_match("/^;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array);
1674 $match += 1;
1675 print_header_entries_top($pack_array[1], $pack_array[2], $pack_array[3]);
1676 print_header_entries_body($pack_array[2], $pack_array[3], $comaint, $pack_array[1]);
1677 $count = 4;
1678 foreach ($branch as $value)
1679 {
1680 if($pack_array[$count] != "")
1681 {
1682 print_package_entries($value, $pack_array[$count], $comaint);
1683 $no_packages = true;
1684 }elseif(! $no_packages){
1685 print html_h("No packages in unstable", 3);
1686 $no_packages = true;
1687 }
1688 $count += 1;
1689 }
1690 print_subscribed_packages($pack_array[1], $comaint);
1691 if($arg_cookie[packages])
1692 {
1693 print_package_entries("url", $arg_cookie[packages], $comaint);
1694 }
1695 print html_br();
1696 if($match > 10){ break; }
1697 }
1698 }
1699 if($match == 0)
1700 {
1701 print_notfound($package);
1702 }
1703 printBackLink();
1704 }elseif(@$all)
1705 {
1706 print_all();
1707 }else{
1708 print_form();
1709 }
1710
1711 print_footer();
1712 ?>
1713
1714 # vim:sw=4:ft=php:

Properties

Name Value
svn:eol-style native
svn:keywords Author Date Id Revision

  ViewVC Help
Powered by ViewVC 1.1.5