# keep the header in php generated file
$text
"; } function html_blank() { return " "; } function html_br() { return "user <address> Process commands for <address>. Defaults to the address used in the From: header. subscribe <srcpackage> [<section>] Adds <srcpackage> to the listing. If <section> is omitted, defaults to \"ddpo\". This command can also be used to move <srcpackage> to a different section. The special section \"uploader\" allows subscription to uploads made by a developer (identified by key id). unsubscribe <srcpackage> Removes the <srcpackage> from the listing. help Print help text. quit thanks Stops processing commands."; $form .= "Example:"; $form .= "
user cb@df7cb.de subscribe endeavour subscribe rdiff-backup sponsor-panthera unsubscribe libextractor subscribe myon@debian.org uploader"; $form .= "Alternatively, one can append &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(); $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") ."."; print $form; } /* Construct the page where all maintainer are displayed */ function print_all() { global $prefix; $maint = file("$prefix/ddpo_maintainers"); $html = html_h("Sorted developer list", 2); $display_table_th = html_th("Name and email"); $display_table_th .= html_th("main"); $display_table_th .= html_th("non-us"); $display_table_th .= html_th("Other" . html_br(), html_small("all contrib &" . html_br() . "non-free packages")); $display_table_th .= html_th("Total"); $trs = array(); foreach($maint as $line) { if($line != "") { $count = 0; $line = preg_replace("/, /", ",", $line); preg_match("/;([^;]+?);([^;]+?);([^;]*?);([^;]*?);([^;]*?);([^;]*?);([^;]*?);([^;]*?);([^;]*)$/", $line, $info_array); $tds = html_td(html_b(html_a(str_replace(" ", html_blank(), "$info_array[3]") . html_blank() . "<$info_array[1]>", "developer.php?login=" . rawurlencode($info_array[1]))), 15); $main = 0; $nonUS = 0; $other = 0; if($info_array[4] != "") { $main += count(explode(" ", $info_array[4])); $count += count(explode(" ", $info_array[4])); } if($info_array[5] != "") { $other += count(explode(" ", $info_array[5])); $count += count(explode(" ", $info_array[5])); } if($info_array[6] != "") { $nonUS += count(explode(" ", $info_array[6])); $count += count(explode(" ", $info_array[6])); } 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])); } $tds .= html_td($main) . html_td($nonUS) . html_td($other) . html_td(html_b($count)); $trs[] = html_tr($tds, "center"); } } print html_table(html_tr($display_table_th), $trs, "80"); } /* Small useful function to construct the link to the excuses */ function get_rep($package_name) { if(preg_match("/^lib/", $package_name)) { return substr($package_name, 0, 4); }else{ return substr($package_name, 0, 1); } } # Begin of Dehs functions function dehsdb_conn ($dbname,$mode) { $id = dba_open($dbname, $mode, "db4"); return $id; } function dehsdb_xml($xml) { $p = xml_parser_create(); xml_parse_into_struct($p, $xml, $vals, $index); xml_parser_free($p); $values=array("id"=>$vals[1][value],"up_version"=>$vals[2][value],"wwiz"=>$vals[3][value]); return $values; } function dehs_value($pkg_name,$dist) { $id = dehsdb_conn("/org/qa.debian.org/data/dehs/dehs_qa_" . $dist . ".db","r"); if(!$id) return "error"; if (!dba_exists($pkg_name,$id)) return array("id"=>"-","up_version"=>"-","wwiz"=>"-"); $xml=dba_fetch($pkg_name,$id); dba_close($id); return dehsdb_xml($xml); } function vers_conv($debvers) { preg_match("/(.+:)?([^-]+)(ds|dsfg|debian)/",$debvers,$matches); if (!$matches[3]) { unset($matches); preg_match("/(.+:)?([^-]+)/",$debvers,$matches); } if (substr($matches[2],-1)=='.') $matches[2]=substr($matches[2],0,-1); return $matches[2]; } function ver_comp($a,$b) { exec("dpkg --compare-versions '$a' gt '" . vers_conv($b) . "'",$output,$res); if ($res==0) return 1; exec("dpkg --compare-versions '$a' lt '" . vers_conv($b) . "'",$output,$res); if ($res==0) return 2; else return 3; } function print_dehs($package,$version,$dist,$type) { $dehs_values=dehs_value($package,$dist); if($dehs_values=="error") return html_td(html_color("no value", "grey")); if ($type=="up_version") { $dehs_link= html_br() . html_a("Details", "http://dehs.alioth.debian.org/maintainer.php?name=" . rawurlencode($package)); if($dehs_values[up_version]=="-") { $dehs_values[up_version] = "-"; $dehs_link=''; } elseif ($dehs_values[up_version]=='N/A') { $color="black"; } elseif ($dehs_values[up_version]=='Error') $color="red"; elseif(ver_comp($dehs_values[up_version],$version)==1) $color="magenta"; elseif(ver_comp($dehs_values[up_version],$version)==2) $color="#2222AA"; else { $color="green"; $dehs_link=''; } $upstream_print = html_td(html_color($dehs_values[up_version], $color) . $dehs_link, "", 1, 1); return $upstream_print; }else{ $wwiz_link_desc="Details"; if($dehs_values[wwiz]=='-' or !$dehs_values[wwiz]) { $dehs_values[wwiz] = "-"; $dehs_link=''; } elseif ($dehs_values[wwiz]=='N/A') $color="black"; elseif ($dehs_values[wwiz]=='error' OR $dehs_values[wwiz]=='notmatch') $color="red"; elseif(ver_comp($dehs_values[wwiz],$version)==1) { $color="magenta"; $wwiz_link_desc="Watch"; } elseif(ver_comp($dehs_values[wwiz],$version)==2) { $color="#2222AA"; $wwiz_link_desc="Watch"; }else{ $color="green"; $wwiz_link_desc="Watch"; } if(!isset($dehs_link)) { $dehs_link= html_br() . html_a($wwiz_link_desc, "http://dehs.alioth.debian.org/wwiz_detail.php?id=" . $dehs_values[id] . "&type=watch"); } $wwiz_print= html_td(html_color($dehs_values[wwiz], $color, "", 1, 1)); return $wwiz_print; } } # Check whether there is a debcheck entry for that package function debcheckavailable($suite, $package_name) { $package = ereg_replace ("\.", "_", $package_name); if(ereg ("[^a-zA-Z0-9+_-]", $package) || ($suite != "oldstable" && $suite != "stable" && $suite != "testing" && $suite != "unstable")) { return 0; } $BASEDIR='/org/qa.debian.org/data/debcheck/result/'; return file_exists($BASEDIR.'/'.$suite.'/packages/'.$package); } /* Print possible wnpp entries and/or removal requests for this source package as consise links, or nothing if there are none */ function get_wnpp_rm($package) { static $db; if (!$db) $db = dba_open("/org/qa.debian.org/data/bts/wnpp_rm.db", 'r-', 'db4'); if (!$db) return; $entries = dba_fetch($package, $db); if (!$entries) return; $entries = explode('|', $entries); $ret = ""; foreach ($entries as $entry) { preg_match('/(\\S+)\\s+(\\S+)/', $entry, $m); $ret .= "[$m[1]]"; } return $ret; } /* annotate version number with mouseover title */ function format_version($package, $version, $class) { global $uploads_db; $date = dba_fetch("ud:$package:$version", $uploads_db); $uploader = dba_fetch("ul:$package:$version", $uploads_db); if ($date or $uploader) return html_span($version, "", $class, "title=\"$date ($uploader)\""); return $version; } /* This function prints a package table information row */ function print_package_entry($branch, $package, $comaint, $back_tr_color) { global $prefix; global $pack_db; global $seen_packages; # handle co-maintained packages $uploader = false; if(strstr($package, "#")) { $uploader = 1; $package = str_replace("#", "", $package); } if ((($uploader == 1) && ( $comaint == "no")) || (($uploader == 0) && ( $comaint == "only"))) return ""; # skip already displayed packages if(in_array($package, $seen_packages)) return ""; $seen_packages[] = $package; # get package data $packagedata = dba_fetch($package, $pack_db); preg_match("/(.+)\((.+)\)/", $packagedata, $result); $binaries = split (", ", $result[2]); if(strstr($packagedata, "%")) { $arch_all = 1; $packagedata = str_replace("%", "", $packagedata); } preg_match("/(.+?)\[(.+)\]\{(.+)\}\{(.+)\}\{(.+)\}\|(.*)\|:(.*):/", $packagedata, $results); $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 = html_wrap2lines($results[3]); $uninstalable_testing = html_wrap2lines($results[4]); $uninstalable_unstable = html_wrap2lines($results[5]); $priority = $results[6]; $section = $results[7]; $urlpackage = rawurlencode($package); // 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-', 'db4'); if (!($bug_list = dba_fetch($package, $bugsdb))) $bug_list = '0(0) 0(0) 0(0) 0(0)'; $bug_list = explode(' ', $bug_list); if(strcmp($version_stable, "-") == 0 || !debcheckavailable('stable', $package)) { $stable_dep = "-"; }else{ $stable_dep = html_a("St", "http://qa.debian.org/debcheck.php?dist=stable&package=$urlpackage"); } if(strcmp($version_testing, "-")== 0 || !debcheckavailable('testing', $package)) { $testing_dep = "-"; }else{ $testing_dep = html_a("Te", "http://qa.debian.org/debcheck.php?dist=testing&package=$urlpackage"); } if(strcmp($version_unstable, "-")== 0 || !debcheckavailable('unstable', $package)) { $sid_dep = "-"; }else{ $sid_dep = html_a("Un", "http://qa.debian.org/debcheck.php?dist=unstable&package=$urlpackage"); } $buildd = "http://buildd.debian.org/build.php?pkg=$urlpackage"; $pool = "http://ftp.debian.org/debian/pool/"; if(strstr($section, "non-free")) { $pool .= "non-free"; }elseif(strstr($section, "contrib")) { $pool .= "contrib"; }else{ $pool .= "main"; } $pool .= "/" . get_rep($urlpackage) . "/" . $urlpackage . "/"; if(file_exists("$prefix/excuses/" . $package{0} . "/$package")) { $excuse = html_a("Excuses", "developer.php?excuse=$urlpackage") . " "; $excuse .= html_a("More", "http://bjorn.haxx.se/debian/testing.pl?package=$urlpackage"); }else{ $excuse = "-"; } # version numbers $stable = format_version($package, $version_stable, "stable"); $testing = format_version($package, $version_testing, "testing"); $ver = explode("-", $version_unstable); if((preg_match("/(.+\..+?)$/", $ver[count($ver) - 1], $toto)) && (count($ver) != 1)) { $unstable = format_version($package, $version_unstable, "nmu"); } else { $unstable = format_version($package, $version_unstable); } if((strcmp ($version_stable, $version_testing) == 0) && (strcmp ($version_stable, "/") != 0)) { if((strcmp ($version_unstable, $version_testing) == 0)) { $version_print = html_td($stable, "", 3, 1); }else{ $version_print = html_td($stable, "", 2, 1) . html_td($unstable); } }elseif(strcmp ($version_testing, $version_unstable) == 0) { $version_print = html_td($stable) . html_td($unstable, "", 2, 1); }else{ $version_print = html_td($stable) . html_td($testing) . html_td($unstable); } $version_print .= html_td(format_version($package, $version_prop, "tpu")) . html_td(format_version($package, $version_experimental, "experimental")); /* * Create output */ $line_data = html_b(htmlspecialchars($package)) . get_wnpp_rm($package) . html_br() . html_a("PTS", "http://packages.qa.debian.org/".get_rep($urlpackage)."/$urlpackage.html") . html_blank() . html_a("Pool", $pool); $line = html_td(html_color($line_data, $uploader == 1 ? "blue" : "")); /* if bugs >= 1 always print the summary */ if(isdisplayed('bugs')) { $bugs = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=$urlpackage&archive=no&pend-exc=pending-fixed&pend-exc=fixed&pend-exc=done"; $bugs_all = "http://bugs.debian.org/cgi-bin/pkgreport.cgi?src=$urlpackage"; $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($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("-", $bugs_all . "&sev-inc=critical&sev-inc=grave&sev-inc=serious", "dash"); }else{ $bug_data = bugs_display($bug_list[0], "$bugs" . "&sev-inc=critical&sev-inc=grave&sev-inc=serious"); } $line .= html_td($bug_data); if(!strcmp($bug_list[1], "0(0)")) { $bug_data = html_a("-", $bugs_all . "&sev-inc=important&sev-inc=normal", "dash"); }else{ $bug_data = bugs_display($bug_list[1], "$bugs" . "&sev-inc=important&sev-inc=normal"); } $line .= html_td($bug_data); if(!strcmp($bug_list[2], "0(0)")) { $bug_data = html_a("-", $bugs_all . "&sev-inc=minor&sev-inc=wishlist", "dash"); }else{ $bug_data = bugs_display($bug_list[2], "$bugs" . "&sev-inc=minor&sev-inc=wishlist"); } $line .= html_td($bug_data); if(!strcmp($bug_list[3], "0(0)")) { $bug_data = html_a("-", $bugs_all . "&archive=no&pend-inc=pending-fixed&pend-inc=fixed", "dash"); }else{ $bug_data = bugs_display($bug_list[3], $bugs_all ."&archive=no&pend-inc=pending-fixed&pend-inc=fixed"); } $line .= html_td($bug_data); /* user only wants summary + rc bugs count */ }elseif(isdisplayed('bugs') == 3) { if(!strcmp($bug_list[0], "0(0)")) { $bug_data = html_a("-", $bugs_all . "&sev-inc=critical&sev-inc=grave&sev-inc=serious", "dash"); }else{ $bug_data = bugs_display($bug_list[0], "$bugs" . "&sev-inc=critical&sev-inc=grave&sev-inc=serious"); } $line .= html_td($bug_data); } } if(isdisplayed('version')) $line .= $version_print; if(isdisplayed('excuses')) $line .= html_td($excuse); if(isdisplayed('bin')) { $bin_display = ""; for ($i = 1; $i <= count($binaries); $i++) { $bin_package = $binaries[$i - 1]; if (!$bin_package) continue; $description = dba_fetch("d:$bin_package", $pack_db); $bin_display .= html_a($i, "http://packages.debian.org/" . rawurlencode($bin_package), "", "$bin_package - $description") . " "; if (count($binaries) > 9 and $i == 7) { $bin_display .= "... "; $i = count($binaries) - 1; continue; } } $line .= html_td($bin_display); } if(isdisplayed('buildd')) { $buildd_display = ""; if(@$arch_all || preg_match("/non-free/", $branch) || (strcmp($version_unstable, "-") == 0)) { $buildd_display = html_td("-"); $arch_all = 0; }else{ $buildd_display = html_td(html_a("Buildd", $buildd) . html_br() . html_a("More", "http://people.debian.org/~igloo/status.php?packages=$urlpackage")); } $line .= $buildd_display; } if(isdisplayed('security')) { if(strcmp($security_stable,"-")) $security_stable = format_version($package, $security_stable, "security"); if(strcmp($security_testing,"-")) $security_testing = format_version($package, $security_testing, "security"); $line .= html_td($security_stable) . html_td($security_testing); } if(isdisplayed('problems')) $line .= html_td($stable_dep) . html_td($testing_dep) . html_td($sid_dep); if(isdisplayed('uninstallable')) $line .= html_td($uninstalable_stable) . html_td($uninstalable_testing) . html_td($uninstalable_unstable); if(isdisplayed('popc')) { $line .= html_td(dba_fetch("p:$package", $pack_db) . html_br(). html_a("More", "developer.php?popcon=$urlpackage")); } if(isdisplayed('watch')) { $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($section . html_br() . $priority); return html_tr($line, "center", $back_tr_color); } /* This function prints a package table information for specific branch given in argument */ function print_package_entries($branch, $packages, $comaint) { global $prefix; global $uploads_db; $packages = preg_replace ("/, /", ",", $packages); $pack_array = split(" ", $packages); if ((isdisplayed('ordering') == 1) or ((isdisplayed('ordering') == 2) and ($branch != 'main') and ($branch != 'contrib') and ($branch != 'non-free'))) { $pack_sort = array(); foreach ($pack_array as $package) { $date = dba_fetch("ud:$package", $uploads_db); $pack_sort[$date.$package] = $package; } krsort($pack_sort, SORT_STRING); $pack_array = $pack_sort; } $trs = array(); foreach($pack_array as $package) { $tr = print_package_entry($branch, $package, $comaint, $back_tr_color); if($tr) { $trs[] = $tr; $back_tr_color = $back_tr_color ? "" : "#dcdcdc"; } } if (!count($trs)) return; print html_h(html_em($branch) . " (" . count($trs) . ")", 3); /* contruct the table header */ $ths = html_th("Source" . html_blank(). "Name", "", 2); if(isdisplayed('bugs') == 1) { $ths .= html_th("Bugs", "", 1, 5); }elseif(isdisplayed('bugs') == 2) { $ths .= html_th("Bugs", "", 1, 1); }elseif(isdisplayed('bugs') == 3) { $ths .= html_th("Bugs", "", 1, 2); } if(isdisplayed('version')) $ths .= html_th("Version", "", 1, 5); if(isdisplayed('excuses')) $ths .= html_th(html_span("Excuses", "", "", "title=\"Raw excuse and Björn Stenberg analysis\""), "", 2, 1); if(isdisplayed('bin')) $ths .= html_th("Binary" . html_br() . "Package Page", "", 2, 1); if(isdisplayed('buildd')) $ths .= html_th("Buildd", "", 2, 1); if(isdisplayed('security')) $ths .= html_th("Security", "", 1, 2); if(isdisplayed('problems')) $ths .= html_th("Debcheck", "", 1, 3); if(isdisplayed('uninstallable')) $ths .= html_th("Uninstallable", "", 1, 3); if(isdisplayed('popc')) $ths .= html_th("Popcon", "", 2, 1); if(isdisplayed('watch')) $ths .= html_th("Watch", "", 1, 4); if(isdisplayed('section')) $ths .= html_th("Section" . html_br() . "Priority", "", 2, 1); $th_level1 = html_tr($ths); $ths = ""; /* the second header line */ if(isdisplayed('bugs') == 1) { $ths .= html_th(html_span("All", "", "", "title=\"All opened bugs\"")); $ths .= html_th(html_span("RC", "", "", "title=\"Release Critical bugs\"")); $ths .= html_th(html_span("I&N", "", "", "title=\"Important & Normal bugs\"")); $ths .= html_th(html_span("M&W", "", "", "title=\"Minor & Wishlist bugs\"")); $ths .= html_th(html_span("F&P", "", "", "title=\"Fixed & Pending bugs\"")); } elseif(isdisplayed('bugs') == 2) { $ths .= html_th(html_span("All", "", "", "title=\"All opened bugs\"")); } elseif(isdisplayed('bugs') == 3) { $ths .= html_th(html_span("All", "", "", "title=\"All opened bugs\"")); $ths .= html_th(html_span("RC", "", "", "title=\"Release Critical bugs\"")); } if(isdisplayed('version')) { $ths .= html_th("Stable"); $ths .= html_th("Testing"); $ths .= html_th("Unstable"); $ths .= html_th(html_span("Prop Up", "", "", "title=\"Stable Proposed Updates\"")); $ths .= html_th("Exp"); } if(isdisplayed('security')) { $ths .= html_th("St"); $ths .= html_th("Te"); } if(isdisplayed('problems')) { $ths .= html_th("St"); $ths .= html_th("Te"); $ths .= html_th("Un"); } if(isdisplayed('uninstallable')) { $ths .= html_th("St"); $ths .= html_th("Te"); $ths .= html_th("Un"); } if(isdisplayed('watch')) { $ths .= html_th("Watch Unstable"); $ths .= html_th("WWiz Unstable"); $ths .= html_th("W Exp"); $ths .= html_th("WW Exp"); } $ths = $th_level1 . html_tr($ths); print html_table($ths, $trs, "", "small"); } function print_subscribed_packages($login, $comaint) { global $prefix; static $subscribe_db; # section1:pkg1 pkg2;section2:pkg3 if (!$subscribe_db) $subscribe_db = dba_open("$prefix/ddpo_subscribe.db", 'r-', 'db4'); $data = dba_fetch($login, $subscribe_db); if(!$data) { return; } $sections = explode(";", $data); foreach($sections as $section) { if (preg_match("/^uploader:(.*)/", $section, $secarray)) { $uploaders = explode(" ", $secarray[1]); foreach ($uploaders as $uploader) print_uploaded_packages($uploader, $comaint); continue; } preg_match("/^([^:]*):(.*)/", $section, $secarray); print_package_entries($secarray[1], $secarray[2], $comaint); } } function print_uploaded_packages($login, $comaint) { global $prefix; global $uploads_db; if (!strstr($login, "@")) $login .= "@debian.org"; $packages = dba_fetch($login, $uploads_db); if(!$packages) { return; } print_package_entries("Uploads by $login", $packages, $comaint); } function print_developer($login, $key, $name, $comaint, $pack_array) { global $branch; # reset seen packages list global $seen_packages; $seen_packages = array(); print_header_entries_top($login, $key, $name); print_header_entries_body($key, $name, $comaint, $login); $count = 1; foreach ($branch as $value) { if($pack_array[$count] != "") { print_package_entries($value, $pack_array[$count], $comaint); $no_packages = true; }elseif(! $no_packages){ print html_h("No packages in unstable", 3); $no_packages = true; } $count += 1; } print_subscribed_packages($login, $comaint); if(isdisplayed('packages')) print_package_entries("url", isdisplayed('packages'), $comaint); if(isdisplayed('uploads')) print_uploaded_packages($login, $comaint); if(isdisplayed('uploader')) { $uploaders = explode(" ", isdisplayed('uploader')); foreach ($uploaders as $uploader) print_uploaded_packages($uploader, $comaint); } } # popcon function print_popcon_entry($package, $back_tr_color) { global $pack_db; $row = html_tr( html_td(html_b($package)) . html_td(dba_fetch("pi:$package", $pack_db)) . html_td(sprintf("%.2f%%", 100 * dba_fetch("pi:$package", $pack_db) / dba_fetch("pimax:", $pack_db))) . html_td(dba_fetch("pir:$package", $pack_db)) . html_td(dba_fetch("pv:$package", $pack_db)) . html_td(sprintf("%.2f%%", 100 * dba_fetch("pv:$package", $pack_db) / dba_fetch("pvmax:", $pack_db))) . html_td(dba_fetch("pvr:$package", $pack_db)) . html_td(dba_fetch("po:$package", $pack_db)) . html_td(sprintf("%.2f%%", 100 * dba_fetch("po:$package", $pack_db) / dba_fetch("pomax:", $pack_db))) . html_td(dba_fetch("por:$package", $pack_db)) . html_td(dba_fetch("pr:$package", $pack_db)) . html_td(sprintf("%.2f%%", 100 * dba_fetch("pr:$package", $pack_db) / dba_fetch("prmax:", $pack_db))) . html_td(dba_fetch("prr:$package", $pack_db)) . html_td(dba_fetch("pn:$package", $pack_db)) . html_td(sprintf("%.2f%%", 100 * dba_fetch("pn:$package", $pack_db) / dba_fetch("pnmax:", $pack_db))) . html_td(dba_fetch("pnr:$package", $pack_db)) . html_td(html_a("Graph", "http://people.debian.org/~igloo/popcon-graphs/index.php?packages=". rawurlencode($package))), "", $back_tr_color ); return $row; } function print_popcon($popcon) { global $pack_db; global $counter_span; $packagedata = dba_fetch($popcon, $pack_db); if (!$packagedata) { print html_h("No Popularity contest entry for $popcon", 2); return; } preg_match("/(.+)\((.+)\)/", $packagedata, $result); $binaries = split (", ", $result[2]); print html_h("Popularity contest statistics for $popcon", 2); $help = html_ul( html_li("Name is the package name") . html_li("Inst. is the number of people who installed this package") . html_li("Vote is the number of people who use this package regularly") . html_li("Old is the number of people who installed, but do not use this package regularly") . html_li("Recent is the number of people who upgraded this package recently") . html_li("No Files is the number of people whose entry did not contain enough information (atime and ctime were 0)") . html_li("Within parenthesis the number represents the number of registered popcon users that sent information about this topic"), "small"); print html_collexp($counter_span, html_b("Help"), "general", true, $help); $table = array(); foreach ($binaries as $bin_package) { $table[] = print_popcon_entry($bin_package, $back_tr_color); $back_tr_color = $back_tr_color ? "" : "#dcdcdc"; } print html_table( html_tr( html_th("Name", "", 2, 1) . html_th("Inst (". dba_fetch("pimax:", $pack_db) .")", "1st: ". dba_fetch("pimax:n", $pack_db), 1, 3) . html_th("Vote (". dba_fetch("pvmax:", $pack_db) .")", "1st: ". dba_fetch("pvmax:n", $pack_db), 1, 3) . html_th("Old (". dba_fetch("pomax:", $pack_db) .")", "1st: ". dba_fetch("pomax:n", $pack_db), 1, 3) . html_th("Recent (". dba_fetch("prmax:", $pack_db) .")", "1st: ". dba_fetch("prmax:n", $pack_db), 1, 3) . html_th("No Files (". dba_fetch("pnmax:", $pack_db) .")", "1st: ". dba_fetch("pnmax:n", $pack_db), 1, 3) . html_th("Graph", "", 2, 1)) . html_tr( html_th("Number") . html_th("%") . html_th("Rank") . html_th("Number") . html_th("%") . html_th("Rank") . html_th("Number") . html_th("%") . html_th("Rank") . html_th("Number") . html_th("%") . html_th("Rank") . html_th("Number") . html_th("%") . html_th("Rank")), $table, "", "small"); } # get WNPP bugs function print_wnpp_entry($key) { static $wnpp_db; if (!$wnpp_db) $wnpp_db = dba_open("/org/qa.debian.org/data/bts/wnpp_by_maint.db", 'r-', 'db4'); $wnpp = dba_fetch($key, $wnpp_db); # [so]:address -> (nnnnnn time title)|* if (!$wnpp) { $li = html_li("None"); } else { $bugs = explode("|", $wnpp); foreach ($bugs as $bug) { preg_match("/^(\d+) (\d+) (.*)/", $bug, $result); $a = html_a("#$result[1]: $result[3]", "http://bugs.debian.org/$result[1]"); $li .= html_li($a ." (". ceil((time() - $result[2])/86400) ." day(s) old)"); } } print html_ul($li); } # main program # open package info db # source(binary, binary)[versions]{uninstalable_stable}{_testing}{_unstable}|priority|:section: $pack_db = dba_open("$prefix/ddpo_packages.db", 'r-', 'db4'); $uploads_db = dba_open("$prefix/uploads.db", 'r-', 'db4'); if($comaint == "") { $comaint = "yes"; } if(@$excuse) { do_extra($excuse, "excuses", "No excuse for $excuse"); }elseif(@$popcon) { print_popcon($popcon); printBackLink("?package=$popcon"); }elseif(@$wnpp) { if (!strstr($wnpp, "@")) $wnpp .= "@debian.org"; print html_h("WNPP bugs submitted by $wnpp", 2); print_wnpp_entry("s:$wnpp"); print html_h("WNPP bugs owned by $wnpp", 2); print_wnpp_entry("o:$wnpp"); printBackLink("?login=$wnpp"); }else if(@$gpg_key) { $contents = file("$prefix/ddpo_maintainers"); $match = 0; $gpg_key = preg_replace ("/0x/i", "", $gpg_key); foreach ($contents as $line) { if(preg_match("/^;[^;]*;[^;]*$gpg_key/i", $line)) { preg_match("/^;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array); $match += 1; print_developer($pack_array[1], $pack_array[2], $pack_array[3], $comaint, array_slice($pack_array, 3)); print html_br(); if($match > 10){ break; } } } if($match == 0) { print_notfound($gpg_key); } printBackLink(); }elseif(@$login) { $login = preg_replace ("/\+/", "\+", $login); if (preg_match("/^[a-z0-9]+$/", $login)) $login .= "@debian.org"; $contents = file("$prefix/ddpo_maintainers"); $match = 0; foreach($contents as $line) { if (preg_match("/^;[^;]*;[^;]*;[^;]*$login/i", $line) || # substring for name preg_match("/^;$login;/i", $line)) # exact match for mail { preg_match("/^;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array); $match += 1; print_developer($pack_array[1], $pack_array[2], $pack_array[3], $comaint, array_slice($pack_array, 3)); print html_br(); if($match > 10){ break; } } } if($match == 0) { print_notfound($login); if(isdisplayed('uploads')) print_uploaded_packages($login, $comaint); } printBackLink(); }elseif(@$package) { $contents = file("$prefix/ddpo_maintainers"); $package_re = preg_replace("/\+/", ".", $package); $match = 0; foreach($contents as $line) { if (preg_match("/[; ]${package_re}[; \#]/i", $line)) { preg_match("/^;(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*?);(.*)/i", $line, $pack_array); $match += 1; print_developer($pack_array[1], $pack_array[2], $pack_array[3], $comaint, array_slice($pack_array, 3)); print html_br(); if($match > 10){ break; } } } if($match == 0) { print_notfound($package); } printBackLink(); }elseif(@$all) { print_all(); }else{ print_form(); } print_footer(); ?> # vim:sw=4:ft=php:et: