diff options
Diffstat (limited to 'rpm.php')
-rw-r--r-- | rpm.php | 310 |
1 files changed, 310 insertions, 0 deletions
@@ -0,0 +1,310 @@ +<?php +$what=(isset($_GET["what"]) ? $_GET["what"] : "%fedora"); +$type=(isset($_GET["type"]) ? $_GET["type"] : "pecl"); + +require "config.inc.php"; +?> +<html> + <head> + <title><?php echo $type; ?> extensions in Fedora</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> + <link rel="stylesheet" type="text/css" media="print" href="http://docs.fedoraproject.org/css/print.css"> + <style type="text/css" media="screen"> + @import url("http://docs.fedoraproject.org/css/layout.css"); + @import url("http://docs.fedoraproject.org/css/content.css"); + @import url("http://docs.fedoraproject.org/css/docbook.css"); + +body { + background-image:none; +} +.error { + background:url(http://fedoraproject.org/wikidata/kindofblue/img/icon-error.png) no-repeat left; + padding-left: 21px; +} + +.info { + background:url(http://fedoraproject.org/wikidata/kindofblue/img/icon-info.png) no-repeat left; + padding-left: 21px; +} + +.attn { + background:url(http://fedoraproject.org/wikidata/kindofblue/img/attention.png) no-repeat left; + padding-left: 21px; +} + +.check { + background:url(http://fedoraproject.org/wikidata/kindofblue/img/checkmark.png) no-repeat left; + padding-left: 21px; +} + +.cpan { + background:url(http://www.perl.com/favicon.ico) no-repeat left; + padding-left: 18px; +} + +.rt { + background:url(/img/rt.png) no-repeat left; + padding-left: 18px; +} + +.bz { + background:url(/img/bz.png) no-repeat left; + padding-left: 18px; +} + +<?php + +function Report ($db, $type) { + global $what; + + echo "<h1>".strtoupper($type)." extensions in Fedora</h1>\n"; + + + $repos=array(); + $res=$db->query("SELECT * FROM repo WHERE active=1 ORDER BY ID"); + if ($res) while ($repo = $res->fetchObject()) { + $repos[$repo->main][$repo->sub]=$repo; + } + // echo "<pre>"; print_r($repos);echo "</pre>"; + + echo "<table id='fedora-list-packages'>\n"; + echo "<tr class='odd'><th>Package</th><th>Owner(s)</th><th>Upstream</th>"; + + foreach($repos as $repomain) { + foreach ($repomain as $repo) { + printf ("<th align='left'>%s</th>", $repo->main); + break; + } + } + echo "</tr>\n"; + + $i=0; + $resup=$db->query("SELECT * FROM upstream WHERE type='$type' ORDER BY name"); + if ($resup) while ($upstream = $resup->fetchObject()) { + $rpmname = $upstream->name; + + $sql2="SELECT DISTINCT owner FROM acls WHERE name = '$rpmname'"; + $res2=$db->query($sql2); + $owners=array(); + if ($res2) while ($owner= $res2->fetchObject()) $owners[] = $owner->owner; + + $sql = "SELECT * FROM rpm WHERE name = '$rpmname'"; + + $res=$db->query($sql); + $rpm = ($res ? $res->fetchObject() : false); + + switch ($what) { + case '%fedora': + $display = ($rpm !== false); + break; + case '%stable': + $display = !empty($upstream->stable); + break; + case '%all': + $display = true; + break; + default: // owner + $display = (array_search($what, $owners) !== false); + break; + } + + if ($display) { + if ($rpm) { + $dispname = "<a href='zoom.php?rpm=" . $rpmname . "' title='" . $rpm->summary . "'>$rpmname</a>"; + } else { + $dispname = $rpmname; + } + $rpms=array(); + if ($rpm) do { + $rpms[$rpm->repo_main."-".$rpm->repo_sub]=$rpm; + } while ($rpm = $res->fetchObject()); + + $dispowner=""; + foreach ($owners as $owner) { + if ($dispowner) $dispowner .= "<br>"; + $dispowner .= sprintf ("<a href='%s?type=$type&what=%s'>%s</a>", $_SERVER["PHP_SELF"], $owner, $owner); + } + printf ("<tr class='%s'><td>%s<br><small>%s</small></td><td>%s</td><td>%s%s</td>", + ($i%2 ? "odd" : "even"), $dispname, + ($upstream->channel != $upstream->type ? "channel: " . $upstream->channel : ""), + $dispowner, + ($upstream->stable ? "<b>".$upstream->stable."</b><br />" : " "), + ($upstream->unstable && (!$upstream->stable || $upstream->stable!=$upstream->unstable) ? $upstream->unstable." <small>(".$upstream->state.")</small>" : " ")); + + $verup = strtolower($upstream->stable ? $upstream->stable : $upstream->unstable); + + foreach($repos as $repomain) { + $display=""; + $class=""; + foreach ($repomain as $repo) { + if (isset($rpms[$repo->main."-".$repo->sub])) { + $rpm=$rpms[$repo->main."-".$repo->sub]; + + $verpm=$rpm->ver; + if (preg_match("/\.((beta|RC)\d*)\./i", $rpm->rel, $res)) { + $verpm .= strtolower($res[1]); + } + + switch ($repo->sub) { + case "base": + if (isset($rpms[$repo->main."-updates"])) { + $display .= sprintf("%s-%s<br>", $rpm->ver, $rpm->rel); + } else { + $display .= sprintf("<b>%s</b>-%s<br>", $rpm->ver, $rpm->rel); + } + if ($verup==$verpm) $class="check"; + break; + case "": + $display .= sprintf("<b>%s</b>-%s<br>", $rpm->ver, $rpm->rel); + if ($verup==$verpm) $class="check"; + break; + case "updates": + $display .= sprintf("<b>%s</b>-%s <small>(updates)</small><br>", $rpm->ver, $rpm->rel); + if ($verup==$verpm) $class="check"; + break; + case "testing": + $display .= sprintf("%s-%s <small>(testing)</small><br>", $rpm->ver, $rpm->rel); + if ($verup==$verpm) $class="info"; + break; + } + } // RPM exists + } // sub repo + if ($display && empty($class)) $class="attn"; + if ($display) { + printf("<td><div class='%s'>%s</div></td>", $class, $display); + } else { + echo "<td> </td>"; + } + } // mainrepo + + echo "</tr>\n"; + $i++; + } + } // each $unstable + echo "</table>\n"; + echo "<p>$i packages found</p>"; +} + +try { + $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS); +?> + </style> + + <meta name="MSSmartTagsPreventParsing" content="TRUE"> + <link rel="shortcut icon" href="http://docs.fedoraproject.org/images/favicon.ico"> + <link rel="icon" href="http://docs.fedoraproject.org/images/favicon.ico"> + </head> + + <body> + <!-- header BEGIN --> + <div id="fedora-header"> + <div id="fedora-header-logo"> + + <a href="http://fedoraproject.org"><img src="http://docs.fedoraproject.org/images/header-fedora_logo01.png" alt="Fedora Project"></a> + </div> + + <div id="fedora-header-items"> + <span class="fedora-header-search"> +<?php + echo "<form action='" . $_SERVER["PHP_SELF"] . "' method='get'>"; + echo "<input type='hidden' name='type' value='$type' />"; +?> + <select name='what' size='1'> + <optgroup label='Pakages'> + <option value='%fedora' <?php if ($what=='%fedora') echo " selected='1'"; ?> >In fedora</option> + <option value='%stable' <?php if ($what=='%stable') echo " selected='1'"; ?> >All stable</option> + <option value='%all' <?php if ($what=='%all') echo " selected='1'"; ?> >All</option> + </optgroup> + <optgroup label='Owner'> +<?php + switch ($type) { + case "pecl": $filter = "WHERE name LIKE 'php-pecl-%' "; break; + case "pear": $filter = "WHERE name LIKE 'php-%' "; break; + case "R": $filter = "WHERE name LIKE 'R-%' "; break; + default: $filter = ""; + } + $sql="SELECT DISTINCT owner FROM acls $filter ORDER BY owner"; + $res=$db->query($sql); + if ($res)while ($owner = $res->fetchObject()) { + printf("<option value='%s' %s>%s</option>", $owner->owner, ($what==$owner->owner ? "selected='1'" : ""), $owner->owner); + } else { + echo "<option value='remi'>remi</option>"; + } +?> + </optgroup> + </select> + <input type="image" src='http://docs.fedoraproject.org/images/header-search.png' alt="Search" /> + </form></span> + + </div> + + </div> + + <div id="fedora-nav"></div> + <img src='http://docs.fedoraproject.org/images/link-offsite-side.png' /> + <a href="./">Reports home</a> + <img src='http://docs.fedoraproject.org/images/link-offsite-side.png' /> + <?php echo "$type extensions"; ?> + <!-- header END --> + + <!-- leftside BEGIN --> + <div id="fedora-side-left"> + </div> + + <!-- leftside END --> + + <!-- content BEGIN --> + <div id="fedora-middle-one"> + <div class="fedora-corner-tr"> </div> + <div class="fedora-corner-tl"> </div> + <div id="fedora-content"> + + <!-- document BEGIN --> + + + +<?php + + $sql='SELECT MAX(stamp) AS stamp FROM repo'; + $res=$db->query($sql); + if ($res && $row=$res->fetchObject()) { + printf("<p>Repositories last updated %s.</p>", date("r", $row->stamp)); + } + + Report($db, $type); + echo "<p> </p>"; + +} +catch(PDOException $e) { + printf("%s ERREUR : %s\n", date("r"), $e->getMessage()); +} + +?> + +<table id='fedora-list-packages'><tr><th>Legend: </th> +<td><b>Upstream</b>: bold if stable. <b>Repo</b>: bold for latest release.</td> +<td><div class='check'>Lastest released (stable if exists)</div></td> +<td><div class='info'>Lastest in testing</div></td> +<td><div class='attn'>Lastest not available</div></td> +</tr></table> + + <!-- document END --> + </div> + <div class="fedora-corner-br"> </div> + <div class="fedora-corner-bl"> </div> + </div> + + <!-- content END --> + + <!-- footer BEGIN --> + + <div id="fedora-footer"> + <br/>The Fedora Project is maintained and driven by the community and sponsored by Red Hat. + <br/><a href="http://fedoraproject.org/wiki/Legal">Legal</a> | <a href="http://fedoraproject.org/wiki/Legal/TrademarkGuidelines">Trademark Guidelines</a> + <br> + </div> + + <!-- footer END --> + </body> +</html> + |