| | | | This program is free software; you can redistribute it and/or | | modify it under the terms of the GNU General Public License | | as published by the Free Software Foundation; either version 2 | | of the License, or (at your option) any later version. | | | | This program is distributed in the hope that it will be useful, | | but WITHOUT ANY WARRANTY; without even the implied warranty of | | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | | GNU General Public License for more details. | +-------------------------------------------------------------------------+ | $Id$ +-------------------------------------------------------------------------+ */ //apd_set_pprof_trace(); // global variables $arg_cookie = array(); $prefix="/srv/qa.debian.org/data/ddpo/results"; $seen_packages = array(); $called_start_output = false; $comaint_re = '/^(yes|no|only)$/'; // filter to check for valid input for comaint parameter $filter_re = '/^[^<>&"]+$/'; // filter against special HTML characters error_reporting(E_ERROR|E_WARNING|E_PARSE); // FIXME: enable this further $time = microtime(); $components = array ("main", "contrib", "non-free"); $dists = array("oldstable", "stable", "testing", "unstable", "experimental"); $subdists = array(); $subdists['oldstable'] = array( "oldstable-incoming" => "os", "oldstable-security" => 0, "oldstable-proposed-updates" => 0, "oldstable-proposed-updates-new" => "os-pu_new", "oldstable-volatile" => "oldstable-volatile", "oldstable-bpo" => "oldstable-bpo"); $subdists['stable'] = array( "stable-incoming" => "is", "security" => 0, "stable-updates" => "su", "proposed-updates" => 0, "proposed-updates-new" => "pu_new", "volatile" => "volatile", "bpo" => "bpo"); $subdists['testing'] = array( "testing-incoming" => "it", "testing-security" => 0, "testing-proposed-updates" => 0, "testing-volatile" => "testing-volatile"); $subdists['unstable'] = array( "incoming" => "iu", "delayed" => "du", "new" => "nu"); $subdists['experimental'] = array( "experimental-incoming" => "ie", "experimental-delayed" => "de", "experimental-new" => "ne"); setlocale(LC_ALL, 'fr_FR'); setlocale(LC_TIME, 'C'); setlocale(LC_NUMERIC, 'C'); /* pick up cookies information or generate default one */ if (!empty($_COOKIE['columnsinfo']) and ($_GET['reset'] != 'yes')) { $tmp = $_COOKIE['columnsinfo']; $arg_cookie = unserialize(base64_decode($tmp)); } /* Set missing parts of the cookies */ $arg_cookie_def = array ( comaint => "yes", bugs => 3, version => 1, ubuntu => 1, excuses => 1, watch => 1, bin => 0, buildd => 1, problems => 1, lintian => 1, popc => 1, section => 0, ordering => 0, description => 0, mirror => 'http://cdn.debian.net/debian', uploads => 1); foreach ($arg_cookie_def as $key => $value) { if( (!array_key_exists($key, $arg_cookie)) or ($_GET['reset'] == 'yes') ) { $arg_cookie[$key] = $value; } } /* always set cookie with that values in order to keep it 3 months old since the last visit */ setcookie('columnsinfo', base64_encode(serialize($arg_cookie)), strtotime('+3 month')); /* if the "reset" arg is passed, need to extract action parameter in order to store the value into the new cookie */ if($_GET['reset'] != 'yes') { foreach(array_keys($_GET) as $key) { if (($key == 'login') or ($key == 'package') or ($key == 'wnpp') or ($key == 'gpg_key') or ($key == 'popcon')) { continue; } elseif (!strcmp($_GET[$key], "") or preg_match($filter_re, $_GET[$key])) { $arg_cookie[$key] = $_GET[$key]; } } /* Saniztize some values */ if (! preg_match($comaint_re, $arg_cookie['comaint'])) { $arg_cookie['comaint'] = "yes"; } if ($_GET['set'] == 'yes') setcookie('columnsinfo', base64_encode(serialize($arg_cookie)), strtotime('+3 month')); } function start_output ( $name="" ) { global $called_start_output; if( $called_start_output ) return; $called_start_output = true; header('Content-Type: text/html; charset="utf-8"'); header('Content-Script-Type: text/javascript'); header('Content-Style-Type: text/css'); header('Pragma: no-cache'); /* We build the title from the value passed in the first invocation of start_output which is almost always right, and never completely wrong. */ $title = ""; if ($name) $title = " for $name"; ?> Debian Developer's Packages Overview<? print $title ?> -- Debian Quality Assurance
This function return a html valid block */ function html_collexp($number, $text, $class, $collapsed, $data) { $info = html_blank() . "(click to collapse)"; $display = "block"; $result = html_span($text . html_small("$info") . html_br(),"click_$number", "span_$class", "onmouseover='javascript:objectOver(this)' onmouseout='javascript:objectOut(this)' onclick='javascript:collapse($number,\"$text\")'"); $result .= html_div($data, "text_$number", $class, "style='margin-left:0;display:$display'") ; if ($collapsed) $result .= "\n"; return $result; } ?> $name <$login> — Bugs: " . html_a("open", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=maint&data=$ulogin&archive=no&raw=yes&bug-rev=yes&pend-exc=fixed&pend-exc=done") . " - " . html_a("RC", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?which=maint&data=$ulogin&archive=no&pend-exc=done&sev-inc=critical&sev-inc=grave&sev-inc=serious") . " - " . html_a("all", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?maint=$ulogin") . " - " . html_a("submitted", "http://bugs.debian.org/cgi-bin/pkgreport.cgi?submitter=$ulogin") . " - " . html_a("WNPP", "wnpp.php?login=$ulogin") . " - " . html_a("\"Graph\"", "http://qa.debian.org/data/bts/graphs/by-maint/$ulogin.png") . " — "; $initial = substr($login, 0, 1); $maintainer_data .= "Reports: " . html_a("Dashboard", "http://udd.debian.org/dmd.cgi?email=$ulogin") . " - " . html_a("Buildd", "https://buildd.debian.org/status/package.php?p=$ulogin&comaint=" . isdisplayed('comaint')) . " - " . html_a("Lintian", "http://lintian.debian.org/reports/maintainer/$ulogin.html") . " - " . // down since 2006-11 - html_a("Checklib", "http://rerun.lefant.net/checklib/maintainers.$initial.html#$ulogin") . " - " . html_a("Debtags", "http://debtags.debian.net/reports/maint/$login") . " - " . // enrico says no encoding is ok html_a("Piuparts", "http://piuparts.debian.org/sid/maintainer/$initial/$ulogin.html"); static $nm_db; if (!$nm_db) $nm_db = dba_open("/srv/qa.debian.org/data/nm/nmstatus.db", 'r', 'db4'); if (($status = dba_fetch("status:".strtolower($login), $nm_db)) and strcmp($status, "NM")) $maintainer_data .= " - " . html_a("New Member", "https://nm.debian.org/nmstatus.php?email=$ulogin", "", "Next step: $status"); print html_small($maintainer_data); } /* Function used to display the generic information (help and display settings) */ function print_header_entries_top($login, $name) { $title = "Packages overview for $name"; if ($login) $title .= " <$login>"; print html_h($title, 2, "center"); } /* This function is used for the display settings table Note that there is a exception with bugs */ function checkbox($value) { global $arg_cookie; if($arg_cookie[$value] == 1) { $data = html_input_radio($value,1,true,"Show\n") . html_br(); $data .= html_input_radio($value,0,false,"Hide") . html_br(); }else{ $data = html_input_radio($value,1,false,"Show\n") . html_br(); $data .= html_input_radio($value,0,true,"Hide") . html_br(); } /* if($value == 'version') { if($arg_cookie[$value] == 2) { $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,true,"Without Exp. & Prop. Upt.\n") . html_br(); }elseif($arg_cookie[$value] == 1) { $data = html_input_radio($value,1,true,"Show\n") . html_br(); $data .= html_input_radio($value,0,false,"Hide\n") . html_br(); $data .= html_input_radio($value,2,false,"Without Exp. & Prop. Upt.\n") . html_br(); }else{ $data = html_input_radio($value,1,false,"Show\n") . html_br(); $data .= html_input_radio($value,0,true,"Hide\n") . html_br(); $data .= html_input_radio($value,2,false,"Without Exp. & Prop. Upt.\n") . html_br(); } } */ if($value == 'bugs') { $data = html_input_radio($value,1,$arg_cookie[$value] == 1,"Show (1)\n") . html_br(); $data .= html_input_radio($value,0,$arg_cookie[$value] == 0,"Hide (0)\n") . html_br(); $data .= html_input_radio($value,2,$arg_cookie[$value] == 2,"Sum. (2)\n") . html_br(); $data .= html_input_radio($value,3,$arg_cookie[$value] == 3,"Sum.&RC (3)\n") . html_br(); } elseif ($value == 'ordering') { $data = html_input_radio($value,0,$arg_cookie[$value] == 0, html_tooltip("Name (0)","'Name' sorts by package name") ) . html_br() . html_input_radio($value,1,$arg_cookie[$value] == 1, html_tooltip("Date (1)","'Date' sorts by upload date (descending).") ) . html_br() . html_input_radio($value,2,$arg_cookie[$value] == 2, html_tooltip("N./D. (2)", "'N./D.' sorts by name for main/contrib/non-free packages and by date for other sections.") ) . html_br() . html_input_radio($value,3,$arg_cookie[$value] == 3, html_tooltip("Section (3)", "'Section' sorts by sections first and by name secondly.") ); } elseif ($value == 'comaint') { $data = html_input_radio($value,"yes",!strcmp($arg_cookie[$value],"yes"),"yes\n") . html_br(); $data .= html_input_radio($value,"no",!strcmp($arg_cookie[$value],"no"),"no\n") . html_br(); $data .= html_input_radio($value,"only",!strcmp($arg_cookie[$value],"only"),"only\n") . html_br(); } elseif ($value == 'description') { $data = html_input_radio($value,1,$arg_cookie[$value] == 1,"In separate column\n") . html_br(); $data .= html_input_radio($value,0,$arg_cookie[$value] == 0,"As source mouseover only") . html_br(); } elseif ($value == 'buildd') { $data = html_input_radio($value,1,$arg_cookie[$value] == 1,"Show (1)\n") . html_br(); $data .= html_input_radio($value,0,$arg_cookie[$value] == 0,"Hide (0)\n") . html_br(); $data .= html_input_radio($value,2,$arg_cookie[$value] == 2,"Detail (2)\n") . html_br(); } $data = html_color($data,"green"); return $data; } function settings_entry($title, $extra, $value) { $line = ""; if ($extra != "") { $line .= html_span("$title", "", "head") . html_br() . html_color("($extra)", "black"); }else{ $line .= html_color($title, "green"); } $line .= html_br() . checkbox($value); return html_div($line); } function print_help() { $counter_span = 0; $display_data = html_div( 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. ")). "You can override the settings by providing an extra arg to the URL (e.g. &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).","","small"); $display_data = html_small($display_data); $display_data .= html_div( settings_entry("Co-maintained","&comaint=", "comaint") . settings_entry("Description","&description=", "description") . settings_entry("Bugs","&bugs=", "bugs") . settings_entry("Version","&version=", "version") . settings_entry("Ubuntu","&ubuntu=", "ubuntu") . settings_entry("Excuses","&excuses=", "excuses") . settings_entry("Binary Package","&bin=", "bin") . settings_entry("Buildd","&buildd=", "buildd") . settings_entry("Debcheck","&problems=", "problems") . settings_entry("Lintian","&lintian=", "lintian") . settings_entry("Popcon","&popc=", "popc") . settings_entry("Watch","&watch=", "watch") . settings_entry("Section","&section=", "section") . settings_entry("Ordering","&ordering=", "ordering") . settings_entry("Uploads","&uploads=", "uploads"), "settings", "small" ); $display_data .= "Additionally show packages: ". html_input_text("packages", isdisplayed('packages')); $display_data .= " uploaders: ". html_input_text("uploader", isdisplayed('uploader')) . html_br(); $display_data .= "Mirror: ". html_input_text("mirror", isdisplayed('mirror')) . html_br(); $preamble = setaction() . html_input_hidden("set", "yes"); $display_data = html_form("developer.php", "GET", $preamble, $display_data, "Submit"); $preamble = setaction() . html_input_hidden("reset", "yes"); $display_data .= html_form("developer.php", "GET", $preamble, "", "Show all"); $title = html_b("Display configuration:"); print html_span($title) . html_div($display_data); $counter_span += 1; $help_data = ""; if(!isdisplayed('description')) { $help_data .= "The description of the package is available as mouseover title from the package name." . html_br(); } $help_data .= "An asterisk (*) indicates the presence of co-maintainers (Uploaders: control field)" . html_br(); $help_data .= html_color("Blue", "blue") . " packages are co-maintained by this developer" . 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(); $help_data .= "Version columns are color-coded, mouseover titles show more information:" . html_br(); $help_data .= html_blank(). html_span("Cyan", "", "stable") . ": package in stable" . html_br(); $help_data .= html_blank(). html_span("Red", "", "security") . ": package in stable security (not shown if also in stable)" . html_br(); $help_data .= html_blank(). html_span("Dark blue", "", "proposed-updates") . ": package in stable proposed updates (not shown if also in stable security)" . html_br(); $help_data .= html_blank(). html_span("Light blue", "", "proposed-updates-new") . ": package " . html_a("pending", "http://ftp-master.debian.org/proposed-updates.html") . " for stable proposed updates (not shown if also in stable security)" . html_br(); $help_data .= html_blank(). html_span("Light purple", "", "volatile") . ": package on " . html_a("volatile.debian.org", "http://volatile.debian.org") . html_br(); $help_data .= html_blank(). html_span("Dark purple", "", "bpo") . ": package on " . html_a("backports.org", "http://backports.org/") . html_br(); $help_data .= html_blank(). html_span("Purple", "", "testing") . ": testing version" . html_br(); $help_data .= html_blank(). html_span("Green", "", "unstable") . ": unstable version" . html_br(); $help_data .= html_blank(). html_span("Red", "", "nmu") . ": non-maintainer upload" . html_br(); $help_data .= html_blank(). html_span("Grey", "", "new") . ": version in " . html_a("new", "http://ftp-master.debian.org/new.html") . html_br(); $help_data .= html_blank(). html_span("Orange", "", "incoming") . ": version in " . html_a("incoming", "http://incoming.debian.org/") . html_br(); $help_data .= html_blank(). html_span("Light Red", "", "delayed") . ": version in " . html_a("delayed", "http://people.debian.org/~djpig/delayed.html"). html_br(); $help_data .= "Ubuntu column:" . html_br(); $help_data .= html_blank().html_blank(). html_span("green", "", "uptodate") . ": Ubuntu version is in sync with version in unstable" . html_br(); $help_data .= html_blank().html_blank(). html_span("magenta", "", "behind") . ": Ubuntu version is greater than version in unstable" . html_br(); $help_data .= html_blank().html_blank(). html_span("navy blue", "", "ahead") . ": Ubuntu version is lower than version in unstable" . html_br(); $help_data .= "The 'Popcon' column displays the maximal install count for any binary in the source package" . html_br(); $help_data .= "Watch columns:" . html_br(); $help_data .= html_blank().html_blank(). html_span("green", "", "uptodate") . ": upstream found version is in sync with version in unstable/experimental" . html_br(); $help_data .= html_blank().html_blank(). html_span("magenta", "", "behind") . ": upstream found version is greater than version in unstable" . html_br(); $help_data .= html_blank().html_blank(). html_span("navy blue", "", "ahead") . ": upstream found version is lower than version in unstable (a bug in the watch file?)" . html_br(); $help_data .= html_blank().html_blank(). html_color("Error", "red") . ": uscan had problems following the watch file" . html_br(); $help_data .= "The 'pending uploads' section shows packages uploaded/Changed-By this developer in incoming, new, and delayed" . html_br(); $help_data .= "The 'uploads' sections show all packages in the archive signed by this developer's key (NMUs, sponsored, QA uploads)" . html_br().html_br(); $help_data = html_small($help_data); $title = html_b("Help"); print html_br() . html_collexp($counter_span, $title, "general", true, $help_data); } function print_notfound($what) { print html_p("No information available for ".htmlspecialchars($what)); } /* Construct page provided when no command is provided */ function print_form() { $form = html_h("Debian Developer's Packages Overview", 1); $preamble = "List of packages for maintainer:" . html_br(); $preamble .= html_input_text("login") . html_br(); $preamble .= html_small("Separate multiple logins by spaces. " . "Logins without @ get @debian.org appended. " . "If you include an uppercase letter, search is done by maintainer name; " . "only a single pattern (possibly including spaces) is accepted in that mode.") . html_br(); $form_data = "Display co-maintained packages:" . html_blank(); $form_data .= html_input_radio("comaint", "yes", true, "yes"); $form_data .= html_input_radio("comaint", "no", false, "no"); $form_data .= html_input_radio("comaint", "only", false, "only") . html_br(); $form .= html_form("developer.php", "GET", $preamble, $form_data, "Show packages"); $preamble = "Search based on the " . html_tt("GPG key ID:") . html_br(); $preamble .= html_input_text("gpg_key"); $preamble = html_label($preamble) . html_br(); $form_data = "Display co-maintained packages:" . html_blank(); $form_data .= html_input_radio("comaint", "yes", true, "yes"); $form_data .= html_input_radio("comaint", "no", false, "no"); $form_data .= html_input_radio("comaint", "only", false, "only"); $form_data = html_label($form_data) .html_br(); $form .= html_form("developer.php", "GET", $preamble, $form_data, "Find") . html_br(); $preamble = "List of packages for maintainer, query by source package name:" . html_br(); $preamble .= html_input_text("package") . html_br(); $form_data = "Display co-maintained packages:" . html_blank(); $form_data .= html_input_radio("comaint", "yes", true, "yes"); $form_data .= html_input_radio("comaint", "no", false, "no"); $form_data .= html_input_radio("comaint", "only", false, "only") . html_br(); $form .= html_form("developer.php", "GET", $preamble, $form_data, "Show packages"); $preamble = "List of packages, space separated:" . html_br(); $form_data = html_input_text("packages") . html_br(); $form .= html_form("developer.php", "GET", $preamble, $form_data, "Show packages"); $preamble = "List of packages for a task:" . html_br(); $form_data = html_input_text("task") . html_br(); $form .= html_form("developer.php", "GET", $preamble, $form_data, "Show task"); $preamble = "List of packages for a WNPP/RM tag: (RFP, ITP, ITA, O, RM)" . html_br(); $form_data = html_input_text("wnpptag") . html_br(); $form .= html_form("developer.php", "GET", $preamble, $form_data, "Show packages"); $form .= html_h("Subscribing to Packages", 2); $form .= "Additional packages can be added to the list of packages shown. There are two interfaces, URL and mail based.". html_br().html_br(); $form .= "Firstly, 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 .= "Secondly, 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:"; $form .= ""; print $form; } /* 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); } } /* function similar to "dpkg --compare-versions ..." */ function debversion_compare($va, $vb) { $version_re = '/ ^(?: ( \d+ ): )? ( [A-Za-z0-9.+:~-]+? ) (?: - ( [A-Za-z0-9+.~]+ ) )? $ /x'; preg_match($version_re, $va, $va); preg_match($version_re, $vb, $vb); $a = (int) $va[1]; $b = (int) $vb[1]; if ($a != $b) return $a - $b; $res = _debversion_compare_part($va[2], $vb[2]); if ($res != 0) return $res; $a = $b = '0'; if (array_key_exists(3, $va)) $a = $va[3]; if (array_key_exists(3, $vb)) $b = $vb[3]; $res = _debversion_compare_part($a, $b); return $res; } function _debversion_compare_part($va, $vb) { $la = preg_split('/(\d+|\D+)/', $va, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); $lb = preg_split('/(\d+|\D+)/', $vb, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); while ($la or $lb) { $a = $b = '0'; if ($la) $a = array_shift($la); if ($lb) $b = array_shift($lb); if (preg_match('/\d+/', $a) and preg_match('/\d+/', $b)) { $a = (int) $a; $b = (int) $b; if ($a != $b) return $a - $b; } else { $res = _debversion_compare_string($a, $b); if ($res != 0) return $res; } } return 0; } function _debversion_order($s) { if ($s == '~') return -1; else if (preg_match('/\d/', $s)) return 1 + (int)$s; else if (preg_match('/[a-zA-Z]/', $s)) return ord($s); else return ord($s) + 256; } function _debversion_compare_string($va, $vb) { $la = str_split($va); $lb = str_split($vb); while ($la or $la) { $a = $b = 0; if ($la) $a = _debversion_order(array_shift($la)); if ($lb) $b = _debversion_order(array_shift($lb)); if ($a != $b) return $a - $b; } return 0; } function print_dehs($package,$version,$dist) { if (! $version) return html_td('-'); $version = preg_replace( '/^\d+:/', '', $version ); static $db; if (!$db) $db = dba_open("/srv/qa.debian.org/data/ddpo/results/dehs.db", 'r', 'db4'); if (!$db) return; $dehs_version = dba_fetch($package."_".$version.":upstream-version", $db); if (! $dehs_version) $dehs_version = dba_fetch("$package:upstream-version", $db); if (! $dehs_version) return html_td('-'); $dehs_status = dba_fetch($package."_".$version.":status", $db); if (! $dehs_status) $dehs_status = dba_fetch("$package:status", $db); if (! $dehs_status) return html_td('-'); if ($dehs_status == "Newer version available") $class = 'behind'; else if ($dehs_status == "Debian version newer than remote site") $class = 'ahead'; else if ($dehs_status == "up to date") $class = 'uptodate'; else return html_td('-'); return html_td(html_a(html_span($dehs_version, "", $class), "/cgi-bin/watch?pkg=$package"."_".rawurlencode($version))); /* $dehs_values=dehs_value($package,$dist); $try_wwiz = false; $mangle = true; $dehs_link = null; // use the mangled debian version if dversion == $version if ($dehs_values['dversion'] == $version && $dehs_values['dversion'] != '-') { $version = ($dehs_values['dversionmangled'] != '-')? $dehs_values['dversionmangled'] : $version; $mangle = ($dehs_values['dversion'] == $dehs_values['dversionmangled']); } if ($dehs_values == 'error') { return html_td(html_color('no value', 'grey')); } if ($dehs_values['up_version'] == '-' || $dehs_values['up_version']=='N/A') { $try_wwiz = true; } elseif ($dehs_values['up_version']=='Error') $class='error'; else { if ($dehs_values['uptodate'] == 'no') { $class = 'behind'; } else { $ver_comp = ver_comp($dehs_values['up_version'],$version, $mangle); if ($ver_comp == 1) $class='behind'; else if ($ver_comp == 2) $class='ahead'; else { $class='uptodate'; $dehs_link=''; } } } // don't annoy people if the wwiz failed to find something useful if (!$try_wwiz || in_array($dehs_values['wwiz'], array('error', 'notmatch', 'no_cright'))) { if ($dehs_link === null) { $dehs_link = html_br() . html_a('Details', 'http://dehs.alioth.debian.org/report.php?package=' . rawurlencode($package)); } return html_td(html_span($dehs_values['up_version'], "", $class) . $dehs_link); } $wwiz_link_desc='Details'; if ($dehs_values['wwiz']=='-' || !$dehs_values['wwiz']) { $dehs_values['wwiz'] = '-'; $dehs_link=''; } elseif ($dehs_values['wwiz']=='N/A') $class=''; elseif (in_array($dehs_values['wwiz'], array('error', 'notmatch', 'no_cright'))) $class='error'; else { $wwiz_link_desc = 'Watch'; if ($dehs_values['uptodate'] == 'no') { $class = 'behind'; } else { $ver_comp = ver_comp($dehs_values['up_version'], $version, $mangle); if ($ver_comp == 1) $class='behind'; else if ($ver_comp == 2) $class='ahead'; else { $class='uptodate'; } } } if($dehs_link === null) { $dehs_link = html_br() . html_a($wwiz_link_desc, 'http://dehs.alioth.debian.org/wwiz_detail.php?id=' . $dehs_values['id'] . '&type=watch'); } return html_td(html_span($dehs_values['wwiz'], "", $class) . $dehs_link); */ } 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='/srv/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("/srv/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; global $releases_re; if (!$version or !strcmp($version, "-")) return "-"; $changedby = dba_fetch("ch:$package:$version", $uploads_db); if (!$changedby) $changedby = "(no projectb data found)"; $pclass = $class; if(preg_match("/(-[0-9]+\.|\+nmu)[0-9]+$/", $version)) $class = "nmu"; else if(!preg_match("/-[0-9]+$/", $version) and preg_match("/-/", $version) and !preg_match("/[0-9]+\+?($releases_re)[0-9]+$/", $version) and !preg_match("/~bpo[0-9]+\+[0-9]+$/", $version)) $class = "wrongversion"; return html_span($version, "", $class, "title=\"$pclass: $changedby\""); } /* This function prints a package table information row */ function print_package_entry($package, $uploader, $back_tr_color, $skip_seen) { global $prefix; global $dists; global $subdists; global $pack_db; global $incoming_db; global $seen_packages; global $dist2release; global $dist2bponewrelease; if($skip_seen and in_array($package, $seen_packages)) return ""; $seen_packages[] = $package; $binaries = explode(" ", dba_fetch("bin:$package", $pack_db)); $arch_all = !strcmp(dba_fetch("arch:$package", $pack_db), "all"); $version = array(); $version['oldstable'] = dba_fetch("olds:$package", $pack_db); $version['oldstable-incoming'] = dba_fetch("os:$package", $incoming_db); $version['oldstable-security'] = dba_fetch("olds-sec:$package", $pack_db); $version['oldstable-volatile'] = dba_fetch("oldstable-volatile:$package", $incoming_db); $version['oldstable-proposed-updates'] = dba_fetch("ospu:$package", $pack_db); $version['oldstable-proposed-updates-new'] = dba_fetch("os-pu_new:$package", $incoming_db); $version['oldstable-bpo'] = dba_fetch("oldstable-bpo:$package", $incoming_db); if( $dist2bponewrelease["oldstable"] ) $version[$dist2bponewrelease["oldstable"]] = dba_fetch($dist2bponewrelease["oldstable"].":$package", $incoming_db); $version['stable'] = dba_fetch("s:$package", $pack_db); $version['stable-incoming'] = dba_fetch("is:$package", $incoming_db); $version['security'] = dba_fetch("s-sec:$package", $pack_db); $version['proposed-updates'] = dba_fetch("spu:$package", $pack_db); $version['proposed-updates-new'] = dba_fetch("pu_new:$package", $incoming_db); $version['volatile'] = dba_fetch("volatile:$package", $incoming_db); $version['bpo'] = dba_fetch("bpo:$package", $incoming_db); if( $dist2bponewrelease["stable"] ) $version[$dist2bponewrelease["stable"]] = dba_fetch($dist2bponewrelease["stable"].":$package", $incoming_db); $version['testing'] = dba_fetch("t:$package", $pack_db); $version['testing-incoming'] = dba_fetch("it:$package", $incoming_db); $version['testing-security'] = dba_fetch("t-sec:$package", $pack_db); $version['testing-proposed-updates'] = dba_fetch("tpu:$package", $pack_db); $version['unstable'] = dba_fetch("u:$package", $pack_db); $version['incoming'] = dba_fetch("iu:$package", $incoming_db); $version['delayed'] = dba_fetch("du:$package", $incoming_db); $version['new'] = dba_fetch("nu:$package", $incoming_db); $version['experimental'] = dba_fetch("e:$package", $pack_db); $version['experimental-incoming'] = dba_fetch("ie:$package", $incoming_db); $version['experimental-delayed'] = dba_fetch("de:$package", $incoming_db); $version['experimental-new'] = dba_fetch("ne:$package", $incoming_db); $priority = dba_fetch("pri:$package", $pack_db); $section = dba_fetch("sec:$package", $pack_db); $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); $component = "main"; $pool = isdisplayed('mirror') . "/pool/"; if(strstr($section, "non-free")) { $component = "non-free"; }elseif(strstr($section, "contrib")) { $component = "contrib"; } $pool .= $component; $pool .= "/" . get_rep($urlpackage) . "/" . $urlpackage . "/"; /* * Create output */ static $descriptions_db; if (!$descriptions_db) $descriptions_db = dba_open("$prefix/descriptions.db", 'r', 'db4'); $description = htmlspecialchars(dba_fetch("d:$package", $descriptions_db)); if (!$description) /* use first binary if there is no binary with the source name */ $description = htmlspecialchars(dba_fetch("d:$binaries[0]", $descriptions_db)); if ($com_nr = dba_fetch("com:$package", $pack_db)) $com_nr = html_span("*", "", "", "title=\"$com_nr co-maintainer(s)\""); $package_quoted = htmlspecialchars($package); if (dba_fetch("dm:$package", $pack_db) and date("Y-m-d") < "2012-11-24") $dmpackage = html_span("[DM]", "", "", "title=\"Debian Maintainer upload allowed\""); global $global_carnivoreid; if( $global_carnivoreid ) foreach( carnivoreid2fingerprints( $global_carnivoreid ) as $fingerprint ) if( dba_fetch( "pf:$package:$fingerprint", dm_db() ) ) $dmpackage = html_span("[".html_color("DM","green")."]", "", "", "title=\"Debian Maintainer upload allowed\""); $line_data = html_b(html_span(html_a_name($package_quoted, $package_quoted), "", $uploader ? "uploader" : "", "title=\"$description\"")) . $com_nr . $dmpackage . 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($line_data); if(isdisplayed('description')) { $line .= html_td($description); } /* 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 = ""; for($i = 0; $i < 4; ++$i) { preg_match("/\d+\((\d+)\)/", $bug_list[$i], $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 . "
" . html_a("\"Graph\"", "/data/bts/graphs/" . get_rep($urlpackage)."/$urlpackage.png") . "
" ); /* 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')) { $ver = ""; $sub = ""; $colspan = 0; $cur_ver = ""; foreach ($dists as $dist) { if( $dist == "oldstable" and ! $dist2release[$dist] ) continue; // print information from previous dists if ($colspan and strcmp($version[$dist], $cur_ver)) { $line .= html_td($ver . $sub, "", $colspan, 1); $ver = ""; $sub = ""; $colspan = 0; } $cur_ver = $version[$dist]; if (strcmp($ver, "") == 0) // remember first format in multi-column display $ver = format_version($package, $version[$dist], $dist); $cur_sub = $version[$dist]; foreach ($subdists[$dist] as $subdist => $tag) { if ($version[$subdist] and strcmp($version[$subdist], $cur_sub)) { if ($tag) { $url = dba_fetch("$tag-url:$package", $incoming_db); $title = dba_fetch("$tag-title:$package", $incoming_db); $sub .= html_br() . html_a($version[$subdist], $url, $subdist, $title); } else { $sub .= html_br() . format_version($package, $version[$subdist], $subdist); } $cur_sub = $version[$subdist]; } } $colspan++; } $line .= html_td($ver . $sub, "", $colspan, 1); } if(isdisplayed('ubuntu')) { static $ubuntu_db; if (!$ubuntu_db) $ubuntu_db = dba_open("$prefix/ubuntu.db", 'r', 'db4'); $uversion = dba_fetch("uv:$package", $ubuntu_db); $ubugs = dba_fetch("ub:$package", $ubuntu_db); $upatches = dba_fetch("up:$package", $ubuntu_db); if ($ubugs> 0) { $ubugs = html_a($ubugs> 1 ? $ubugs." bugs" : $ubugs." bug", "https://bugs.launchpad.net/ubuntu/+source/$urlpackage"); if ($upatches> 0) { $upatches = html_a($upatches> 1 ? "($upatches"." patches)" : "($upatches"." patch)", "https://bugs.launchpad.net/ubuntu/+source/$urlpackage/+patches"); $ubugs .= " ".$upatches; } } else { $ubugs = html_a("-", "https://bugs.launchpad.net/ubuntu/+source/$urlpackage", "dash"); } if ($uversion) { $uversion = preg_replace('/build\d+/', '', $uversion); $ver_comp = debversion_compare($uversion, $version['unstable']); $class = $ver_comp> 0 ? 'behind' : ($ver_comp < 0 ? 'ahead' : 'uptodate'); // Shorten ubuntuX versions to uX, but only after comparing // the version number (just in case...) $uversion = preg_replace('/ubuntu([0-9.]+)$/', 'u$1', $uversion); $u = html_a(html_span($uversion, "", $class), "https://launchpad.net/ubuntu/+source/$urlpackage", $class) . html_br() . $ubugs; } else { $u = "-"; } $line .= html_td($u); } if(isdisplayed('excuses')) { if (strcmp($version['unstable'], "-") and strcmp($version['testing'], $version['unstable'])) { $excuse = html_a("Excuses", "excuses.php?package=$urlpackage") . html_br(); if ($component === "main") { $excuse .= html_a("More", "http://release.debian.org/migration/testing.pl?package=$urlpackage"); } } else { $excuse = "-"; } $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 = htmlspecialchars(dba_fetch("d:$bin_package", $descriptions_db)); $bin_display .= html_a($i, "http://packages.debian.org/" . rawurlencode($bin_package), "", "$bin_package - $description"); $bin_display .= (($i == 5) and (count($binaries)> 5)) ? html_br() : " "; if (count($binaries)> 9 and $i == 7) { $bin_display .= "... "; $i = count($binaries) - 1; continue; } } $line .= html_td($bin_display ? $bin_display : "-"); } if(isdisplayed('buildd') == 1) { if ($arch_all) { $buildd_display = html_td("-"); } else { $buildd_display = html_td( html_a("Buildd", "https://buildd.debian.org/status/package.php?p=$urlpackage") . html_br() . html_a("Logs", "https://buildd.debian.org/status/logs.php?pkg=$urlpackage") ); } $line .= $buildd_display; } if(isdisplayed('buildd') == 2) { $buildd_display = ""; $buildd_sid = dba_fetch("$package:sid", buildd_db()); if ($buildd_sid) { $buildd_display .= html_a($buildd_sid,"https://buildd.debian.org/status/package.php?p=$urlpackage","buildd-state"); } else { $buildd_display .= "-"; } $buildd_exp = dba_fetch("$package:experimental", buildd_db()); if ($buildd_exp) { $buildd_display .= html_br() . html_a($buildd_sid,"https://buildd.debian.org/status/package.php?p=$urlpackage&suite=experimental","buildd-state"); } $line .= html_td($buildd_display); } if(isdisplayed('problems')) { 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", "", "stable"); } 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", "", "testing"); } 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", "", "unstable"); } $line .= html_td($stable_dep) . html_td($testing_dep) . html_td($sid_dep); } if(isdisplayed('lintian')) { static $lintian_db; if (!$lintian_db) $lintian_db = dba_open("/srv/qa.debian.org/data/lintian/lintian-list.db", "r", "db4"); $errors = 0; $warnings = 0; $lintiandata = dba_fetch($package." ".$version['unstable'], $lintian_db); if(!$lintiandata) $lintiandata = dba_fetch($package, $lintian_db); if ($lintiandata) list($errors, $warnings) = split(" ", $lintiandata ); $maint = dba_fetch("maint:$package", $pack_db); if( $maint ) { $umaint = urlencode($maint); $lintianurl = "http://lintian.debian.org/reports/maintainer/$umaint.html#$package"; } else { $lintianurl = "http://lintian.debian.org/"; } if($errors) $line .= html_td(html_a($errors, $lintianurl)); else $line .= html_td(html_a("-", $lintianurl, "dash")); if($warnings) $line .= html_td(html_a($warnings, $lintianurl)); else $line .= html_td(html_a("-", $lintianurl, "dash")); } if(isdisplayed('popc')) { static $popcon_db; if (!$popcon_db) $popcon_db = dba_open("$prefix/../../popcon/popcon.db", 'r', 'db4'); $popcon = dba_fetch("p:$package", $popcon_db); $line .= html_td($popcon ? html_a($popcon, "popcon.php?package=$urlpackage") : "-", '', '', '', sprintf("%08d",$popcon)); } if(isdisplayed('watch')) { $line .= print_dehs($package,$version['unstable'],"unstable"); $line .= print_dehs($package,$version['experimental'],"experimental"); } if(isdisplayed('section')) $line .= html_td($section ? $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, $skip_seen) { global $uploads_db; global $dist2release; $packages = preg_replace ("/, /", ",", $packages); $pack_array = array_filter(explode(" ", $packages)); $uploader_array = array(); while ($package = current($pack_array)) { if(strstr($package, "#")) { $package = str_replace("#", "", $package); $pack_array[key($pack_array)] = $package; $uploader_array[$package] = 1; } next($pack_array); } if ((isdisplayed('ordering') == 1) or ((isdisplayed('ordering') == 2) and strcmp($branch, 'main') and strcmp($branch, 'contrib') and strcmp($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) { if (($uploader_array[$package] && !strcmp(isdisplayed("comaint"), "no")) || (!$uploader_array[$package] && !strcmp(isdisplayed("comaint"), "only"))) continue; $tr = print_package_entry($package, $uploader_array[$package], $back_tr_color, $skip_seen); if($tr) { $trs[] = $tr; $back_tr_color = $back_tr_color ? "" : "#dcdcdc"; } } if (!count($trs)) return; print html_h(html_a_name(html_em($branch) . " (" . count($trs) . ")", $branch), 3); /* contruct the table header */ $ths = html_th("Source" . html_blank(). "Name", "", 2); if(isdisplayed('description')) $ths .= html_th("Description", "", 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); } $number_of_releases = 5; if( ! $dist2release["oldstable"] ) $number_of_releases--; if(isdisplayed('version')) $ths .= html_th("Version", "", 1, $number_of_releases); if(isdisplayed('ubuntu')) $ths .= html_th("Ubuntu", "", 2, 1); 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", "", 2, 1); if(isdisplayed('buildd')) $ths .= html_th("Buildd", "", 2, 1); if(isdisplayed('problems')) $ths .= html_th("Debcheck", "", 1, 3); if(isdisplayed('lintian')) $ths .= html_th("Lintian", "", 1, 2); if(isdisplayed('popc')) $ths .= html_th("Popcon", "", 2, 1); if(isdisplayed('watch')) $ths .= html_th("Watch", "", 1, 2); 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')) { if( $dist2release["oldstable"] ) $ths .= html_th("Oldstable"); $ths .= html_th("Stable"); $ths .= html_th("Testing"); $ths .= html_th("Unstable"); $ths .= html_th("Exp"); } if(isdisplayed('problems')) { $ths .= html_th(html_span("St", "", "", "title=\"stable\"")); $ths .= html_th(html_span("Te", "", "", "title=\"testing\"")); $ths .= html_th(html_span("Un", "", "", "title=\"unstable\"")); } if(isdisplayed('lintian')) { $ths .= html_th(html_span("E", "", "", "title=\"Errors\"")); $ths .= html_th(html_span("W", "", "", "title=\"Warnings\"")); } if(isdisplayed('watch')) { $ths .= html_th("Unstable"); $ths .= html_th("Exp"); } $ths = $th_level1 . html_tr($ths); print html_table_begin("$ths", "", "packagetable sortable"); foreach ($trs as $line) print $line; print html_table_end(); } function subscribe_db() { global $prefix; static $subscribe_db; if (!$subscribe_db) $subscribe_db = dba_open("$prefix/ddpo_subscribe.db", 'r', 'db4'); return $subscribe_db; } function buildd_db() { global $prefix; static $buildd_db; if( ! $buildd_db ) $buildd_db = dba_open("/srv/qa.debian.org/data/buildd/buildd.db", 'r', 'db4'); return $buildd_db; } function wnpp_db() { global $prefix; static $wnpp_db; if( ! $wnpp_db ) $wnpp_db = dba_open("/srv/qa.debian.org/data/bts/wnpp_by_maint.db", 'r', 'db4'); return $wnpp_db; } function wnpp_orphaned_db() { static $db; if ( ! $db ) $db = dba_open("/srv/qa.debian.org/data/bts/wnpp_orphaned.db", 'r', 'db4'); return( $db ); } function is_orphaned( $package ) { if( dba_fetch($package, wnpp_orphaned_db() ) ) return true; return false; } function orphaned_packages() { $packages = array(); $package = dba_firstkey( wnpp_orphaned_db() ); while( $package ) { array_push( $packages, $package ); $package = dba_nextkey( wnpp_orphaned_db() ); } return $packages; } function filter_orphaned( $packages ) { $packages_filtered = array(); foreach ( $packages as $package ) { $package_stripped = preg_replace( '/#$/', '', $package ); if( ! is_orphaned( $package_stripped ) ) array_push( $packages_filtered, $package ); } return $packages_filtered; } function print_subscribed_packages($login) { $data = dba_fetch(strtolower($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(array($uploader)); continue; } preg_match("/^([^:]*):(.*)/", $section, $secarray); print_package_entries($secarray[1], $secarray[2], 1); } } function print_uploaded_packages_part( $logins, $key_prefix, $database, $title ) { $pack_array = array(); foreach( $logins as $login ) { if (preg_match("/^0x/", $login)) { $login = strtolower($login); } elseif (!strstr($login, "@")) { $login .= "@debian.org"; } $login = strtolower($login); $pack_array = array_merge( $pack_array, explode( " ", dba_fetch( "$key_prefix$login", $database ) ) ); } sort( $pack_array, SORT_STRING ); $packages = implode( " ", $pack_array ); if( $packages ) print_package_entries( $title, $packages, 1 ); } function print_uploaded_packages($logins) { global $incoming_db; global $uploads_db; print_uploaded_packages_part( $logins, "", $incoming_db, "Pending uploads" ); print_uploaded_packages_part( $logins, "op:", wnpp_db(), "Owned WNPP bugs" ); print_uploaded_packages_part( $logins, "bpo:", $incoming_db, "Stable backports" ); print_uploaded_packages_part( $logins, "nmu:", $uploads_db, "Non-maintainer uploads" ); print_uploaded_packages_part( $logins, "qa:", $uploads_db, "QA uploads" ); print_uploaded_packages_part( $logins, "", $uploads_db, "Sponsored/other uploads" ); } function print_signed_uploads( $carnivoreid ) { global $incoming_db; $pack_array = array(); foreach( carnivoreid2fingerprints( $carnivoreid ) as $fingerprint ) $pack_array = array_merge( $pack_array, explode( " ", dba_fetch( "fpr:$fingerprint", $incoming_db ) ) ); sort( $pack_array, SORT_STRING ); $packages = implode( " ", $pack_array ); if( $packages ) print_package_entries( "Pending signed uploads", $packages, 1 ); } function print_given_dm_permissions( $carnivoreid ) { $pack_array = array(); foreach( carnivoreid2fingerprints( $carnivoreid ) as $fingerprint ) $pack_array = array_merge( $pack_array, explode( " ", dba_fetch( "ddp:$fingerprint", dm_db() ) ) ); sort( $pack_array, SORT_STRING ); $packages = implode( " ", $pack_array ); if( $packages ) print_package_entries( "Given DM permissions", $packages, 0 ); } function print_developer($login, $name) { global $components; global $pack_db; global $seen_packages; $seen_packages = array(); print_header_entries_top($login, $name); print_header_entries_body($login, $name); /* ordering 3: print subscribed packages first. Subscribed packages will * not show up in main/contrib/non-free (and vice-versa for other * orderings) */ if(isdisplayed('ordering') == 3) print_subscribed_packages($login); foreach ($components as $component) { $packages = dba_fetch(strtolower($login).":$component", $pack_db); if ($packages != "") { print_package_entries($component, $packages, 1); $no_packages = true; } elseif (! $no_packages) { print html_h("No packages in unstable", 3); $no_packages = true; } } if(isdisplayed('ordering') != 3) print_subscribed_packages($login); if(isdisplayed('packages')) print_package_entries("url", isdisplayed('packages'), 1); if(isdisplayed('uploads')) print_uploaded_packages(array($login)); if(isdisplayed('uploader')) { $uploaders = explode(" ", isdisplayed('uploader')); foreach ($uploaders as $uploader) print_uploaded_packages(array($uploader)); } } function delete_duplicates_from_array( $array ) { $array_keyed = array(); foreach( $array as $value ) $array_keyed[$value] = 1; $array = array(); foreach( $array_keyed as $key => $value ) $array[] = $key; return $array; } function email_has_packages( $email ) { global $components; global $pack_db; global $uploads_db; foreach ($components as $component) if( dba_fetch(strtolower($email).":$component", $pack_db) ) return true; if( dba_fetch(strtolower($email), $uploads_db) ) return true; if( dba_fetch(strtolower($email), subscribe_db()) ) return true; if( dba_fetch("op:".strtolower($email), wnpp_db() ) ) return true; return false; } function output_emails( $emails ) { global $pack_db; global $global_carnivoreid; $emails_array = explode( " ", $emails ); $emails_array = delete_duplicates_from_array( $emails_array ); foreach( $emails_array as $email ) { if( email_has_packages( $email ) ) { $name = dba_fetch( "name:".strtolower($email), $pack_db ); if( ! $name ) { $names = carnivoreid2carnivorenames( carnivoreemail2carnivoreid( $email ) ); $name = $names[0]; } $global_carnivoreid = carnivoreemail2carnivoreid( $email ); start_output( $name ); print_developer( $email, $name ); $global_carnivoreid = ""; } } } function carnivore_db() { global $prefix; static $carnivore_db; if (!$carnivore_db) $carnivore_db = dba_open("$prefix/carnivore.db", 'r', 'db4'); return $carnivore_db; } function dm_db() { global $prefix; static $dm_db; if (!$dm_db) $dm_db = dba_open("$prefix/dm.db", 'r', 'db4'); return $dm_db; } function carnivoreid2emails( $carnivoreid ) { return explode( ":", dba_fetch("email:$carnivoreid", carnivore_db() ) ); } function carnivoreid2fingerprints( $carnivoreid ) { return explode( ":", dba_fetch("fpr:$carnivoreid", carnivore_db() ) ); } function carnivoreemail2carnivoreid( $carnivoreemail ) { return dba_fetch("email2id:".strtolower($carnivoreemail), carnivore_db() ); } function carnivorekey2carnivoreid( $carnivorekey ) { $carnivorekey = strtoupper( $carnivorekey ); return dba_fetch("key2id:$carnivorekey", carnivore_db() ); } function carnivoreid2carnivorenames( $carnivoreid ) { return explode( ":", dba_fetch("name:$carnivoreid", carnivore_db() ) ); } function output_carnivoreid( $carnivoreid ) { $emails = array(); foreach( carnivoreid2emails( $carnivoreid ) as $email ) if( email_has_packages( $email ) ) $emails[] = $email; if( count( $emails ) == 0 ) return; global $global_carnivoreid; $global_carnivoreid = $carnivoreid; global $seen_packages; $seen_packages = array(); $email = ""; foreach( $emails as $email_candidate ) if( preg_match( "/\@debian\.org$/", $email_candidate ) ) $email = $email_candidate; if( $email == "" ) $email = $emails[0]; global $pack_db; $name = dba_fetch( "name:".strtolower($email), $pack_db ); if( ! $name ) { $names = carnivoreid2carnivorenames( $carnivoreid ); $name = $names[0]; } start_output( $name ); print html_h(htmlspecialchars("Packages overview for $name"), 2, "center"); foreach( $emails as $email ) { print_header_entries_body($email, $name); print html_br(); } if(isdisplayed('ordering') == 3) foreach( $emails as $email ) print_subscribed_packages( $email ); global $components; global $pack_db; foreach ($components as $component) { $packages = array(); foreach( $emails as $email ) $packages = array_merge( $packages, explode( " ", dba_fetch(strtolower($email).":$component", $pack_db) ) ); sort( $packages, SORT_STRING ); if( $name != "Debian QA Group" ) $packages = filter_orphaned( $packages ); print_package_entries($component, implode( " ", $packages ), 1); } if( $name == "Debian QA Group" ) { $packages = orphaned_packages(); sort( $packages, SORT_STRING ); print_package_entries( "Orphaned packages to be moved to ".$name, implode( " ", $packages ), 1 ); } if(isdisplayed('ordering') != 3) foreach( $emails as $email ) print_subscribed_packages( $email ); if(isdisplayed('packages')) print_package_entries("url", isdisplayed('packages'), 1); if(isdisplayed('uploads')) print_uploaded_packages( $emails ); if(isdisplayed('uploader')) { $uploaders = explode(" ", isdisplayed('uploader')); foreach ($uploaders as $uploader) print_uploaded_packages(array($uploader)); } if(isdisplayed('uploads')) print_signed_uploads( $carnivoreid ); print_given_dm_permissions( $carnivoreid ); $global_carnivoreid = ""; } function output_carnivoreids( $input ) { $array = delete_duplicates_from_array( explode( " ", $input ) ); foreach( $array as $entry ) output_carnivoreid( $entry ); } function output_carnivoreemails( $input ) { $array = delete_duplicates_from_array( explode( " ", $input ) ); $carnivoreids = array(); foreach( $array as $entry ) $carnivoreids[] = carnivoreemail2carnivoreid( $entry ); output_carnivoreids( implode( " ", $carnivoreids ) ); } function produce_404( $what ) { global $called_start_output; if( ! $called_start_output ) { header('Status: 404 Not Found', FALSE, 404); start_output(); print_notfound( $what ); } } $pack_db = dba_open("$prefix/archive.db", 'r', 'db4'); $uploads_db = dba_open("$prefix/uploads.db", 'r', 'db4'); $incoming_db = dba_open("$prefix/incoming.db", 'r', 'db4'); $dist2release = array(); $dist2bponewrelease = array(); $releases_re = ""; foreach( $dists as $dist ) { $release = dba_fetch( "readlink:$dist", $pack_db ); if( ! $release ) continue; $dist2release[$dist] = $release; } foreach( array( "oldstable", "stable" ) as $dist ) { if( ! $dist2release[$dist] ) continue; $dist2bponewrelease[$dist] = "bpo-new-".$dist2release[$dist]."-backports"; $subdists[$dist][$dist2bponewrelease[$dist]] = $dist2bponewrelease[$dist]; if( $releases_re != "" ) $releases_re .= "|"; $releases_re .= $dist2release[$dist]; } if ($excuse = $_REQUEST['excuse'] and preg_match($filter_re, $excuse)) { $excuse_quoted = rawurlencode($excuse); header('Status: 302 Redirect'); header("Location: http://qa.debian.org/excuses.php?package=$excuse_quoted"); exit(0); } elseif ($popcon = $_REQUEST['popcon'] and preg_match($filter_re, $popcon)) { $popcon_quoted = rawurlencode($popcon); header('Status: 302 Redirect'); header("Location: http://qa.debian.org/popcon.php?package=$popcon_quoted"); exit(0); } elseif ($wnpp = $_REQUEST['wnpp'] and preg_match($filter_re, $wnpp)) { $wnpp_quoted = rawurlencode($wnpp); header('Status: 302 Redirect'); header("Location: http://qa.debian.org/wnpp.php?login=$wnpp_quoted"); exit(0); } elseif ($gpg_key = $_REQUEST['gpg_key'] ) { output_emails( implode( " ", carnivoreid2emails( carnivorekey2carnivoreid( $gpg_key ) ) ) ); produce_404( $gpg_key ); printBackLink(); } elseif ($login = $_REQUEST['login'] ) { if( preg_match( "/[A-Z]/", $login ) ) { $maint_list = array(); $pattern = strtolower($login); $maint_file = file("$prefix/maintainers.txt"); foreach ($maint_file as $line) { if (strstr(strtolower($line), $pattern) and preg_match("/<(.*@.*)>/", $line, $arr)) { $maint_list[] = $arr[1]; if (count($maint_list)>= 10) break; } } output_carnivoreemails( implode( " ", $maint_list ) ); } else { $maint_list = array(); $logins = explode(' ', $login); foreach ($logins as $entry) { if (!strstr($entry, '@')) $entry .= "@debian.org"; $maint_list[] = $entry; } output_carnivoreemails( implode( " ", $maint_list ) ); if( ! $called_start_output ) { $emails = array(); foreach( $maint_list as $entry ) $emails = array_merge( $emails, carnivoreid2emails( carnivoreemail2carnivoreid( $entry ) ) ); $emails = array_merge( $emails, $maint_list ); output_emails( implode( " ", $emails ) ); } } produce_404( $login ); printBackLink(); } elseif ($email = $_REQUEST['email'] ) { output_emails( $email ); produce_404( $email ); printBackLink(); } elseif($package = $_REQUEST['package'] and preg_match($filter_re, $package)) { $maint = dba_fetch("maint:$package", $pack_db); if (!$maint) { $source = dba_fetch("src:$package", $pack_db); if ($source) { $package = $source; $maint = dba_fetch("maint:$package", $pack_db); } } if ($maint) { $maint = str_replace('+', '%2B', $maint); $package_quoted = htmlspecialchars($package); header('Status: 302 Redirect'); header("Location: http://qa.debian.org/developer.php?login=$maint#$package_quoted"); exit(0); } header('Status: 404 Not Found', FALSE, 404); start_output(); print_notfound($package); printBackLink(); } elseif($packages = $_REQUEST['packages'] and preg_match($filter_re, $packages)) { start_output(); print_package_entries("Packages", $packages, 1); printBackLink(); } elseif($task = $_REQUEST['task'] and preg_match($filter_re, $task)) { $task_db = dba_open("$prefix/tasks.db", 'r', 'db4'); $packages = dba_fetch("t:$task", $task_db); if ($packages) { start_output(); print_package_entries("Task: $task", $packages, 1); } else { header('Status: 404 Not Found', FALSE, 404); start_output(); print_notfound("Task: $task"); } printBackLink(); } elseif($wnpp = strtoupper($_REQUEST['wnpptag']) and preg_match($filter_re, $wnpp)) { $packages = dba_fetch("tag:$wnpp", wnpp_db() ); if ($packages) { start_output(); print_package_entries("WNPP Tag $wnpp", $packages, 1); } else { header('Status: 404 Not Found', FALSE, 404); start_output(); print_notfound("WNPP Tag $wnpp"); } printBackLink(); } elseif ($_REQUEST['all']) { header('Status: 302 Redirect'); header("Location: http://www.debian.org/devel/people"); exit(0); } else { start_output(); print_form(); } print_help(); print_footer(); ?>