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

Diff of /trunk/wml/developer.wml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 834 by igenibel, Tue Aug 3 20:10:02 2004 UTC revision 1181 by myon, Sun Dec 4 01:43:24 2005 UTC
# Line 3  Line 3 
3  <protect>/*  <protect>/*
4  +-------------------------------------------------------------------------+  +-------------------------------------------------------------------------+
5  | Copyright (C) 2002 Igor Genibel                                         |  | Copyright (C) 2002 Igor Genibel                                         |
6    | Copyright (C) 2005 Christoph Berg <myon@debian.org>                     |
7  |                                                                         |  |                                                                         |
8  | This program is free software; you can redistribute it and/or           |  | This program is free software; you can redistribute it and/or           |
9  | modify it under the terms of the GNU General Public License             |  | modify it under the terms of the GNU General Public License             |
# Line 32  header('Pragma: no-cache'); Line 33  header('Pragma: no-cache');
33  $arg_cookie = array();  $arg_cookie = array();
34  $prefix="/org/qa.debian.org/data/ddpo/results";  $prefix="/org/qa.debian.org/data/ddpo/results";
35  $counter_span = 0;  $counter_span = 0;
36  $already_displayed = false;  $seen_packages = array();
37    
38  error_reporting(0);  error_reporting(0);
39  $time = microtime();  $time = microtime();
# Line 62  if (!empty($_COOKIE['columnsinfo']) and Line 63  if (!empty($_COOKIE['columnsinfo']) and
63                            buildd => 1,                            buildd => 1,
64                            security => 1,                            security => 1,
65                            problems => 1,                            problems => 1,
66                              popc => 1,
67                            section => 1,                            section => 1,
68                            priority => 1,                            uninstallable => 1,
69                            pool => 1,                            ordering => 0,
70                            uninstallable => 1);                            uploads => 1);
71    }
72    /* add missing popc column, can be removed after some time (2005-11-16) */
73    if (!in_array('popc', array_keys($arg_cookie))) {
74        $arg_cookie['popc'] = 1;
75    }
76    if (!in_array('uploads', array_keys($arg_cookie))) {
77        $arg_cookie['uploads'] = 1;
78    }
79    if (!in_array('ordering', array_keys($arg_cookie))) { /* 2005-12-01 */
80        $arg_cookie['ordering'] = 0;
81  }  }
82  /* always set cookie with that values in order to keep it 3 months old since the last visit */  /* always set cookie with that values in order to keep it 3 months old since the last visit */
83  setcookie('columnsinfo', base64_encode(serialize($arg_cookie)), strtotime('+3 month'));  setcookie('columnsinfo', base64_encode(serialize($arg_cookie)), strtotime('+3 month'));
# Line 90  if($_GET['reset'] != 'yes') Line 102  if($_GET['reset'] != 'yes')
102  ?>  ?>
103    
104    
105  #use wml::templ::template title="Debian Developer's Packages Overview" author="Igor Genibel"  #use wml::templ::template title="Debian Developer's Packages Overview" author="Igor Genibel, Christoph Berg, and others"
106    
107  {#style#:  {#style#:
108  <style type="text/css">    <link rel="stylesheet" type="text/css" href="developer.css">
 a.dash:link,a.dash:visited,a.dash:active {text-decoration: none;}  
 .general {color:black}  
 .span_general {    text-align:left;  
         cursor:pointer;  
         border-bottom-style:dashed;  
         border-width:thin}  
 h3 { font-family: Arial, Helvetica, sans-serif;  
 margin-left:10px }  
 </style>  
109  :##}  :##}
110    
111  {#script#:  {#script#:
# Line 177  function print_footer() Line 180  function print_footer()
180      $bugs = freadline($fp, "512");      $bugs = freadline($fp, "512");
181      fclose($fp);      fclose($fp);
182    
183      $footer = "Last updated:" . html_br();      $footer .= "General information: $general (updated once per day)" . html_br();
184      $footer .= "General information: $general" . html_br();      $footer .= "Bug information: $bugs (updated every 15 minutes)" . html_br();
     $footer .= "Bug information: $bugs" . html_br();  
     $footer .= "General information is updated once a day." . html_br();  
     $footer .= "Bug information is updated every 15 minutes." .html_br();  
185      list($micro,$sec) = explode(' ', microtime());      list($micro,$sec) = explode(' ', microtime());
186      list($smicro,$ssec) = explode(' ', $time);      list($smicro,$ssec) = explode(' ', $time);
187      $footer .= "Time needed to generate page: ".($sec-$ssec+$micro-$smicro)."s";      $footer .= sprintf("Time needed to generate page: %.2fs", $sec-$ssec+$micro-$smicro);
188    
189      print html_p(html_small($footer));      print html_p(html_small($footer));
190      print html_hr().  print_validator();      print html_hr().  print_validator();
# Line 242  function html_input_submit($name) Line 242  function html_input_submit($name)
242      Returns:      Returns:
243          a valid html text field          a valid html text field
244  */  */
245  function html_input_text($name)  function html_input_text($name, $value)
246  {  {
247      return "<input type=\"text\" size=\"30\" maxlength=\"40\" name=\"$name\">\n";      if ($value) $value = " value=\"$value\"";
248        return "<input type=\"text\" size=\"30\" maxlength=\"40\" name=\"$name\"$value>\n";
249  }  }
250    
251  /*  /*
# Line 294  function html_th($title, $extra, $rowspa Line 295  function html_th($title, $extra, $rowspa
295      if($rowspan == "") $rowspan = 1;      if($rowspan == "") $rowspan = 1;
296      if ($extra != "")      if ($extra != "")
297      {      {
298          return "<th rowspan=\"$rowspan\" colspan=\"$colspan\">" . html_small_color("$title ", "green") . html_small_color("($extra)", "black") . "</th>\n";          return "<th rowspan=\"$rowspan\" colspan=\"$colspan\">" . html_color("$title ", "green") . html_br() . html_color("($extra)", "black") . "</th>\n";
299      }else{      }else{
300          return "<th rowspan=\"$rowspan\" colspan=\"$colspan\">" . html_small_color($title, "green") . "</th>\n";          return "<th rowspan=\"$rowspan\" colspan=\"$colspan\">" . html_color($title, "green") . "</th>\n";
301      }      }
302  }  }
303    
# Line 351  function html_tr($data, $align, $bgcolor Line 352  function html_tr($data, $align, $bgcolor
352      Returns:      Returns:
353          A valid html table          A valid html table
354  */  */
355  function html_table($header, $data, $width)  function html_table($header, $data, $width, $class)
356  {  {
357      if($width == "") $width = 100;      if($width) $width = " width=\"${width}%\"";
358      $table = "<table width=\"${width}%\" border=\"1\" cellpadding=\"3\" cellspacing=\"1\" summary=\"\">";      if($class) $class = " class=\"$class\"";
359        $table = "<table$width$class border=\"1\" cellpadding=\"3\" cellspacing=\"1\" summary=\"\">";
360      $table .= $header ;      $table .= $header ;
361      foreach ($data as $line) $table .= $line;      foreach ($data as $line) $table .= $line;
362      return "$table\n</table>\n";      return "$table\n</table>\n";
# Line 373  function html_table($header, $data, $wid Line 375  function html_table($header, $data, $wid
375  function html_a($text,$link,$class, $title)  function html_a($text,$link,$class, $title)
376  {  {
377      if($title != "") $title = " title=\"$title\"";      if($title != "") $title = " title=\"$title\"";
378      if($class != "")      if($class != "") $class = " class=\"$class\"";
379      {      return "<a$class href=\"$link\"$title>$text</a>";
         return "<a class=\"$class\" href=\"$link\"$title>$text</a>";  
     }else{  
         return "<a href=\"$link\"$title>$text</a>";  
     }  
380  }  }
381    
382  /*  /*
# Line 457  function html_color($text, $color) Line 455  function html_color($text, $color)
455      return "<font color=\"$color\">$text</font>";      return "<font color=\"$color\">$text</font>";
456  }  }
457    
 function html_small_color($text,$color)  
 {  
     return html_small(html_color($text, $color));  
 }  
   
458  function html_div($text,$id,$class,$extra)  function html_div($text,$id,$class,$extra)
459  {  {
460      if($class != "")      if($class != "")
# Line 474  function html_div($text,$id,$class,$extr Line 467  function html_div($text,$id,$class,$extr
467    
468  function html_span($text,$id,$class,$extra)  function html_span($text,$id,$class,$extra)
469  {  {
470      if($id != "") $id = "id=\"$id\"";      if($id != "") $id = " id=\"$id\"";
471      if($class != "")      if($class != "") $class = " class=\"$class\"";
472      {      return "<span$id$class $extra>$text</span>";
         return "<span $id class=\"$class\" $extra>$text</span>\n";  
     }else{  
         return "<span $id $extra>$text</span>\n";  
     }  
473  }  }
474    
475  function html_ul($text)  function html_ul($text, $class)
476  {  {
477      return "<ul>$text</ul>";      if ($class) $class = " class=\"$class\"";
478        return "<ul$class>$text</ul>";
479  }  }
480    
481  function html_li($text)  function html_li($text)
# Line 493  function html_li($text) Line 483  function html_li($text)
483      return "<li>$text</li>";      return "<li>$text</li>";
484  }  }
485    
486    function html_wrap2lines($text)
487    {
488        $list = explode(",", $text);
489        if(count($list) < 2)
490        {
491            return $text;
492        }
493        $half = (int)(count($list)/2);
494        return implode(html_blank(), array_slice($list, 0, $half)) . " " .
495               implode(html_blank(), array_slice($list, $half));
496    }
497    
498    
499  /*  /*
500      This funtion is used to provide the collapsable areas and their title      This funtion is used to provide the collapsable areas and their title
# Line 540  function checkbox($value) Line 542  function checkbox($value)
542          $data = html_input_radio($value,1,false,"Show\n") . html_br();          $data = html_input_radio($value,1,false,"Show\n") . html_br();
543          $data .= html_input_radio($value,0,true,"Hide") . html_br();          $data .= html_input_radio($value,0,true,"Hide") . html_br();
544      }      }
545      if($value == 'bugs')  /*    if($value == 'version')
546      {      {
547          if($arg_cookie[$value] == 2)          if($arg_cookie[$value] == 2)
548          {          {
549              $data = html_input_radio($value,1,false,"Show\n") . html_br();              $data = html_input_radio($value,1,false,"Show\n") . html_br();
550              $data .= html_input_radio($value,0,false,"Hide\n") . html_br();              $data .= html_input_radio($value,0,false,"Hide\n") . html_br();
551              $data .= html_input_radio($value,2,true,"Sum.\n") . html_br();              $data .= html_input_radio($value,2,true,"Without Exp. &amp; Prop. Upt.\n") . html_br();
             $data .= html_input_radio($value,3,false,"Sum. &amp; RC\n") . html_br();  
         }elseif($arg_cookie[$value] == 3)  
         {  
             $data = html_input_radio($value,1,false,"Show\n") . html_br();  
             $data .= html_input_radio($value,0,false,"Hide\n") . html_br();  
             $data .= html_input_radio($value,2,false,"Sum.\n") . html_br();  
             $data .= html_input_radio($value,3,true,"Sum. &amp; RC\n") . html_br();  
552          }elseif($arg_cookie[$value] == 1)          }elseif($arg_cookie[$value] == 1)
553          {          {
554              $data = html_input_radio($value,1,true,"Show\n") . html_br();              $data = html_input_radio($value,1,true,"Show\n") . html_br();
555              $data .= html_input_radio($value,0,false,"Hide\n") . html_br();              $data .= html_input_radio($value,0,false,"Hide\n") . html_br();
556              $data .= html_input_radio($value,2,false,"Sum.\n") . html_br();              $data .= html_input_radio($value,2,false,"Without Exp. &amp; Prop. Upt.\n") . html_br();
             $data .= html_input_radio($value,3,false,"Sum. &amp; RC\n") . html_br();  
557          }else{          }else{
558              $data = html_input_radio($value,1,false,"Show\n") . html_br();              $data = html_input_radio($value,1,false,"Show\n") . html_br();
559              $data .= html_input_radio($value,0,true,"Hide\n") . html_br();              $data .= html_input_radio($value,0,true,"Hide\n") . html_br();
560              $data .= html_input_radio($value,2,false,"Sum.\n") . html_br();              $data .= html_input_radio($value,2,false,"Without Exp. &amp; Prop. Upt.\n") . html_br();
             $data .= html_input_radio($value,3,false,"Sum. &amp; RC\n") . html_br();  
561          }          }
562        } */
563        if($value == 'bugs')
564        {
565            $data = html_input_radio($value,1,$arg_cookie[$value] == 1,"Show (1)\n") . html_br();
566            $data .= html_input_radio($value,0,$arg_cookie[$value] == 0,"Hide (0)\n") . html_br();
567            $data .= html_input_radio($value,2,$arg_cookie[$value] == 2,"Sum. (2)\n") . html_br();
568            $data .= html_input_radio($value,3,$arg_cookie[$value] == 3,"Sum.&amp;RC (3)\n") . html_br();
569        } elseif ($value == 'ordering') {
570            $data = html_input_radio($value,0,$arg_cookie[$value] == 0,"Name (0)\n") . html_br();
571            $data .= html_input_radio($value,1,$arg_cookie[$value] == 1,"Date (1)\n") . html_br();
572            $data .= html_input_radio($value,2,$arg_cookie[$value] == 2,"N./D. (2)\n") . html_br();
573      }      }
574      $data = html_small_color($data,"green");      $data = html_color($data,"green");
575      return $data;      return $data;
576  }  }
577    
# Line 590  function setaction() Line 594  function setaction()
594  }  }
595    
596    
 function process_wnpp_owner($name, $email)  
 {  
     $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);  
     if(($ret != 0) or (count($data) == 0)) return;  
     $display = "";  
     $temp = "";  
     print html_h("$name &lt;$email&gt; is owner:", 3);  
     foreach ($data as $elem)  
     {  
         if (strstr($elem, "debbugsID"))  
         {  
             $temp = str_replace("debbugsID: ", "", $elem);  
         }elseif(strstr($elem, "debbugsTitle"))  
         {  
             $elem = str_replace("debbugsTitle: ", "", $elem);  
             $display .= html_li(html_a("#" . $temp . ": " . $elem, "http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=" . $temp));  
             $temp = "";  
         }  
     }  
     print html_ul($display);  
 }  
   
597  /* These functions provides links to the bts for a maintainer */  /* These functions provides links to the bts for a maintainer */
598  function bugs_nonfixed($login)  function bugs_nonfixed($login)
599  {  {
# Line 620  function bugs_nonfixed($login) Line 602  function bugs_nonfixed($login)
602    
603  function bugs_all_related($login)  function bugs_all_related($login)
604  {  {
605      return html_a("All bugs related to &lt;$login;&gt;", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?maint=". urlencode($login));      return html_a("All bugs related to &lt;$login&gt;", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?maint=". urlencode($login));
606  }  }
607    
608  function bugs_rc($login)  function bugs_rc($login)
# Line 643  function bugs_display($bug_number, $base Line 625  function bugs_display($bug_number, $base
625          $bug_link = html_a($result[1], $base_url, "a");          $bug_link = html_a($result[1], $base_url, "a");
626      }else{      }else{
627          $bug_link  = html_a($result[1], "${base_url}&amp;repeatmerged=no", "a");          $bug_link  = html_a($result[1], "${base_url}&amp;repeatmerged=no", "a");
628          $bug_link .= html_blank() . html_color("(", "blue") . html_a($result[2], "${base_url}&amp;repeatmerged=yes", "a") . html_color(")", "blue");          $bug_link .= " " . html_color("(", "blue") . html_a($result[2], "${base_url}&amp;repeatmerged=yes", "a") . html_color(")", "blue");
629      }      }
630      return $bug_link;      return $bug_link;
631  }  }
# Line 653  function lintian_link($lintian) Line 635  function lintian_link($lintian)
635      return html_a("Lintian report", "http://lintian.debian.org/reports/m${lintian}.html");      return html_a("Lintian report", "http://lintian.debian.org/reports/m${lintian}.html");
636  }  }
637    
638  function buildd_link($buildd)  function buildd_link($buildd, $login)
639  {  {
640      return html_a("Buildd report", "http://buildd.debian.org/bymaint.php?maint=$buildd");      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));
641  }  }
642    
643  function stat_bug_link($login)  function stat_bug_link($login)
# Line 675  function do_extra($data, $data_prefix, $ Line 657  function do_extra($data, $data_prefix, $
657      }else{      }else{
658          print html_h($error, 2);          print html_h($error, 2);
659      }      }
660        if($data_prefix == "excuses")
661        {
662            print html_br() . html_a("More excuses", "http://bjorn.haxx.se/debian/testing.pl?package=$data");
663        }
664  }  }
665    
666    
667  function printBackLink() {  function printBackLink($arg) {
668      print html_p(html_a("Back to main page", "developer.php", ""));      if ($arg) {
669            print html_p(html_a("Back to maintainer page", "developer.php$arg", ""));
670        } else {
671            print html_p(html_a("Back to main page", "developer.php", ""));
672        }
673  }  }
674    
675  /* function used to display the main maintainer links in a collapsable area */  /* function used to display the main maintainer links in a collapsable area */
# Line 714  function print_header_entries_body($keys Line 704  function print_header_entries_body($keys
704      }      }
705      fclose($fp);      fclose($fp);
706      $counter_span += 1;      $counter_span += 1;
707      $title = html_b("General information for Id: $login");      $title = html_b("General information");
708      $maintainer_data = "";      $maintainer_data = "";
709            /* GPG is broken
710      if ($keys == "NOID")      if ($keys == "NOID")
711      {      {
712          $maintainer_data = html_font("GPG key id not found!", 'size="+1" color="red"');          $maintainer_data = html_font("GPG key id not found!", 'size="+1" color="red"');
# Line 729  function print_header_entries_body($keys Line 720  function print_header_entries_body($keys
720          }          }
721          $maintainer_data .= html_br();          $maintainer_data .= html_br();
722      }      }
723      $maintainer_data .= html_small(bugs_nonfixed($login)) . html_br();          */
724      $maintainer_data .= html_small(bugs_all_related($login)) . html_br();      $maintainer_data .= bugs_nonfixed($login) . html_br();
725      $maintainer_data .= html_small(bugs_rc($login)) . html_br();      $maintainer_data .= bugs_all_related($login) . html_br();
726      $maintainer_data .= html_small(bugs_submitter($login)) . html_br();      $maintainer_data .= bugs_rc($login) . html_br();
727      $maintainer_data .= html_small(lintian_link($lintian)) . html_br();      $maintainer_data .= bugs_submitter($login) . html_br();
728      $maintainer_data .= html_small(buildd_link($buildd)) . html_br();      $maintainer_data .= lintian_link($lintian) . html_br();
729      $maintainer_data .= html_small(stat_bug_link($login));      $maintainer_data .= buildd_link($buildd, $login) . html_br();
730      if(file_exists("$prefix/wnpp/" . $login{0} . "/$login"))      $maintainer_data .= stat_bug_link($login) . html_br();
731      {      $maintainer_data .= html_a("WNPP bugs opened by &lt;$login&gt;", "developer.php?wnpp=$login");
         $maintainer_data .= html_br() . html_small(html_a("Wnpp bugs opened by &lt;$login&gt;", "developer.php?wnpp=$login"));  
     }  
732    
733      print html_collexp($counter_span, $title, "general", false, $maintainer_data);      print html_collexp($counter_span, $title, "general", false, html_small($maintainer_data));
734  }  }
735    
736  /* Function used to display the generic information (help and display settings) */  /* Function used to display the generic information (help and display settings) */
737  function print_header_entries_top($login, $key, $name)  function print_header_entries_top($login, $key, $name)
738  {  {
739      global $counter_span;      global $counter_span;
740      global $already_displayed;      static $already_displayed;
741      if(! $already_displayed) {      print html_h("Packages overview for $name &lt;$login&gt;", 2, "center");
742          print html_h("Packages overview for $name", 1, "center");  
743      }      if($already_displayed) return;
744      if(! $already_displayed)  
     {  
745          $counter_span += 1;          $counter_span += 1;
746          $display_data = "You are able to display only the columns you want/need.". html_br();          $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. "));
747          $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();          $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)." . html_br();
748          $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();          $display_data .= "The 'Name' ordering sorts by package name, 'Date' sorts by upload date (descending), and 'N./D.' sorts by name for main/contrib/non-free packages and by date for other sections." . html_br();
         $display_data .= "Please select the configuration you want (check the boxes corresponding to columns name if you want to keep it displayed):";  
749          $display_data = html_small($display_data);          $display_data = html_small($display_data);
750          $display_table_th = html_th("Bugs","&amp;bugs=");          $display_table_th = html_th("Bugs","&amp;bugs=");
751          $display_table_th .= html_th("Version","&amp;version=");          $display_table_th .= html_th("Version","&amp;version=");
# Line 766  function print_header_entries_top($login Line 753  function print_header_entries_top($login
753          $display_table_th .= html_th("Binary" . html_br() . "Package Page","&amp;bin=");          $display_table_th .= html_th("Binary" . html_br() . "Package Page","&amp;bin=");
754          $display_table_th .= html_th("Buildd","&amp;buildd=");          $display_table_th .= html_th("Buildd","&amp;buildd=");
755          $display_table_th .= html_th("Security","&amp;security=");          $display_table_th .= html_th("Security","&amp;security=");
756          $display_table_th .= html_th("Problems","&amp;problems=");          $display_table_th .= html_th("Debcheck","&amp;problems=");
757          $display_table_th .= html_th("Uninstallable","&amp;uninstallable=");          $display_table_th .= html_th("Uninstallable","&amp;uninstallable=");
758            $display_table_th .= html_th("Popcon","&amp;popc=");
759          $display_table_th .= html_th("Watch","&amp;watch=");          $display_table_th .= html_th("Watch","&amp;watch=");
760          $display_table_th .= html_th("Section","&amp;section=");          $display_table_th .= html_th("Section","&amp;section=");
761          $display_table_th .= html_th("Priority","&amp;priority=");          $display_table_th .= html_th("Ordering","&amp;ordering=");
762          $display_table_th .= html_th("Pool","&amp;pool=");          $display_table_th .= html_th("Uploads","&amp;uploads=");
763    
764          $display_table_tds = html_td(checkbox('bugs'));          $display_table_tds = html_td(checkbox('bugs'));
765          $display_table_tds .= html_td(checkbox('version'));          $display_table_tds .= html_td(checkbox('version'));
766          $display_table_tds .= html_td(checkbox('excuses'));          $display_table_tds .= html_td(checkbox('excuses'));
# Line 781  function print_header_entries_top($login Line 769  function print_header_entries_top($login
769          $display_table_tds .= html_td(checkbox('security'));          $display_table_tds .= html_td(checkbox('security'));
770          $display_table_tds .= html_td(checkbox('problems'));          $display_table_tds .= html_td(checkbox('problems'));
771          $display_table_tds .= html_td(checkbox('uninstallable'));          $display_table_tds .= html_td(checkbox('uninstallable'));
772            $display_table_tds .= html_td(checkbox('popc'));
773          $display_table_tds .= html_td(checkbox('watch'));          $display_table_tds .= html_td(checkbox('watch'));
774          $display_table_tds .= html_td(checkbox('section'));          $display_table_tds .= html_td(checkbox('section'));
775          $display_table_tds .= html_td(checkbox('priority'));          $display_table_tds .= html_td(checkbox('ordering'));
776          $display_table_tds .= html_td(checkbox('pool'));          $display_table_tds .= html_td(checkbox('uploads'));
777    
778          $display_table_tr = html_tr($display_table_tds, "left");          $display_table_tr = html_tr($display_table_tds, "left");
779    
780          $display_data .= html_table(html_tr($display_table_th), array($display_table_tr));          $display_data .= html_table(html_tr($display_table_th), array($display_table_tr), "", "small") . html_br();
781            $display_data .= "Additionally show packages: ". html_input_text("packages", isdisplayed('packages'));
782            $display_data .= " uploaders: ". html_input_text("uploader", isdisplayed('uploader')) . html_br();
783    
784          $preamble = setaction() . html_input_hidden("set", "yes");          $preamble = setaction() . html_input_hidden("set", "yes");
785          $display_data = html_form("GET", $preamble, $display_data, "Submit");          $display_data = html_form("GET", $preamble, $display_data, "Submit");
# Line 796  function print_header_entries_top($login Line 787  function print_header_entries_top($login
787          $preamble = setaction() . html_input_hidden("reset", "yes");          $preamble = setaction() . html_input_hidden("reset", "yes");
788          $display_data .= html_form("GET", $preamble, "", "Show all");          $display_data .= html_form("GET", $preamble, "", "Show all");
789    
         //$display_data = html_small($display_data);  
790          $title = html_b("Display configuration:");          $title = html_b("Display configuration:");
791          print html_br() . html_collexp($counter_span, $title, "general", true, $display_data);          print html_br() . html_collexp($counter_span, $title, "general", true, $display_data);
792    
793          $counter_span += 1;          $counter_span += 1;
794          $help_data = "Packages in " . html_color("blue", "blue") . " are packages that are co-maintained by developer (reference to Uploaders: field)" . html_br();          $help_data = html_color("Blue", "blue") . " packages are co-maintained by developer (reference to Uploaders: field)" . html_br();
795          $help_data .= "Packages version in " . html_color("red", "red") . " are NMUed" . html_br();          $help_data .= "The 'Bugs' columns display the real number of bugs. If there are merged bugs, the total is in parentheses" . html_br();
796          $help_data .= "Packages where testing version in " . html_color("magenta", "#ff00ff") . " are those where the unstable version differs from the version in testing" . html_br();          $help_data .= "Version columns:" . html_br();
797          $help_data .= "Packages where Upstream/Wwiz version in " . html_color("green", "green") . " are those where the upstream finded version is in sync with version unstable/experimental" . html_br();          $help_data .= html_blank(). html_color("Red", "red") . ": NMU" . html_br();
798          $help_data .= "Packages where Upstream/Wwiz version in " . html_color("magenta", "#ff00ff") . " are those where the upstream finded version is greater than version in unstable" . html_br();          $help_data .= html_blank(). html_color("Magenta", "#ff00ff") . ": unstable version differs from testing version" . html_br();
799          $help_data .= "Packages where Upstream/Wwiz version in " . html_color("navy blue", "#2222AA") . " are those where the upstream finded version is lower than version in unstable (a bug in the Watch file)" . html_br();          $help_data .= "The 'Popcon' column displays the maximal install count for any binary in the source package" . html_br();
800          $help_data .= "Packages where Upstream/Wwiz is " .html_color("error", "red") . "are those where the uscan had problems following the Watch file" . html_br();          $help_data .= "Watch columns:" . html_br();
801          $help_data .= "Packages where Upstream is N/A are those that doesn't had a Watch file" . html_br();          $help_data .= html_blank().html_blank(). html_color("green", "green") . ": upstream found version is in sync with version unstable/experimental" . html_br();
802          $help_data .= "Packages where Wwiz is N/A are those that doesn't had a Copyright file for trying to automatically generate a Watch file" . html_br();          $help_data .= html_blank().html_blank(). html_color("magenta", "#ff00ff") . ": upstream found version is greater than version in unstable" . html_br();
803          $help_data .= "Packages where Wwiz is " . html_color("notmatch", "red") . " are those that had a Copyright file but no useful url download link was found for trying to automatically generate a Watch file" . html_br();          $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();
804          $help_data .= "If watch values are " . html_color("no value", "grey") . " means that there is a pb with dehs db files." . html_br() . html_br();          $help_data .= html_blank().html_blank(). html_color("error", "red") . ": uscan had problems following the watch file" . html_br();
805          $help_data .= html_u("The real number of bugs is displayed in each bugs column. If there are any merged bugs, the total is displayed within parenthesis.");          $help_data .= html_blank().html_blank(). "Watch is N/A: package does not have a watch file" . html_br();
806            $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();
807            $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();
808            $help_data .= html_blank().html_blank(). html_color("no value", "grey") . ": there is a problem with the dehs database files" . html_br();
809            $help_data .= "The 'uploads' section shows all packages uploaded with this developer's key (NMUs, sponsored uploads)" . html_br().html_br();
810          $help_data = html_small($help_data);          $help_data = html_small($help_data);
811    
812          $title = html_b("Help");          $title = html_b("Help");
813          print html_collexp($counter_span, $title, "general", true, $help_data);          print html_collexp($counter_span, $title, "general", true, $help_data);
814          $already_displayed = true;          $already_displayed = true;
     }  
815  }  }
816    
817    
# Line 831  print html_h("No information available f Line 824  print html_h("No information available f
824  /* Construct page provided when no command is provided */  /* Construct page provided when no command is provided */
825  function print_form()  function print_form()
826  {  {
827      $html_data = html_h("Debian Developer's Packages Overview", 1);      $form = html_h("Debian Developer's Packages Overview", 1);
828      $html_data .= html_p("Use the following search forms to determine the Debian developer whose packages overview you wish to see:");      $form .= html_p("Use the following search forms to determine the Debian developer whose packages overview you wish to see:");
829    
830      $preamble = "Search based on the " . html_tt("Maintainer") . " field in packages:" . html_br();      $preamble = "Search based on the Maintainer field in packages:" . html_br();
831        $preamble .= html_small("If a single username is provided, @debian.org is automatically appended.") . html_br();
832        $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();
833    
834      $preamble .= html_input_text("login");      $preamble .= html_input_text("login");
835      $preamble = html_label($preamble) . html_br();      $preamble = html_label($preamble) . html_br();
836    
# Line 844  function print_form() Line 840  function print_form()
840      $form_data .= html_input_radio("comaint", "only", false, "only");      $form_data .= html_input_radio("comaint", "only", false, "only");
841      $form_data = html_label($form_data) . html_br();      $form_data = html_label($form_data) . html_br();
842    
843      $form = html_form("GET", $preamble, $form_data, "Find");      $form .= html_form("GET", $preamble, $form_data, "Find");
   
     $form .= html_small("If a single username is provided, @debian.org is automatically appended.") .html_br();  
     $form .= 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();  
   
     $preamble = "Search based on the " . html_tt("GPG key ID:") . html_br();  
     $preamble .= html_input_text("gpg_key");  
     $preamble = html_label($preamble) . html_br();  
844    
845      $form_data = "Display co-maintained packages:" . html_blank();      #$preamble = "Search based on the " . html_tt("GPG key ID:") . html_br();
846      $form_data .= html_input_radio("comaint", "yes", true, "yes");      #$preamble .= html_input_text("gpg_key");
847      $form_data .= html_input_radio("comaint", "no", false, "no");      #$preamble = html_label($preamble) . html_br();
848      $form_data .= html_input_radio("comaint", "only", false, "only");  
849      $form_data = html_label($form_data) .html_br();      #$form_data = "Display co-maintained packages:" . html_blank();
850        #$form_data .= html_input_radio("comaint", "yes", true, "yes");
851        #$form_data .= html_input_radio("comaint", "no", false, "no");
852        #$form_data .= html_input_radio("comaint", "only", false, "only");
853        #$form_data = html_label($form_data) .html_br();
854    
855      $form .= html_form("GET", $preamble, $form_data, "Find") . html_br();      #$form .= html_form("GET", $preamble, $form_data, "Find") . html_br();
856    
857      $preamble = "Search based on a " . html_tt("source package name:") . html_br();      $preamble = "Search based on a source package name:" . html_br();
858      $preamble .= html_input_text("package");      $preamble .= html_input_text("package");
859      $preamble = html_label($preamble) . html_br();      $preamble = html_label($preamble) . html_br();
860    
# Line 873  function print_form() Line 866  function print_form()
866    
867      $form .= html_form("GET", $preamble, $form_data, "Find");      $form .= html_form("GET", $preamble, $form_data, "Find");
868    
869      $query = "Do you want to see the complete, sorted list of developers? " . html_b("200kb!");      $query = "Show complete, sorted list of developers (600kB)";
870      $hidden = html_input_hidden("all", "1");      $hidden = html_input_hidden("all", "1");
871      $form .= $query . html_form("POST", $hidden, "", "Show the list") . html_br();      $form .= $query . html_form("GET", $hidden, "", "Show the list");
872    
873        $form .= html_h("Subscribing to Packages", 2);
874        $form .= "Additional packages can be added to the list of packages shown. There are two interfaces, mail and URL based.". html_br().html_br();
875        $form .= "Using the DDPO control bot at ". html_a("ddpo@qa.debian.org", "mailto:ddpo@qa.debian.org") .", packages are added to the listing for a login (mail address), optionally sorted in user-defined sections. The following commands are accepted:";
876        $form .= "<pre>user &lt;address&gt;
877      Process commands for &lt;address&gt;. Defaults to the address used in the From:
878      header.
879    subscribe &lt;srcpackage&gt; [&lt;section&gt;]
880      Adds &lt;srcpackage&gt; to the listing. If &lt;section&gt; is omitted, defaults to
881      \"ddpo\". This command can also be used to move &lt;srcpackage&gt; to a different
882      section.
883      The special section \"uploader\" allows subscription to uploads made by a developer
884      (identified by key id).
885    unsubscribe &lt;srcpackage&gt;
886      Removes the &lt;srcpackage&gt; from the listing.
887    help
888      Print help text.
889    quit
890    thanks
891      Stops processing commands.
892    </pre>";
893        $form .= "Example:";
894        $form .= "<pre>user cb@df7cb.de
895    subscribe endeavour
896    subscribe rdiff-backup sponsor-panthera
897    unsubscribe libextractor
898    subscribe myon@debian.org uploader
899    </pre>";
900        $form .= "Alternatively, one can append &amp;packages=pkg1+pkg2+... to the URL, or enter package names in the 'Display configuration' form. This will create a new section \"url\" in the listing, independently of the selected login.". html_br().html_br();
901    
902        $form .= "Report problems with DDPO to the ". html_a("qa.debian.org pseudopackage", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?pkg=qa.debian.org") .".";
903      print $form;      print $form;
904  }  }
905    
# Line 883  function print_form() Line 907  function print_form()
907  function print_all()  function print_all()
908  {  {
909      global $prefix;      global $prefix;
910      $fp = fopen("$prefix/extract", "r");      $maint = file("$prefix/ddpo_maintainers");
911      $html = html_h("Sorted developer list", 2);      print html_h("Sorted developer list", 2);
912    
913      $display_table_th = html_th("Name and email");      $display_table_th = html_th("Name and Email");
914      $display_table_th .= html_th("main");      $display_table_th .= html_th("main");
915      $display_table_th .= html_th("non-us");      $display_table_th .= html_th("contrib");
916      $display_table_th .= html_th("Other" . html_br(), html_small("all contrib &amp;" . html_br() . "non-free packages"));      $display_table_th .= html_th("non-free");
917      $display_table_th .= html_th("Total");      $display_table_th .= html_th("Total");
918      $trs = array();      $trs = array();
919      while(!feof($fp))      foreach($maint as $line)
920      {      {
         $line = freadline($fp, "10240");  
921          if($line != "")          if($line != "")
922          {          {
923              $count = 0;              $count = 0;
924              $line = preg_replace("/, /", ",", $line);              $line = preg_replace("/, /", ",", $line);
925              preg_match("/;(.+?);(.+?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)$/", $line, $info_array);              preg_match("/^;([^;]+?);([^;]+?);([^;]*?);([^;]*?);([^;]*?);([^;]*?);/", $line, $info_array);
926    
927              $tds = html_td(html_b(html_a(str_replace(" ", html_blank(), "$info_array[3]") . html_blank() . "&lt;$info_array[1]&gt;", "developer?login=" . rawurlencode($info_array[1]))), 15);              $tds = html_td(html_a(str_replace(" ", html_blank(), "$info_array[3]") . html_blank() . "&lt;$info_array[1]&gt;", "developer.php?login=" . rawurlencode($info_array[1])));
928              $main = 0;              $main = 0;
929              $nonUS = 0;              $contrib = 0;
930              $other = 0;              $nonfree = 0;
931              if($info_array[4] != "")              if($info_array[4] != "")
932              {              {
933                  $main += count(explode(" ", $info_array[4]));                  $main += count(explode(" ", $info_array[4]));
# Line 912  function print_all() Line 935  function print_all()
935              }              }
936              if($info_array[5] != "")              if($info_array[5] != "")
937              {              {
938                  $other += count(explode(" ", $info_array[5]));                  $contrib += count(explode(" ", $info_array[5]));
939                  $count += count(explode(" ", $info_array[5]));                  $count += count(explode(" ", $info_array[5]));
940              }              }
941              if($info_array[6] != "")              if($info_array[6] != "")
942              {              {
943                  $nonUS += count(explode(" ", $info_array[6]));                  $nonfree += count(explode(" ", $info_array[6]));
944                  $count += count(explode(" ", $info_array[6]));                  $count += count(explode(" ", $info_array[6]));
945              }              }
             if($info_array[7] != "")  
             {  
                 $other += count(explode(" ", $info_array[7]));  
                 $count += count(explode(" ", $info_array[7]));  
             }  
             if($info_array[8] != "")  
             {  
                 $other += count(explode(" ", $info_array[8]));  
                 $count += count(explode(" ", $info_array[8]));  
             }  
             if($info_array[9] != "")  
             {  
                 $other += count(explode(" ", $info_array[9]));  
                 $count += count(explode(" ", $info_array[9]));  
             }  
946    
947              $tds .= html_td($main) . html_td($nonUS) . html_td($other) . html_td(html_b($count));              $tds .= html_td($main) . html_td($contrib) . html_td($nonfree) . html_td(html_b($count));
948              $trs[] = html_tr($tds, "center");              $trs[] = html_tr($tds, "center");
949          }          }
950      }      }
# Line 955  function get_rep($package_name) Line 963  function get_rep($package_name)
963  # Begin of Dehs functions  # Begin of Dehs functions
964  function dehsdb_conn ($dbname,$mode)  function dehsdb_conn ($dbname,$mode)
965  {  {
966      $id = dba_open($dbname, $mode, "db2");      $id = dba_open($dbname, $mode, "db4");
967      return $id;      return $id;
968  }  }
969    
# Line 977  function dehs_value($pkg_name,$dist) Line 985  function dehs_value($pkg_name,$dist)
985      return dehsdb_xml($xml);      return dehsdb_xml($xml);
986  }  }
987  function vers_conv($debvers) {  function vers_conv($debvers) {
988    preg_match("/(.+:)?(.+)(ds-|-)/",$debvers,$matches);          preg_match("/(.+:)?([^-]+)(ds|dsfg|debian)/",$debvers,$matches);
989    return $matches[2];          if (!$matches[3]) {
990                    unset($matches);
991                    preg_match("/(.+:)?([^-]+)/",$debvers,$matches);
992            }
993            if (substr($matches[2],-1)=='.') $matches[2]=substr($matches[2],0,-1);
994            return $matches[2];
995  }  }
996  function ver_comp($a,$b) {  function ver_comp($a,$b) {
997    exec("dpkg --compare-versions '$a' gt '" . vers_conv($b) . "'",$output,$res);    exec("dpkg --compare-versions '$a' gt '" . vers_conv($b) . "'",$output,$res);
# Line 990  function ver_comp($a,$b) { Line 1003  function ver_comp($a,$b) {
1003  function print_dehs($package,$version,$dist,$type)  function print_dehs($package,$version,$dist,$type)
1004  {  {
1005      $dehs_values=dehs_value($package,$dist);      $dehs_values=dehs_value($package,$dist);
1006      if($dehs_values=="error") return html_td(html_small_color("no value", "grey"));      if($dehs_values=="error") return html_td(html_color("no value", "grey"));
1007      if ($type=="up_version")      if ($type=="up_version")
1008      {      {
1009          $dehs_link= html_small(html_br() . html_a("Details", "http://dehs.alioth.debian.org/maintainer.php?name=" . rawurlencode($package)));          $dehs_link= html_br() . html_a("Details", "http://dehs.alioth.debian.org/maintainer.php?name=" . rawurlencode($package));
1010          if($dehs_values[up_version]=="-")          if($dehs_values[up_version]=="-")
1011          {          {
1012              $dehs_values[up_version] = html_small("-");              $dehs_values[up_version] = "-";
1013              $dehs_link='';              $dehs_link='';
1014          }          }
1015          elseif ($dehs_values[up_version]=='N/A')          elseif ($dehs_values[up_version]=='N/A')
# Line 1010  function print_dehs($package,$version,$d Line 1023  function print_dehs($package,$version,$d
1023              $color="green";              $color="green";
1024              $dehs_link='';              $dehs_link='';
1025          }          }
1026          $upstream_print = html_td(html_small_color($dehs_values[up_version], $color) . $dehs_link, "", 1, 1);          $upstream_print = html_td(html_color($dehs_values[up_version], $color) . $dehs_link, "", 1, 1);
1027          return $upstream_print;          return $upstream_print;
1028      }else{      }else{
1029          $wwiz_link_desc="Details";          $wwiz_link_desc="Details";
1030          if($dehs_values[wwiz]=='-' or !$dehs_values[wwiz])          if($dehs_values[wwiz]=='-' or !$dehs_values[wwiz])
1031          {          {
1032              $dehs_values[wwiz] = html_small("-");              $dehs_values[wwiz] = "-";
1033              $dehs_link='';              $dehs_link='';
1034          }          }
1035          elseif ($dehs_values[wwiz]=='N/A') $color="black";          elseif ($dehs_values[wwiz]=='N/A') $color="black";
# Line 1036  function print_dehs($package,$version,$d Line 1049  function print_dehs($package,$version,$d
1049          }          }
1050          if(!isset($dehs_link))          if(!isset($dehs_link))
1051          {          {
1052              $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"));              $dehs_link= html_br() . html_a($wwiz_link_desc, "http://dehs.alioth.debian.org/wwiz_detail.php?id=" . $dehs_values[id] . "&amp;type=watch");
1053          }          }
1054          $wwiz_print= html_td(html_small_color($dehs_values[wwiz], $color, "", 1, 1));          $wwiz_print= html_td(html_color($dehs_values[wwiz], $color, "", 1, 1));
1055          return $wwiz_print;          return $wwiz_print;
1056      }      }
1057  }  }
1058  # Check whether there is a debcheck entry for that package  # Check whether there is a debcheck entry for that package
1059  function debcheckavailable($branch, $package_name)  function debcheckavailable($suite, $package_name)
1060  {  {
1061      $package = ereg_replace ("\.", "_", $package_name);      $package = ereg_replace ("\.", "_", $package_name);
1062      if(ereg ("[^a-zA-Z0-9+_-]", $package) ||      if(ereg ("[^a-zA-Z0-9+_-]", $package) ||
1063        ($branch != "oldstable" && $branch != "stable" && $branch != "testing" && $branch != "unstable"))        ($suite != "oldstable" && $suite != "stable" && $suite != "testing" && $suite != "unstable"))
1064          {          {
1065              return 0;              return 0;
1066          }          }
1067      $BASEDIR='/org/qa.debian.org/data/debcheck/result/';      $BASEDIR='/org/qa.debian.org/data/debcheck/result/';
1068      return file_exists($BASEDIR.'/'.$branch.'/packages/'.$package);      return file_exists($BASEDIR.'/'.$suite.'/packages/'.$package);
1069  }  }
1070    
1071  /*  /*
1072   This function print a package table information for specific branch   Print possible wnpp entries and/or removal requests for this source package
1073   given in argument   as consise links, or nothing if there are none
1074  */  */
1075  function print_package_entries($branch, $packages, $comaint)  function get_wnpp_rm($package)
1076    {
1077           static $db;
1078           if (!$db) $db = dba_open("/org/qa.debian.org/data/bts/wnpp_rm.db", 'r-', 'db4');
1079           if (!$db) return;
1080           $entries = dba_fetch($package, $db);
1081           if (!$entries) return;
1082           $entries = explode('|', $entries);
1083           $ret = "";
1084           foreach ($entries as $entry) {
1085                   preg_match('/(\\S+)\\s+(\\S+)/', $entry, $m);
1086                   $ret .= "<a href=\"http://bugs.debian.org/$m[2]\"><strong>[$m[1]]</strong></a>";
1087           }
1088           return $ret;
1089    }
1090    
1091    /* annotate version number with mouseover title */
1092    function format_version($package, $version, $class)
1093    {
1094        global $uploads_db;
1095        $date = dba_fetch("ud:$package:$version", $uploads_db);
1096        $uploader = dba_fetch("ul:$package:$version", $uploads_db);
1097        if ($date or $uploader)
1098            return html_span($version, "", $class, "title=\"$date ($uploader)\"");
1099        return $version;
1100    }
1101    
1102    /*
1103     This function prints a package table information row
1104    */
1105    function print_package_entry($branch, $package, $comaint, $back_tr_color)
1106  {  {
1107      global $prefix;      global $prefix;
1108      $packages = preg_replace ("/, /", ",", $packages);      global $pack_db;
1109      $pack_array = split(" ", $packages);      global $seen_packages;
1110      $global_count = count($pack_array);  
1111      $all = 0;      # handle co-maintained packages
1112        $uploader = false;
1113        if(strstr($package, "#"))
1114        {
1115            $uploader = 1;
1116            $package = str_replace("#", "", $package);
1117        }
1118        if ((($uploader == 1) && ( $comaint == "no")) ||
1119            (($uploader == 0) && ( $comaint == "only"))) return "";
1120    
1121        # skip already displayed packages
1122        if(in_array($package, $seen_packages)) return "";
1123        $seen_packages[] = $package;
1124    
1125        # get package data
1126        $packagedata = dba_fetch($package, $pack_db);
1127        preg_match("/(.+)\((.+)\)/", $packagedata, $result);
1128        $binaries = split (", ", $result[2]);
1129    
1130        if(strstr($packagedata, "%"))
1131        {
1132            $arch_all = 1;
1133            $packagedata = str_replace("%", "", $packagedata);
1134        }
1135        preg_match("/(.+?)\[(.+)\]\{(.+)\}\{(.+)\}\{(.+)\}\|(.*)\|:(.*):/", $packagedata, $results);
1136        $version = $results[2];
1137        $versions = explode (",", $version);
1138        $version_stable = $versions[0];
1139        $version_testing = $versions[1];
1140        $version_unstable = $versions[2];
1141        $version_prop = $versions[3];
1142        $version_experimental = $versions[4];
1143        $version_experimental_backup= $versions[4];
1144        $security_stable = $versions[5];
1145        $security_testing = $versions[6];
1146        $uninstalable_stable = html_wrap2lines($results[3]);
1147        $uninstalable_testing = html_wrap2lines($results[4]);
1148        $uninstalable_unstable = html_wrap2lines($results[5]);
1149        $priority = $results[6];
1150        $section = $results[7];
1151    
1152        $urlpackage = rawurlencode($package);
1153    
1154        // make $bugsdb link persistent during this pagerequest, we don't lock, so
1155        // this doesn't matter at all
1156        static $bugsdb;
1157        if (!$bugsdb) $bugsdb = dba_open("$prefix/bugs.db", 'r-', 'db4');
1158    
1159        if (!($bug_list = dba_fetch($package, $bugsdb))) $bug_list = '0(0) 0(0) 0(0) 0(0)';
1160        $bug_list = explode(' ', $bug_list);
1161    
1162        if(strcmp($version_stable, "-") == 0 || !debcheckavailable('stable', $package))
1163        {
1164            $stable_dep = "-";
1165        }else{
1166            $stable_dep = html_a("St", "http://qa.debian.org/debcheck.php?dist=stable&amp;package=$urlpackage");
1167        }
1168    
1169        if(strcmp($version_testing, "-")== 0 || !debcheckavailable('testing', $package))
1170        {
1171            $testing_dep = "-";
1172        }else{
1173            $testing_dep = html_a("Te", "http://qa.debian.org/debcheck.php?dist=testing&amp;package=$urlpackage");
1174        }
1175    
1176        if(strcmp($version_unstable, "-")== 0 || !debcheckavailable('unstable', $package))
1177        {
1178            $sid_dep = "-";
1179        }else{
1180            $sid_dep = html_a("Un", "http://qa.debian.org/debcheck.php?dist=unstable&amp;package=$urlpackage");
1181        }
1182    
1183        $buildd = "http://buildd.debian.org/build.php?pkg=$urlpackage";
1184    
1185        $pool = "http://ftp.debian.org/debian/pool/";
1186        if(strstr($section, "non-free"))
1187        {
1188            $pool .= "non-free";
1189        }elseif(strstr($section, "contrib"))
1190        {
1191            $pool .= "contrib";
1192        }else{
1193            $pool .= "main";
1194        }
1195        $pool .= "/" . get_rep($urlpackage) . "/" . $urlpackage . "/";
1196    
1197      if ($comaint == "no")      if(file_exists("$prefix/excuses/" . $package{0} . "/$package"))
     /* don't display co-maintained packages */  
1198      {      {
1199          $result = 0;          $excuse = html_a("Excuses", "developer.php?excuse=$urlpackage") . " ";
1200          for ($i = 0; $i < strlen($packages); $i++)          $excuse .= html_a("More", "http://bjorn.haxx.se/debian/testing.pl?package=$urlpackage");
1201        }else{
1202            $excuse = "-";
1203        }
1204    
1205        # version numbers
1206        static $incomingdb;
1207        if (!$incomingdb) $incomingdb = dba_open("$prefix/incoming.db", 'r-', 'db4');
1208    
1209        $stable = format_version($package, $version_stable, "stable");
1210        $testing = format_version($package, $version_testing, "testing");
1211        $ver = explode("-", $version_unstable);
1212        if((preg_match("/(.+\..+?)$/", $ver[count($ver) - 1], $toto)) && (count($ver) != 1)) {
1213            $unstable = format_version($package, $version_unstable, "nmu");
1214        } else {
1215            $unstable = format_version($package, $version_unstable);
1216        }
1217        if ($incoming = dba_fetch("i:$package", $incomingdb)) {
1218            $incoming_dsc = dba_fetch("id:$package", $incomingdb);
1219            $unstable .= html_br() . html_a($incoming, $incoming_dsc, "incoming");
1220        }
1221        if ($delayed = dba_fetch("d:$package", $incomingdb)) {
1222            $delayed_changes = dba_fetch("dc:$package", $incomingdb);
1223            $unstable .= html_br() . html_a($delayed, $delayed_changes, "delayed");
1224        }
1225    
1226        if((strcmp ($version_stable, $version_testing) == 0) &&
1227           (strcmp ($version_stable, "/") != 0))
1228        {
1229            if((strcmp ($version_unstable, $version_testing) == 0)) {
1230                $version_print = html_td($stable, "", 3, 1);
1231            }else{
1232                $version_print = html_td($stable, "", 2, 1) . html_td($unstable);
1233            }
1234        }elseif(strcmp ($version_testing, $version_unstable) == 0) {
1235            $version_print = html_td($stable) . html_td($unstable, "", 2, 1);
1236        }else{
1237            $version_print = html_td($stable) . html_td($testing) . html_td($unstable);
1238        }
1239        $version_print .=
1240            html_td(format_version($package, $version_prop, "tpu")) .
1241            html_td(format_version($package, $version_experimental, "experimental"));
1242    
1243    
1244        /*
1245         * Create output
1246         */
1247    
1248        $line_data = html_b(htmlspecialchars($package)) . get_wnpp_rm($package) . html_br() .
1249            html_a("PTS", "http://packages.qa.debian.org/".get_rep($urlpackage)."/$urlpackage.html") . html_blank() .
1250            html_a("Pool", $pool);
1251        $line = html_td(html_color($line_data, $uploader == 1 ? "blue" : ""));
1252    
1253    
1254        /* if bugs >= 1  always print the summary */
1255        if(isdisplayed('bugs'))
1256        {
1257            $bugs = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=$urlpackage&amp;archive=no&amp;pend-exc=pending-fixed&amp;pend-exc=fixed&amp;pend-exc=done";
1258            $bugs_all = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=$urlpackage";
1259            $bug_count = $bug_list[0] + $bug_list[1] + $bug_list[2] + $bug_list[3];
1260            $real_bug_count = 0;
1261            $bug_data = "";
1262            foreach($bug_list as $bug_item)
1263            {
1264                preg_match("/\d+\((\d+)\)/", $bug_item, $count_array);
1265                $real_bug_count += $count_array[1];
1266            }
1267            if($bug_count == 0)
1268            {
1269                $bug_data = html_a("-", $bugs_all, "dash");
1270            }else{
1271                $bug_data = bugs_display("$bug_count($real_bug_count)", $bugs_all);
1272            }
1273            $line .= html_td($bug_data);
1274    
1275            /* user want to display all the bugs info */
1276            if(isdisplayed('bugs') == 1)
1277          {          {
1278              if ($packages[$i] == '#')              if(!strcmp($bug_list[0], "0(0)"))
1279              {              {
1280                  $result += 1;                  $bug_data = html_a("-", $bugs_all . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious", "dash");
1281              }              }else{
1282                    $bug_data = bugs_display($bug_list[0], "$bugs" . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious");
1283                }
1284                $line .= html_td($bug_data);
1285    
1286                if(!strcmp($bug_list[1], "0(0)"))
1287                {
1288                    $bug_data = html_a("-", $bugs_all . "&amp;sev-inc=important&amp;sev-inc=normal", "dash");
1289                }else{
1290                    $bug_data = bugs_display($bug_list[1], "$bugs" . "&amp;sev-inc=important&amp;sev-inc=normal");
1291                }
1292                $line .= html_td($bug_data);
1293    
1294                if(!strcmp($bug_list[2], "0(0)"))
1295                {
1296                    $bug_data = html_a("-", $bugs_all . "&amp;sev-inc=minor&amp;sev-inc=wishlist", "dash");
1297                }else{
1298                    $bug_data = bugs_display($bug_list[2], "$bugs" . "&amp;sev-inc=minor&amp;sev-inc=wishlist");
1299                }
1300                $line .= html_td($bug_data);
1301    
1302                if(!strcmp($bug_list[3], "0(0)"))
1303                {
1304                    $bug_data = html_a("-", $bugs_all . "&amp;archive=no&amp;pend-inc=pending-fixed&amp;pend-inc=fixed", "dash");
1305                }else{
1306                    $bug_data = bugs_display($bug_list[3], $bugs_all ."&amp;archive=no&amp;pend-inc=pending-fixed&amp;pend-inc=fixed");
1307                }
1308                $line .= html_td($bug_data);
1309            /* user only wants summary + rc bugs count */
1310            }elseif(isdisplayed('bugs') == 3)
1311            {
1312                if(!strcmp($bug_list[0], "0(0)"))
1313                {
1314                    $bug_data = html_a("-", $bugs_all . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious", "dash");
1315                }else{
1316                    $bug_data = bugs_display($bug_list[0], "$bugs" . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious");
1317                }
1318                $line .= html_td($bug_data);
1319    
1320          }          }
1321          $global_count -= $result;      }
1322      }elseif($comaint == "only")  
1323      /* Only display co-maintained packages */      if(isdisplayed('version')) $line .= $version_print;
1324        if(isdisplayed('excuses')) $line .= html_td($excuse);
1325        if(isdisplayed('bin'))
1326      {      {
1327          $result = 0;          $bin_display = "";
1328          for ($i = 0; $i < strlen($packages); $i++)          for ($i = 1; $i <= count($binaries); $i++)
1329          {          {
1330              if ($packages[$i] == '#')              $bin_package = $binaries[$i - 1];
1331              {              if (!$bin_package) continue;
1332                  $result += 1;              $description = dba_fetch("d:$bin_package", $pack_db);
1333                $bin_display .= html_a($i, "http://packages.debian.org/" . rawurlencode($bin_package), "", "$bin_package - $description") . " ";
1334                if (count($binaries) > 9 and $i == 7) {
1335                    $bin_display .= "... ";
1336                    $i = count($binaries) - 1;
1337                    continue;
1338              }              }
1339          }          }
1340      $global_count = $result;          $line .= html_td($bin_display);
1341        }
1342    
1343        if(isdisplayed('buildd'))
1344        {
1345            $buildd_display = "";
1346            if(@$arch_all || preg_match("/non-free/", $branch) || (strcmp($version_unstable, "-") == 0))
1347            {
1348                $buildd_display = html_td("-");
1349                $arch_all = 0;
1350            }else{
1351                $buildd_display = html_td(html_a("Buildd", $buildd)
1352                            . html_br() . html_a("More",
1353                            "http://people.debian.org/~igloo/status.php?packages=$urlpackage"));
1354            }
1355            $line .= $buildd_display;
1356      }      }
1357    
1358      print html_h("Packages in " . html_em($branch) . "($global_count)", 3);      if(isdisplayed('security'))
1359        {
1360            if(strcmp($security_stable,"-")) $security_stable = format_version($package, $security_stable, "security");
1361            if(strcmp($security_testing,"-")) $security_testing = format_version($package, $security_testing, "security");
1362            $line .= html_td($security_stable) . html_td($security_testing);
1363        }
1364        if(isdisplayed('problems')) $line .= html_td($stable_dep) . html_td($testing_dep) . html_td($sid_dep);
1365        if(isdisplayed('uninstallable')) $line .= html_td($uninstalable_stable) . html_td($uninstalable_testing) . html_td($uninstalable_unstable);
1366    
1367        if(isdisplayed('popc'))
1368        {
1369            $line .= html_td(dba_fetch("p:$package", $pack_db) . html_br().
1370                                        html_a("More", "developer.php?popcon=$urlpackage"));
1371        }
1372    
1373        if(isdisplayed('watch'))
1374        {
1375            $line .= print_dehs($package,$version_unstable,"unstable","up_version");
1376            $line .= print_dehs($package,$version_unstable,"unstable","wwiz");
1377            $line .= print_dehs($package,$version_experimental_backup,"experimental","up_version");
1378            $line .= print_dehs($package,$version_experimental_backup,"experimental","wwiz");
1379        }
1380        if(isdisplayed('section')) $line .= html_td($section . html_br() . $priority);
1381        return html_tr($line, "center", $back_tr_color);
1382    }
1383    
1384    /*
1385     This function prints a package table information for specific branch
1386     given in argument
1387    */
1388    function print_package_entries($branch, $packages, $comaint)
1389    {
1390        global $prefix;
1391        global $uploads_db;
1392        $packages = preg_replace ("/, /", ",", $packages);
1393        $pack_array = split(" ", $packages);
1394    
1395        if ((isdisplayed('ordering') == 1) or
1396            ((isdisplayed('ordering') == 2) and
1397             ($branch != 'main') and ($branch != 'contrib') and ($branch != 'non-free')))
1398        {
1399            $pack_sort = array();
1400            foreach ($pack_array as $package) {
1401                $date = dba_fetch("ud:$package", $uploads_db);
1402                $pack_sort[$date.$package] = $package;
1403            }
1404            krsort($pack_sort, SORT_STRING);
1405            $pack_array = $pack_sort;
1406        }
1407    
1408        $trs = array();
1409        foreach($pack_array as $package)
1410        {
1411            $tr = print_package_entry($branch, $package, $comaint, $back_tr_color);
1412            if($tr)
1413            {
1414                $trs[] = $tr;
1415                $back_tr_color = $back_tr_color ? "" : "#dcdcdc";
1416            }
1417        }
1418    
1419        if (!count($trs)) return;
1420    
1421        print html_h(html_em($branch) . " (" . count($trs) . ")", 3);
1422    
1423      /* contruct the table header */      /* contruct the table header */
1424      $ths = html_th("Source" . html_blank(). "Name", "", 2);      $ths = html_th("Source" . html_blank(). "Name", "", 2);
1425      if(isdisplayed('bugs') == 1)      if(isdisplayed('bugs') == 1)
1426      {      {
1427          $ths .= html_th("Bugs(see above)", "", 1, 5);          $ths .= html_th("Bugs", "", 1, 5);
1428      }elseif(isdisplayed('bugs') == 2)      }elseif(isdisplayed('bugs') == 2)
1429      {      {
1430          $ths .= html_th("Bugs(see above)", "", 1, 1);          $ths .= html_th("Bugs", "", 1, 1);
1431      }elseif(isdisplayed('bugs') == 3)      }elseif(isdisplayed('bugs') == 3)
1432      {      {
1433          $ths .= html_th("Bugs(see above)", "", 1, 2);          $ths .= html_th("Bugs", "", 1, 2);
1434      }      }
1435      if(isdisplayed('version')) $ths .= html_th("Version", "", 1, 5);      if(isdisplayed('version')) $ths .= html_th("Version", "", 1, 5);
1436      if(isdisplayed('excuses')) $ths .= html_th(html_span("Excuses", "", "", "title=\"Raw excuse and Björn Stenberg analysis\""), "", 2, 1);      if(isdisplayed('excuses')) $ths .= html_th(html_span("Excuses", "", "", "title=\"Raw excuse and Björn Stenberg analysis\""), "", 2, 1);
1437      if(isdisplayed('bin')) $ths .= html_th("Binary" . html_br() . " Package Page", "", 2, 1);      if(isdisplayed('bin')) $ths .= html_th("Binary" . html_br() . "Package Page", "", 2, 1);
1438      if(isdisplayed('buildd')) $ths .= html_th("Buildd", "", 2, 1);      if(isdisplayed('buildd')) $ths .= html_th("Buildd", "", 2, 1);
1439      if(isdisplayed('security')) $ths .= html_th("Security", "", 1, 2);      if(isdisplayed('security')) $ths .= html_th("Security", "", 1, 2);
1440      if(isdisplayed('problems')) $ths .= html_th("Problems", "", 1, 3);      if(isdisplayed('problems')) $ths .= html_th("Debcheck", "", 1, 3);
1441      if(isdisplayed('uninstallable')) $ths .= html_th(html_a("Uninstallable", "http://www.debian.org/devel/testing"), "", 1, 3);      if(isdisplayed('uninstallable')) $ths .= html_th("Uninstallable", "", 1, 3);
1442        if(isdisplayed('popc')) $ths .= html_th("Popcon", "", 2, 1);
1443      if(isdisplayed('watch')) $ths .= html_th("Watch", "", 1, 4);      if(isdisplayed('watch')) $ths .= html_th("Watch", "", 1, 4);
1444      if(isdisplayed('section')) $ths .= html_th("Section", "", 2, 1);      if(isdisplayed('section')) $ths .= html_th("Section" . html_br() . "Priority", "", 2, 1);
     if(isdisplayed('priority')) $ths .= html_th("Priority", "", 2, 1);  
     if(isdisplayed('pool')) $ths .= html_th("Pool", "", 2, 1);  
1445    
1446      $th_level1 = html_tr($ths);      $th_level1 = html_tr($ths);
1447      $ths = "";      $ths = "";
# Line 1147  function print_package_entries($branch, Line 1470  function print_package_entries($branch,
1470          $ths .= html_th("Stable");          $ths .= html_th("Stable");
1471          $ths .= html_th("Testing");          $ths .= html_th("Testing");
1472          $ths .= html_th("Unstable");          $ths .= html_th("Unstable");
1473          $ths .= html_th(html_span("Prop. Up.", "", "", "title=\"Stable Proposed Updates\""));          $ths .= html_th(html_span("Prop Up", "", "", "title=\"Stable Proposed Updates\""));
1474          $ths .= html_th("Experimental");          $ths .= html_th("Exp");
1475      }      }
1476      if(isdisplayed('security'))      if(isdisplayed('security'))
1477      {      {
1478          $ths .= html_th("Stable");          $ths .= html_th("St");
1479          $ths .= html_th("Testing");          $ths .= html_th("Te");
1480      }      }
1481      if(isdisplayed('problems'))      if(isdisplayed('problems'))
1482      {      {
1483          $ths .= html_th("Stable");          $ths .= html_th("St");
1484          $ths .= html_th("Testing");          $ths .= html_th("Te");
1485          $ths .= html_th("Unstable");          $ths .= html_th("Un");
1486      }      }
1487      if(isdisplayed('uninstallable'))      if(isdisplayed('uninstallable'))
1488      {      {
1489          $ths .= html_th("Stable");          $ths .= html_th("St");
1490          $ths .= html_th("Testing");          $ths .= html_th("Te");
1491          $ths .= html_th("Unstable");          $ths .= html_th("Un");
1492      }      }
1493      if(isdisplayed('watch'))      if(isdisplayed('watch'))
1494      {      {
1495          $ths .= html_th("Upstream Uns.");          $ths .= html_th("Watch Unstable");
1496          $ths .= html_th("WWiz Up. Uns.");          $ths .= html_th("WWiz Unstable");
1497          $ths .= html_th("Upstream Exp.");          $ths .= html_th("W Exp");
1498          $ths .= html_th("WWiz Up. Exp.");          $ths .= html_th("WW Exp");
1499      }      }
1500    
1501      $ths = $th_level1 . html_tr($ths);      $ths = $th_level1 . html_tr($ths);
1502        print html_table($ths, $trs, "", "small");
1503      $trs = array();  }
     $package_line = "";  
     foreach($pack_array as $package)  
     {  
         $uploader = false;  
         preg_match("/(.+)\((.+)\)/", $package, $result);  
         $list = split (",", $result[2]);  
         $package_name = $result[1];  
         if(strstr($package, "#"))  
         {  
             $uploader = 1;  
             $package = str_replace("#", "", $package);  
         }  
         if ((($uploader == 1) && ( $comaint == "no")) ||  
             (($uploader == 0) && ( $comaint == "only"))) continue;  
         if(strstr($package, "%"))  
         {  
             $all = 1;  
             $package = str_replace("%", "", $package);  
         }  
         preg_match("/(.+?)\[(.+)\]\{(.+)\}\{(.+)\}\{(.+)\}\|(.*)\|:(.*):/", $package, $results);  
         $package = $package_name;  
         $version = $results[2];  
         $versions = explode (",", $version);  
         $version_stable = $versions[0];  
         $version_testing = $versions[1];  
         $version_unstable = $versions[2];  
         $version_prop = $versions[3];  
         $version_experimental = $versions[4];  
         $version_experimental_backup= $versions[4];  
         $security_stable = $versions[5];  
         $security_testing = $versions[6];  
         $uninstalable_stable = preg_replace("/,/", html_blank(), $results[3]);  
         $uninstalable_testing = preg_replace("/,/", html_blank(), $results[4]);  
         $uninstalable_unstable = preg_replace("/,/", html_blank(), $results[5]);  
         $priority = $results[6];  
         $section = $results[7];  
   
         // make $bugsdb link persistent during this pagerequest, we don't lock, so  
         // this doesn't matter at all  
         static $bugsdb;  
         if (!$bugsdb) $bugsdb = dba_open("$prefix/bugs.db", 'r-', 'db2');  
1504    
1505          if (!($bug_list = dba_fetch($package, $bugsdb))) $bug_list = '0(0) 0(0) 0(0) 0(0)';  function print_subscribed_packages($login, $comaint)
1506          $bug_list = explode(' ', $bug_list);  {
1507        global $prefix;
1508        static $subscribe_db;
1509    
1510          if(strcmp($version_stable, "-") == 0 || !debcheckavailable('stable', $package))      # section1:pkg1 pkg2;section2:pkg3
1511          {      if (!$subscribe_db) $subscribe_db = dba_open("$prefix/ddpo_subscribe.db", 'r-', 'db4');
             $stable_dep = html_small("-");  
         }else{  
             $stable_dep = html_small(html_a("Stable", "http://qa.debian.org/debcheck.php?dist=stable&amp;package=" . rawurlencode($package)));  
         }  
1512    
1513          if(strcmp($version_testing, "-")== 0 || !debcheckavailable('testing', $package))      $data = dba_fetch($login, $subscribe_db);
1514          {      if(!$data) { return; }
             $testing_dep = html_small("-");  
         }else{  
             $testing_dep = html_small(html_a("Testing", "http://qa.debian.org/debcheck.php?dist=testing&amp;package=" . rawurlencode($package)));  
         }  
1515    
1516          if(strcmp($version_unstable, "-")== 0 || !debcheckavailable('unstable', $package))      $sections = explode(";", $data);
1517          {      foreach($sections as $section)
1518              $sid_dep = html_small("-");      {
1519          }else{          if (preg_match("/^uploader:(.*)/", $section, $secarray)) {
1520              $sid_dep = html_small(html_a("Unstable", "http://qa.debian.org/debcheck.php?dist=unstable&amp;package=" . rawurlencode($package)));              $uploaders = explode(" ", $secarray[1]);
1521                foreach ($uploaders as $uploader)
1522                    print_uploaded_packages($uploader, $comaint);
1523                continue;
1524          }          }
1525            preg_match("/^([^:]*):(.*)/", $section, $secarray);
1526            print_package_entries($secarray[1], $secarray[2], $comaint);
1527        }
1528    }
1529    
1530          $buildd = "http://buildd.debian.org/build.php?pkg=".$package;  function print_uploaded_packages($login, $comaint)
1531          if(strstr($branch, "non-US"))  {
1532          {      global $prefix;
1533              $pool = "http://non-us.debian.org/debian-non-US/pool/". $branch . "/" .get_rep($package) . "/" . $package . "/";      global $uploads_db;
         }else{  
             $pool = "http://ftp.debian.org/debian/pool/". $branch . "/" .get_rep($package) . "/" . $package . "/";  
         }  
1534    
1535          if(file_exists("$prefix/excuses/" . $package{0} . "/$package"))      if (!strstr($login, "@")) $login .= "@debian.org";
1536          {      $packages = dba_fetch($login, $uploads_db);
1537              $excuse = html_a("Excuses", "developer.php?excuse=$package") . " ";      if(!$packages) { return; }
             $excuse .= html_a("More", "http://bjorn.haxx.se/debian/testing.pl?package=$package");  
         }else{  
             $excuse = "-";  
         }  
         if(strcmp($version_prop, "-"))  
         {  
             $version_prop = html_color(html_b($version_prop), "#2222AA");  
         }  
         $prop = html_td(html_small($version_prop));  
1538    
1539          if(strcmp($version_experimental, "-"))      print_package_entries("Uploads by $login", $packages, $comaint);
1540          {  }
             $version_experimental = html_color(html_b($version_experimental), "#2222AA");  
         }  
         $experimental = html_td(html_small($version_experimental));  
1541    
1542    function print_developer($login, $key, $name, $comaint, $pack_array)
1543    {
1544        global $branch;
1545    
1546          if((strcmp ($version_stable, $version_testing) == 0) &&      # reset seen packages list
1547             (strcmp ($version_stable, "/") != 0))      global $seen_packages;
1548          {      $seen_packages = array();
             if((strcmp ($version_unstable, $version_testing) == 0))  
             {  
                 $version_print = html_td(html_small($version_stable), "", 3, 1) . $prop . $experimental;  
             }else{  
                 $version_print = html_td(html_small($version_stable), "", 2, 1) . html_td(html_small($version_unstable)) . $prop . $experimental;  
             }  
             $ver = explode("-", $version_unstable);  
             if((preg_match("/(.+\..+?)$/", $ver[count($ver) - 1], $toto)) && (count($ver) != 1))  
             {  
                 $version_print = str_replace("$version_unstable", html_color($version_unstable, "red"), $version_print);  
             }  
         }elseif(strcmp ($version_testing, $version_unstable) == 0)  
         {  
             if(strcmp($version_stable, "/") != 0)  
             {  
                 $version_stable = html_color($version_stable, "#00AADD");  
             }  
             $version_print = html_td(html_small($version_stable)) . html_td(html_small($version_testing), "", 2, 1) . $prop . $experimental;  
             $ver = explode("-", $version_unstable);  
             if((preg_match("/(.+\..+?)$/", $ver[count($ver) - 1], $toto)) && (count($ver) != 1))  
             {  
                 $version_print = str_replace("$version_unstable", html_color($version_unstable, "red"), $version_print);  
             }  
         }else{  
             if(strcmp($version_stable, "/") != 0)  
             {  
                 $version_stable = html_small_color($version_stable, "#00AADD");  
             }else{  
                 $version_stable = html_small($version_stable);  
             }  
                 $version_print = html_td($version_stable) . html_td(html_small_color($version_testing, "#ff00ff")) . html_td(html_small($version_unstable)) . $prop . $experimental;  
                 $ver = explode("-", $version_unstable);  
                 if((preg_match("/(.+\..+?)$/", $ver[count($ver) - 1], $toto)) && (count($ver) != 1))  
                 {  
                     $version_print = str_replace("$version_unstable", html_color($version_unstable, "red"), $version_print);  
                 }  
         }  
         $back_tr_color = "";  
         if (@$background)  
         {  
             $background=false;  
         }else{  
             $back_tr_color = "#dcdcdc";  
             $background=true;  
         }  
1549    
1550          $line = "";      print_header_entries_top($login, $key, $name);
1551          $line_data = html_b($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");      print_header_entries_body($key, $name, $comaint, $login);
1552          if($uploader == 1)  
1553          {      $count = 1;
1554              $line = html_td(html_small_color($line_data, "blue"));      foreach ($branch as $value)
1555          }else{      {
1556              $line = html_td(html_small($line_data));          if($pack_array[$count] != "")
         }  
   
   
         /* if bugs >= 1  always print the summary */  
         if(isdisplayed('bugs'))  
         {  
             $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";  
             $bugs_all = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=". rawurlencode($package);  
             $bug_count = $bug_list[0] + $bug_list[1] + $bug_list[2] + $bug_list[3];  
             $real_bug_count = 0;  
             $bug_data = "";  
             foreach($bug_list as $bug_item)  
             {  
                 preg_match("/\d+\((\d+)\)/", $bug_item, $count_array);  
                 $real_bug_count += $count_array[1];  
             }  
             if($bug_count == 0)  
             {  
                 $bug_data = html_a("-", $bugs_all, "dash");  
             }else{  
                 $bug_data = bugs_display("$bug_count($real_bug_count)", $bugs_all);  
             }  
             $line .= html_td(html_small($bug_data));  
   
             /* user want to display all the bugs info */  
             if(isdisplayed('bugs') == 1)  
             {  
                 if(!strcmp($bug_list[0], "0(0)"))  
                 {  
                     $bug_data = html_a("-", $nobugs . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious", "dash");  
                 }else{  
                     $bug_data = bugs_display($bug_list[0], "$bugs" . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious");  
                 }  
                 $line .= html_td(html_small($bug_data));  
   
                 if(!strcmp($bug_list[1], "0(0)"))  
                 {  
                     $bug_data = html_a("-", $nobugs . "&amp;sev-inc=important&amp;sev-inc=normal", "dash");  
                 }else{  
                     $bug_data = bugs_display($bug_list[1], "$bugs" . "&amp;sev-inc=important&amp;sev-inc=normal");  
                 }  
                 $line .= html_td(html_small($bug_data));  
   
                 if(!strcmp($bug_list[2], "0(0)"))  
                 {  
                     $bug_data = html_a("-", $nobugs . "&amp;sev-inc=minor&amp;sev-inc=wishlist", "dash");  
                 }else{  
                     $bug_data = bugs_display($bug_list[2], "$bugs" . "&amp;sev-inc=minor&amp;sev-inc=wishlist");  
                 }  
                 $line .= html_td(html_small($bug_data));  
   
                 if(!strcmp($bug_list[3], "0(0)"))  
                 {  
                     $bug_data = html_a("-", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=" . rawurlencode($package) . "&amp;archive=no&amp;pend-inc=pending-fixed&amp;pend-inc=fixed", "dash");  
                 }else{  
                     $bug_data = bugs_display($bug_list[3], "$bugs" . "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=". rawurlencode($package)."&amp;archive=no&amp;pend-inc=pending-fixed&amp;pend-inc=fixed");  
                 }  
                 $line .= html_td(html_small($bug_data));  
             /* user only wants summary + rc bugs count */  
             }elseif(isdisplayed('bugs') == 3)  
             {  
                 if(!strcmp($bug_list[0], "0(0)"))  
                 {  
                     $bug_data = html_a("-", $nobugs . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious", "dash");  
                 }else{  
                     $bug_data = bugs_display($bug_list[0], "$bugs" . "&amp;sev-inc=critical&amp;sev-inc=grave&amp;sev-inc=serious");  
                 }  
                 $line .= html_td(html_small($bug_data));  
   
             }  
         }  
   
         if(isdisplayed('version')) $line .= $version_print;  
         if(isdisplayed('excuses')) $line .= html_td(html_small($excuse));  
         if(isdisplayed('bin'))  
         {  
             $bin_display = "";  
             for ($i = 1; $i <= count($list); $i++)  
             {  
                 $bin_package = $list[$i - 1];  
                 $bin_display .= html_a($i, "http://packages.debian.org/" . rawurlencode($bin_package), "", $bin_package);  
                 if(($i % 3 ) == 0)  
                 {  
                     $bin_display .= " ";  
                 }else{  
                     $bin_display .= html_blank();  
                 }  
             }  
             $line .= html_td(html_small($bin_display));  
         }  
   
         if(isdisplayed('buildd'))  
1557          {          {
1558              $buildd_display = "";              print_package_entries($value, $pack_array[$count], $comaint);
1559              if(@$all || preg_match("/non-free/", $branch) || (strcmp($version_unstable, "-") == 0))              $no_packages = true;
1560              {          }elseif(! $no_packages){
1561                  $buildd_display = html_td(html_small("-"));              print html_h("No packages in unstable", 3);
1562                  $all = 0;              $no_packages = true;
             }else{  
                 $buildd_display = html_td(html_a(html_small("Buildd"), $buildd));  
             }  
             $line .= $buildd_display;  
1563          }          }
1564            $count += 1;
1565          if(isdisplayed('security'))      }
1566          {      print_subscribed_packages($login, $comaint);
1567              if(strcmp($security_stable,"-")) $security_stable = html_color($security_stable, "red");      if(isdisplayed('packages'))
1568              if(strcmp($security_testing,"-")) $security_testing = html_color($security_testing, "red");          print_package_entries("url", isdisplayed('packages'), $comaint);
1569              $line .= html_td(html_small($security_stable)) . html_td(html_small($security_testing));      if(isdisplayed('uploads'))
1570          }          print_uploaded_packages($login, $comaint);
1571          if(isdisplayed('problems')) $line .= html_td($stable_dep) . html_td($testing_dep) . html_td($sid_dep);      if(isdisplayed('uploader')) {
1572          if(isdisplayed('uninstallable')) $line .= html_td(html_small($uninstalable_stable)) . html_td(html_small($uninstalable_testing)) . html_td(html_small($uninstalable_unstable));          $uploaders = explode(" ", isdisplayed('uploader'));
1573          if(isdisplayed('watch'))          foreach ($uploaders as $uploader)
1574          {              print_uploaded_packages($uploader, $comaint);
             $line .= print_dehs($package,$version_unstable,"unstable","up_version");  
             $line .= print_dehs($package,$version_unstable,"unstable","wwiz");  
             $line .= print_dehs($package,$version_experimental_backup,"experimental","up_version");  
             $line .= print_dehs($package,$version_experimental_backup,"experimental","wwiz");  
         }  
         if(isdisplayed('section')) $line .= html_td(html_small($section));  
         if(isdisplayed('priority')) $line .= html_td(html_small($priority));  
         if(isdisplayed('pool')) $line .= html_td(html_a(html_small("Pool"), $pool));  
         $trs[] = html_tr($line, "center", $back_tr_color);  
1575      }      }
     print html_table($ths, $trs);  
1576  }  }
1577    
1578    # popcon
1579    
1580    function print_popcon_entry($package, $back_tr_color)
1581    {
1582        global $pack_db;
1583    
1584        $row = html_tr(
1585            html_td(html_b($package)) .
1586            html_td(dba_fetch("pi:$package", $pack_db)) .
1587            html_td(sprintf("%.2f%%", 100 * dba_fetch("pi:$package", $pack_db) / dba_fetch("pimax:", $pack_db))) .
1588            html_td(dba_fetch("pir:$package", $pack_db)) .
1589            html_td(dba_fetch("pv:$package", $pack_db)) .
1590            html_td(sprintf("%.2f%%", 100 * dba_fetch("pv:$package", $pack_db) / dba_fetch("pvmax:", $pack_db))) .
1591            html_td(dba_fetch("pvr:$package", $pack_db)) .
1592            html_td(dba_fetch("po:$package", $pack_db)) .
1593            html_td(sprintf("%.2f%%", 100 * dba_fetch("po:$package", $pack_db) / dba_fetch("pomax:", $pack_db))) .
1594            html_td(dba_fetch("por:$package", $pack_db)) .
1595            html_td(dba_fetch("pr:$package", $pack_db)) .
1596            html_td(sprintf("%.2f%%", 100 * dba_fetch("pr:$package", $pack_db) / dba_fetch("prmax:", $pack_db))) .
1597            html_td(dba_fetch("prr:$package", $pack_db)) .
1598            html_td(dba_fetch("pn:$package", $pack_db)) .
1599            html_td(sprintf("%.2f%%", 100 * dba_fetch("pn:$package", $pack_db) / dba_fetch("pnmax:", $pack_db))) .
1600            html_td(dba_fetch("pnr:$package", $pack_db)) .
1601            html_td(html_a("Graph", "http://people.debian.org/~igloo/popcon-graphs/index.php?packages=". rawurlencode($package))),
1602            "", $back_tr_color
1603        );
1604        return $row;
1605    }
1606    
1607    function print_popcon($popcon)
1608    {
1609        global $pack_db;
1610        global $counter_span;
1611    
1612        $packagedata = dba_fetch($popcon, $pack_db);
1613        if (!$packagedata) {
1614            print html_h("No Popularity contest entry for $popcon", 2);
1615            return;
1616        }
1617        preg_match("/(.+)\((.+)\)/", $packagedata, $result);
1618        $binaries = split (", ", $result[2]);
1619    
1620        print html_h("Popularity contest statistics for $popcon", 2);
1621        $help = html_ul(
1622            html_li("<b>Name</b> is the package name") .
1623            html_li("<b>Inst.</b> is the number of people who installed this package") .
1624            html_li("<b>Vote</b> is the number of people who use this package regularly") .
1625            html_li("<b>Old</b> is the number of people who installed, but do not use this package regularly") .
1626            html_li("<b>Recent</b> is the number of people who upgraded this package recently") .
1627            html_li("<b>No Files</b> is the number of people whose entry did not contain enough information (atime and ctime were 0)") .
1628            html_li("Within parenthesis the number represents the number of registered popcon users that sent information about this topic"),
1629            "small");
1630        print html_collexp($counter_span, html_b("Help"), "general", true, $help);
1631    
1632        $table = array();
1633        foreach ($binaries as $bin_package) {
1634            $table[] = print_popcon_entry($bin_package, $back_tr_color);
1635            $back_tr_color = $back_tr_color ? "" : "#dcdcdc";
1636        }
1637        print html_table(
1638            html_tr(
1639                html_th("Name", "", 2, 1) .
1640                html_th("Inst (". dba_fetch("pimax:", $pack_db) .")", "1st: ". dba_fetch("pimax:n", $pack_db), 1, 3) .
1641                html_th("Vote (". dba_fetch("pvmax:", $pack_db) .")", "1st: ". dba_fetch("pvmax:n", $pack_db), 1, 3) .
1642                html_th("Old (". dba_fetch("pomax:", $pack_db) .")", "1st: ". dba_fetch("pomax:n", $pack_db), 1, 3) .
1643                html_th("Recent (". dba_fetch("prmax:", $pack_db) .")", "1st: ". dba_fetch("prmax:n", $pack_db), 1, 3) .
1644                html_th("No Files (". dba_fetch("pnmax:", $pack_db) .")", "1st: ". dba_fetch("pnmax:n", $pack_db), 1, 3) .
1645                html_th("Graph", "", 2, 1)) .
1646            html_tr(
1647                html_th("Number") . html_th("%") . html_th("Rank") .
1648                html_th("Number") . html_th("%") . html_th("Rank") .
1649                html_th("Number") . html_th("%") . html_th("Rank") .
1650                html_th("Number") . html_th("%") . html_th("Rank") .
1651                html_th("Number") . html_th("%") . html_th("Rank")),
1652            $table, "", "small");
1653    }
1654    
1655    # get WNPP bugs
1656    function print_wnpp_entry($key)
1657    {
1658        static $wnpp_db;
1659        if (!$wnpp_db) $wnpp_db = dba_open("/org/qa.debian.org/data/bts/wnpp_by_maint.db", 'r-', 'db4');
1660        $wnpp = dba_fetch($key, $wnpp_db);
1661        # [so]:address -> (nnnnnn time title)|*
1662        if (!$wnpp) {
1663            $li = html_li("None");
1664        } else {
1665            $bugs = explode("|", $wnpp);
1666            foreach ($bugs as $bug) {
1667                preg_match("/^(\d+) (\d+) (.*)/", $bug, $result);
1668                $a = html_a("#$result[1]: $result[3]", "http://bugs.debian.org/$result[1]");
1669                $li .= html_li($a ." (". ceil((time() - $result[2])/86400) ." day(s) old)");
1670            }
1671        }
1672        print html_ul($li);
1673    }
1674    
1675    # main program
1676    
1677    # open package info db
1678    # source(binary, binary)[versions]{uninstalable_stable}{_testing}{_unstable}|priority|:section:
1679    $pack_db = dba_open("$prefix/ddpo_packages.db", 'r-', 'db4');
1680    $uploads_db = dba_open("$prefix/uploads.db", 'r-', 'db4');
1681    
1682  if($comaint == "")  if($comaint == "")
1683  {  {
1684    $comaint = "yes";    $comaint = "yes";
# Line 1465  if(@$excuse) Line 1689  if(@$excuse)
1689      do_extra($excuse, "excuses", "No excuse for $excuse");      do_extra($excuse, "excuses", "No excuse for $excuse");
1690  }elseif(@$popcon)  }elseif(@$popcon)
1691  {  {
1692      do_extra($popcon, "popcon", "No Popularity contest entry for $popcon");      print_popcon($popcon);
1693        printBackLink("?package=$popcon");
1694    
1695  }elseif(@$wnpp)  }elseif(@$wnpp)
1696  {  {
1697      do_extra($wnpp, "wnpp", "No Wnpp entries for $wnpp");      if (!strstr($wnpp, "@")) $wnpp .= "@debian.org";
1698        print html_h("WNPP bugs submitted by $wnpp", 2);
1699        print_wnpp_entry("s:$wnpp");
1700        print html_h("WNPP bugs owned by $wnpp", 2);
1701        print_wnpp_entry("o:$wnpp");
1702        printBackLink("?login=$wnpp");
1703    
1704  }else if(@$gpg_key)  }else if(@$gpg_key)
1705  {  {
1706      $contents = file("$prefix/extract");      $contents = file("$prefix/ddpo_maintainers");
1707    
     $printed = 0;  
1708      $match = 0;      $match = 0;
   
1709      $gpg_key = preg_replace ("/0x/i", "", $gpg_key);      $gpg_key = preg_replace ("/0x/i", "", $gpg_key);
1710      foreach ($contents as $line)      foreach ($contents as $line)
1711      {      {
1712          if(preg_match("/;(.+?);(.*$gpg_key.*);(.+?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array))          if(preg_match("/^;[^;]*;[^;]*$gpg_key/i", $line))
1713          {          {
1714                preg_match("/^;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array);
1715              $match += 1;              $match += 1;
1716              print_header_entries_top($pack_array[1], $pack_array[2], $pack_array[3]);              print_developer($pack_array[1], $pack_array[2], $pack_array[3], $comaint, array_slice($pack_array, 3));
             print_header_entries_body($pack_array[2], $pack_array[3], $comaint, $pack_array[1]);  
             $count = 4;  
             foreach ($branch as $value)  
             {  
                 if($pack_array[$count] != "") print_package_entries($value, $pack_array[$count], $comaint);  
                 $count += 1;  
             }  
1717              print html_br();              print html_br();
1718                if($match > 10){ break; }
1719          }          }
1720      }      }
1721      if($match == 0)      if($match == 0)
1722      {      {
1723          print_notfound($gpg_key);          print_notfound($gpg_key);
1724      }      }
   
1725      printBackLink();      printBackLink();
1726  }elseif(@$login)  
1727    }elseif(@$login)
1728  {  {
1729      $login = preg_replace ("/\+/", "\+", $login);      $login = preg_replace ("/\+/", "\+", $login);
1730      $fp = fopen("$prefix/extract", "r");      if (preg_match("/^[a-z0-9]+$/", $login)) $login .= "@debian.org";
     $contents = fread($fp, filesize ("$prefix/extract"));  
1731    
1732      if (preg_match("/\S \S/", $login) || preg_match("/^[A-Z][^@]+$/", $login))      $contents = file("$prefix/ddpo_maintainers");
1733    
1734        $match = 0;
1735        foreach($contents as $line)
1736      {      {
1737          if (preg_match("/;(.*?);(.*?);(.*$login.*);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/", $contents, $pack_array))          if (preg_match("/^;[^;]*;[^;]*;[^;]*$login/i", $line) || # substring for name
1738          {              preg_match("/^;$login;/i", $line)) # exact match for mail
1739              print_header_entries_top($pack_array[1], $pack_array[2], $pack_array[3]);          {
1740              print_header_entries_body($pack_array[2], $pack_array[3], $comaint, $pack_array[1]);              preg_match("/^;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array);
1741              $count = 4;              $match += 1;
1742              foreach ($branch as $value)              print_developer($pack_array[1], $pack_array[2], $pack_array[3], $comaint, array_slice($pack_array, 3));
1743              {              print html_br();
1744                  if($pack_array[$count] != "") print_package_entries($value, $pack_array[$count], $comaint);              if($match > 10){ break; }
1745                  $count += 1;          }
1746              }      }
1747          }else{      if($match == 0) {
1748              print_notfound($login);          print_notfound($login);
1749          }          if(isdisplayed('uploads'))
1750      }else{              print_uploaded_packages($login, $comaint);
         if (! preg_match("/@/", $login)) $login .= "@debian.org";  
         if (preg_match("/;$login;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $contents, $pack_array))  
         {  
             print_header_entries_top($login, $pack_array[1], $pack_array[2]);  
             print_header_entries_body($pack_array[1], $pack_array[2], $comaint, $login);  
             $count = 3;  
             foreach ($branch as $value)  
             {  
                 if($pack_array[$count] != "") print_package_entries($value, $pack_array[$count], $comaint);  
                 $count += 1;  
             }  
         }else{  
             print_notfound($login);  
         }  
1751      }      }
     fclose($fp);  
1752      printBackLink();      printBackLink();
1753    
1754  }elseif(@$package)  }elseif(@$package)
1755  {  {
1756      $fp = fopen("$prefix/extract", "r");      $contents = file("$prefix/ddpo_maintainers");
1757      $found = 0;      $package_re = preg_replace("/\+/", ".", $package);
1758      if(preg_match("/\+\+/", $package))  
1759      {      $match = 0;
1760          $package_short = preg_replace("/\+/", "", $package);      foreach($contents as $line)
         $regexp="/[ ;]$package_short..\(/";  
         $regexp2="[ ;]$package_short..\(";  
     }elseif(preg_match("/\+/", $package))  
     {  
         $package_short = preg_replace("/\+/", "", $package);  
         $regexp="/[ ;]$package_short.\(/";  
         $regexp2="[ ;]$package_short.\(";  
     }else{  
         $regexp="/[ ;]$package\(/";  
         $regexp2="[ ;]$package\(";  
     }  
     while(!feof($fp))  
1761      {      {
1762          $line = freadline($fp, "32768");          if (preg_match("/[; ]${package_re}[; \#]/i", $line))
1763          if(preg_match("$regexp", $line, $results))          {
1764          {              preg_match("/^;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array);
1765              $found = 1;              $match += 1;
1766              preg_match("/;(.+?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array);              print_developer($pack_array[1], $pack_array[2], $pack_array[3], $comaint, array_slice($pack_array, 3));
             preg_match("/$regexp2(?:.+?\)\[)(?:\S+?):(?:.+?):(.+?) /i", $line, $result);  
             if(($comaint == "no") && ( preg_match("/\#/", $result[1]))) continue;  
   
             print_header_entries_top($pack_array[1], $pack_array[2], $pack_array[3]);  
             print_header_entries_body($pack_array[2], $pack_array[3], $comaint, $pack_array[1]);  
             $count = 4;  
             foreach ($branch as $value)  
             {  
                 if($pack_array[$count] != "") print_package_entries($value, $pack_array[$count], $comaint);  
                 $count += 1;  
             }  
1767              print html_br();              print html_br();
1768                if($match > 10){ break; }
1769          }          }
1770      }      }
1771      if($found == 0)      if($match == 0)
1772      {      {
1773          print_notfound($package);          print_notfound($package);
1774      }      }
     fclose($fp);  
1775      printBackLink();      printBackLink();
1776  }else{  
1777    if(@$all) {  }elseif(@$all)
1778    {
1779      print_all();      print_all();
1780    }else{  }else{
1781      print_form();      print_form();
   }  
1782  }  }
1783    
1784  print_footer();  print_footer();
1785  ?>  ?>
1786    
1787    # vim:sw=4:ft=php:et:

Legend:
Removed from v.834  
changed lines
  Added in v.1181

  ViewVC Help
Powered by ViewVC 1.1.5