summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2010-05-22 14:51:15 +0200
committerRemi Collet <fedora@famillecollet.com>2010-05-22 14:51:15 +0200
commit1d9140560f969d4545e5b1ba762a90a5385f62f4 (patch)
tree9dce9dd2107e4669ff51db3562e3d66e872bfd16
parentf34b8b332def3600ef49feb1699fa9b1adb2369b (diff)
import current version
-rw-r--r--.gitignore1
-rw-r--r--all.php286
-rw-r--r--config.inc.php.dist7
-rw-r--r--index.php171
-rw-r--r--install.txt127
-rw-r--r--refresh.php437
-rw-r--r--rpm.php310
-rw-r--r--zoom.php207
8 files changed, 1546 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..7e9e3af
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+config.inc.php
diff --git a/all.php b/all.php
new file mode 100644
index 0000000..2dfe2f4
--- /dev/null
+++ b/all.php
@@ -0,0 +1,286 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>Packages 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
+$what=(isset($_GET["what"]) ? $_GET["what"] : false);
+
+require "config.inc.php";
+
+function Report ($db) {
+ global $what;
+
+ echo "<h1>Packages 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;
+ }
+
+ if (substr($what,0,1)=='%') {
+ $sql=sprintf("SELECT DISTINCT name FROM rpm WHERE SUBSTRING(name,1,1)='%s' ORDER BY name", substr($what,1,1));
+ } else {
+ $sql=sprintf("SELECT DISTINCT name FROM acls WHERE owner='%s' ORDER BY name", $what);
+ }
+ //echo "<p>SQL=$sql</p>";
+
+ echo "<table id='fedora-list-packages'>\n";
+ echo "<tr class='odd'><th>Package</th><th>Owner(s)</th>";
+
+ foreach($repos as $repomain) {
+ foreach ($repomain as $repo) {
+ printf ("<th align='left'>%s</th>", $repo->main);
+ break;
+ }
+ }
+ echo "</tr>\n";
+
+ $i=0;
+ $res=$db->query($sql);
+ if ($res) while ($desc = $res->fetchObject()) {
+ $rpmname = $desc->name;
+
+ $sql2="SELECT DISTINCT owner FROM acls WHERE name LIKE '$rpmname'";
+ $res2=$db->query($sql2);
+ $dispowner="";
+ if ($res2) while ($owner= $res2->fetchObject()) {
+ if ($dispowner) $dispowner .= "<br>";
+ $dispowner .= sprintf ("<a href='%s?what=%s'>%s</a>", $_SERVER["PHP_SELF"], $owner->owner, $owner->owner);
+ }
+
+ $sql3 = "SELECT * FROM rpm WHERE name LIKE '$rpmname'";
+ $res3=$db->query($sql3);
+ $rpm = ($res3 ? $res3->fetchObject() : false);
+
+ if ($rpm) {
+ $url = $rpm->url;
+ $des = $rpm->summary;
+
+ $rpms=array();
+ do {
+ $rpms[$rpm->repo_main."-".$rpm->repo_sub]=$rpm;
+ } while ($rpm = $res3->fetchObject());
+
+ printf ("<tr class='%s'><td><a href='zoom.php?rpm=%s' title='%s'>%s</a></td><td>%s</td>",
+ ($i%2 ? "odd" : "even"), $rpmname, $des, $rpmname, $dispowner);
+
+
+ foreach($repos as $repomain) {
+ $display="";
+ $class="";
+ foreach ($repomain as $repo) {
+ if (isset($rpms[$repo->main."-".$repo->sub])) {
+ $rpm=$rpms[$repo->main."-".$repo->sub];
+
+ $maxver = (isset($rpms["rawhide-"]) ? $rpms["rawhide-"]->ver : "");
+
+ 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);
+ $class = ($rpm->ver == $maxver ? "check" : "attn");
+ }
+ break;
+ case "":
+ $display .= sprintf("<b>%s</b>-%s<br>", $rpm->ver, $rpm->rel);
+ break;
+ case "updates":
+ $display .= sprintf("<b>%s</b>-%s <small>(updates)</small><br>", $rpm->ver, $rpm->rel);
+ $class = ($rpm->ver == $maxver ? "check" : "attn");
+ break;
+ case "testing":
+ $display .= sprintf("%s-%s <small>(testing)</small><br>", $rpm->ver, $rpm->rel);
+ $class = ($rpm->ver == $maxver ? "info" : "attn");
+ break;
+ }
+ } // RPM exists
+ } // sub repo
+
+ if ($class && $maxver) {
+ printf("<td><div class='%s'>%s</div></td>", $class, $display);
+ } else if ($display) {
+ printf("<td>%s</td>", $display);
+ } else {
+ echo "<td>&nbsp;</td>";
+ }
+ } // mainrepo
+
+ echo "</tr>\n";
+ $i++;
+ }
+ } // each Line
+ echo "</table>\n";
+}
+
+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">
+ <form action='<?php echo $_SERVER["PHP_SELF"]; ?>' method='get'>
+ <select name='what' size='1'>
+ <optgroup label='Pakages'>
+<?php
+ $sql="SELECT DISTINCT CONCAT('%',SUBSTRING(name,1,1)) as init FROM rpm ORDER BY init";
+ $res=$db->query($sql);
+ if ($res)while ($start = $res->fetchObject()) {
+ printf("<option value='%s' %s>Start with %s</option>", $start->init, ($what==$start->init ? "selected='1'" : ""), substr($start->init,1));
+ } else {
+ echo "<option value='remi'>remi</option>";
+ }
+?>
+ </optgroup>
+ <optgroup label='Owner'>
+<?php
+ $sql="SELECT DISTINCT owner FROM acls 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>
+ &nbsp;<img src='http://docs.fedoraproject.org/images/link-offsite-side.png' />
+ <a href="./">Reports home</a>
+ &nbsp;<img src='http://docs.fedoraproject.org/images/link-offsite-side.png' />
+ All packages
+ <!-- header END -->
+
+ <!-- leftside BEGIN -->
+ <div id="fedora-side-left">
+ </div>
+
+ <!-- leftside END -->
+
+ <!-- content BEGIN -->
+ <div id="fedora-middle-one">
+ <div class="fedora-corner-tr">&nbsp;</div>
+ <div class="fedora-corner-tl">&nbsp;</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));
+ }
+
+ if ($what) Report($db);
+ else echo "<h2>Choose a criteria from the search menu</h2>";
+
+ //echo "<pre>"; print_r($rpms); echo "</pre>";
+
+}
+catch(PDOException $e) {
+ printf("%s ERREUR : %s\n", date("r"), $e->getMessage());
+}
+
+?>
+<p>&nbsp;</p>
+
+<table id='fedora-list-packages'><tr><th>Legend:&nbsp;</th>
+<td><b>Repo</b>: bold for latest release.</td>
+<td><div class='check'>Lastest released (as in rawhide)</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">&nbsp;</div>
+ <div class="fedora-corner-bl">&nbsp;</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>
+
diff --git a/config.inc.php.dist b/config.inc.php.dist
new file mode 100644
index 0000000..7dc69d4
--- /dev/null
+++ b/config.inc.php.dist
@@ -0,0 +1,7 @@
+<?php
+define("MYHOST", "xxx");
+define("MYUSER", "yyy");
+define("MYPASS", "zzz");
+define("MYBASE", "rpmphp");
+?>
+
diff --git a/index.php b/index.php
new file mode 100644
index 0000000..77a6663
--- /dev/null
+++ b/index.php
@@ -0,0 +1,171 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>Packages 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
+
+require "config.inc.php";
+
+
+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">
+
+ </div>
+
+ </div>
+
+ <div id="fedora-nav"></div>
+ &nbsp;<img src='http://docs.fedoraproject.org/images/link-offsite-side.png' />
+ Reports home
+ <!-- header END -->
+
+ <!-- leftside BEGIN -->
+ <div id="fedora-side-left">
+ </div>
+
+ <!-- leftside END -->
+
+ <!-- content BEGIN -->
+ <div id="fedora-middle-one">
+ <div class="fedora-corner-tr">&nbsp;</div>
+ <div class="fedora-corner-tl">&nbsp;</div>
+ <div id="fedora-content">
+
+ <!-- document BEGIN -->
+
+ <h1>Packages in Fedora repositories</h1>
+ <h2>Package reports</h2>
+ <ul>
+ <li><a href='rpm.php?type=pecl'>PECL Extensions in Fedora</a> with upstream information</li>
+ <li><a href='rpm.php?type=pear'>PEAR Extensions in Fedora</a> with upstream information</li>
+ <li><a href='rpm.php?type=R'>R Extensions in Fedora</a> with upstream information</li>
+ <li><a href='all.php'>All Packages in Fedora</a></li>
+ </ul>
+ <h2>Analysed repositories</h2>
+
+
+<?php
+ echo "<table id='fedora-list-packages'>\n";
+ echo "<tr class='odd'><th>Main</th><th>Active</th><th>Sub<th>Url</th><th>Last update</th></tr>\n";
+
+ $sql='SELECT * FROM repo ORDER BY ID';
+ $res=$db->query($sql);
+ if ($res) for ($i=0, $prev="xx" ; $repo=$res->fetchObject() ; $i++, $prev=$repo->main) {
+ printf ("<tr class='%s'><td><strong>%s</strong></td><td>%s</td><td>%s</td><td><a href='%srepoview/' alt='Repoview'>%s</a></td><td>%s</td></tr>\n",
+ ($i%2 ? 'odd' : 'even'),
+ ($repo->main != $prev ? $repo->main : "&nbsp;"),
+ ($repo->main != $prev ? ($repo->active ? "<strong>Yes</strong>" : "no") : "&nbsp;"),
+ $repo->sub, $repo->url, $repo->url, date("r", $repo->stamp));
+ }
+ echo "</table>\n";
+
+}
+catch(PDOException $e) {
+ printf("%s ERREUR : %s\n", date("r"), $e->getMessage());
+}
+
+?>
+
+<h2>Script sources</h2>
+<table id='fedora-list-packages'><tr><th>Name</th><th>Description</th><th>Date</th></tr>
+<?php
+ $pages=array(
+ "index.php" => "This page",
+ "all.php" => "All Packages in Fedora",
+ "rpm.php" => "PHP Extensions in Fedora",
+ "refresh.php" => "The metadata refresh script launch twice a day by cron",
+ "zoom.php" => "Package detail");
+
+ $i=0;
+ foreach ($pages as $page => $name) if (is_file($page) && is_link($page."s")) {
+ $stat=stat($page);
+ printf ("<tr class='%s'><td><a href='%ss'>%s</a></td><td>%s</td><td>%s</td></tr>\n",
+ ($i%2 ? 'odd' : 'even'), $page, $page, $name, date("r", $stat["mtime"]));
+ $i++;
+ }
+?>
+</table>
+<p>Any feedback, RFE and patches are welcome.</p>
+
+ <!-- document END -->
+ </div>
+ <div class="fedora-corner-br">&nbsp;</div>
+ <div class="fedora-corner-bl">&nbsp;</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>
+
diff --git a/install.txt b/install.txt
new file mode 100644
index 0000000..65a6a67
--- /dev/null
+++ b/install.txt
@@ -0,0 +1,127 @@
+<HTML><HEAD>
+ <TITLE>Installation Base pour RPM-PHP</TITLE>
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+</HEAD><BODY><font face="Helvetica">
+<H1>Installation Base pour RPM-PHP</H1>
+<?php
+require "config.inc.php";
+
+function Action($Sql, $AbortIfError=false)
+{
+ global $db;
+
+ printf("<pre>%s</pre>\n", $Sql);
+ $nb=$db->exec($Sql);
+ if ($nb === false) {
+ $err=$db->errorInfo();
+ printf("<b>Erreur SQL</b> : %s\n", $err[2]);
+ if ($AbortIfError) die("<br />** Abandon **");
+ }
+ else {
+ $ret = $db->lastInsertId();
+ if ($nb) printf("Nombre de rangées affectées : %d</p>\n", $nb);
+ else if ($ret) printf("Valeur de l'index : %d</p>\n", $ret);
+ return ($ret);
+ }
+// else echo "OK.</p>\n";
+ return 0;
+
+}
+function Query ($Sql)
+{
+ global $db;
+
+ printf("<pre>%s</pre>\n", $Sql);
+ $res=$db->query($Sql);
+ if (!$res) {
+ $err=$db->errorInfo();
+ printf("<b>Erreur SQL</b> : %s\n", $err[2]);
+ } else {
+ echo "<table border='1' cellpadding='2'><tr>";
+ for ($i=0 ; $i<$res->columnCount() ; $i++) {
+ $meta=$res->getColumnMeta($i);
+ //echo "<th><pre>"; print_r($meta); echo "</pre></th>";
+ printf("<th>%s</th>", $meta["name"]);
+ }
+ while ($row = $res->fetch()) {
+ echo "<tr>";
+ // echo "<td><pre>"; print_r($row); echo "</pre></td>";
+ for ($i=0 ; $i<$res->columnCount() ; $i++) {
+ printf("<td>%s&nbsp;</td>", $row[$i]);
+ }
+ echo "</tr>";
+ }
+ echo "</tr>\n";
+ echo "</table>\n";
+ }
+}
+try {
+$db = new PDO ("mysql:host=" .MYHOST, MYUSER, MYPASS);
+
+printf("<p>Verion PHP : <b>%s</b><br />\n", phpversion());
+foreach ($db->query("SELECT VERSION() AS Version") as $Row)
+ printf ("Version du serveur : <b>%s</b></p>\n", $Row["Version"]);
+
+echo "<hr /><h3>Création du SCHEMA</h3>";
+
+Action("SET NAMES UTF8");
+Action("DROP DATABASE IF EXISTS " . MYBASE);
+Action("CREATE DATABASE " . MYBASE . " DEFAULT CHARACTER SET utf8");
+Action("USE " . MYBASE);
+
+$distros=array(
+ array("main"=>"EL-4", "sub"=>"base", "repo"=>"http://download.fedora.redhat.com/pub/epel/4/x86_64/"),
+ array("main"=>"EL-4", "sub"=>"testing", "repo"=>"http://download.fedora.redhat.com/pub/epel/testing/4/x86_64/"),
+
+ array("main"=>"EL-5", "sub"=>"base", "repo"=>"http://download.fedora.redhat.com/pub/epel/5/x86_64/"),
+ array("main"=>"EL-5", "sub"=>"testing", "repo"=>"http://download.fedora.redhat.com/pub/epel/testing/5/x86_64/"),
+
+ array("main"=>"F-8", "sub"=>"base", "repo"=>"http://download.fedora.redhat.com/pub/fedora/linux/releases/8/Everything/x86_64/os/"),
+ array("main"=>"F-8", "sub"=>"updates", "repo"=>"http://download.fedora.redhat.com/pub/fedora/linux/updates/8/x86_64/"),
+ array("main"=>"F-8", "sub"=>"testing", "repo"=>"http://download.fedora.redhat.com/pub/fedora/linux/updates/testing/8/x86_64/"),
+
+ array("main"=>"F-9", "sub"=>"base", "repo"=>"http://download.fedora.redhat.com/pub/fedora/linux/releases/9/Everything/x86_64/os/"),
+ array("main"=>"F-9", "sub"=>"updates", "repo"=>"http://download.fedora.redhat.com/pub/fedora/linux/updates/9/x86_64/"),
+ array("main"=>"F-9", "sub"=>"testing", "repo"=>"http://download.fedora.redhat.com/pub/fedora/linux/updates/testing/9/x86_64/"),
+
+ array("main"=>"rawhide", "sub"=>"", "repo"=>"http://download.fedora.redhat.com/pub/fedora/linux/development/x86_64/os/")
+ );
+
+Action("CREATE TABLE `repo` (
+ `ID` INT NOT NULL ,
+ `main` VARCHAR( 16 ) NOT NULL ,
+ `sub` VARCHAR( 16 ) NOT NULL ,
+ `url` VARCHAR( 200 ) NOT NULL ,
+ `stamp` int(11) DEFAULT NULL,
+ PRIMARY KEY ( `ID` )
+ ) ENGINE = MYISAM");
+
+Action("CREATE TABLE `rpm` (
+ `ID` int(11) NOT NULL AUTO_INCREMENT,
+ `name` varchar(100) NOT NULL,
+ `arch` varchar(20) NOT NULL,
+ `epoch` varchar(20) NOT NULL,
+ `ver` varchar(20) NOT NULL,
+ `rel` varchar(20) NOT NULL,
+ `summary` varchar(200) NOT NULL,
+ `url` varchar(200) NOT NULL,
+ `location` varchar(200) NOT NULL,
+ `repo_main` varchar(16) NOT NULL,
+ `repo_sub` varchar(16) NOT NULL,
+ PRIMARY KEY (`ID`),
+ KEY `name` (`name`),
+ KEY `repo_main` (`repo_main`),
+ KEY `repo_sub` (`repo_sub`)
+) ENGINE=MyISAM");
+
+$id=1;
+foreach ($distros as $distro) {
+ Action("INSERT INTO repo SET ID=$id, main='".$distro["main"]."', sub='".$distro["sub"]."', url='".$distro["repo"]."'");
+ $id++;
+}
+Query("SELECT * FROM repo");
+}
+catch(PDOException $e) {
+ printf("ERREUR : %s\n", $e->getMessage());
+}
+?>
diff --git a/refresh.php b/refresh.php
new file mode 100644
index 0000000..ec12168
--- /dev/null
+++ b/refresh.php
@@ -0,0 +1,437 @@
+<?php
+chdir(dirname($_SERVER["SCRIPT_FILENAME"]));
+
+if (isset($_SERVER["SERVER_NAME"])) {
+ echo "<pre>";
+ ini_set("max_execution_time", "0");
+ ini_set("memory_limit", "-1");
+
+ die("This script is launched twice a day, be patient");
+}
+require "config.inc.php";
+
+function addUpstream ($db, $type, $channel, $name, $state, $ver, $statename="") {
+
+ $sql1 = "INSERT INTO `upstream` SET type='$type', name='$name'";
+ $db->exec($sql1);
+
+ $sql2 = "UPDATE `upstream` SET channel='$channel', $state='$ver'";
+ if ($statename) $sql2 .= ", state='$statename'";
+ $sql2 .= " WHERE type='$type' AND name='$name'";
+ $nb = $db->exec($sql2);
+ if ($nb===false) echo date("r : ") . "SQL ERROR($sql2) = " . implode(" ", $db->errorInfo()) . "\n";
+
+ return $nb;
+}
+if ($_SERVER['argc']>1 && in_array('help', $_SERVER['argv'])) {
+ echo "Options in: repo owner R pear pecl old\n";
+ echo "Defaults: repo owner R pear pecl\n";
+ die("\n");
+}
+
+try {
+ $db = new PDO ("mysql:dbname=" . MYBASE . ";host=" . MYHOST, MYUSER, MYPASS);
+
+ // -------------------------------------------------------------------
+ // Fedora Packages
+ // -------------------------------------------------------------------
+ echo date("r : ") . "Refreshing " . MYBASE . " database\n";
+
+ if ($_SERVER['argc']==1 || in_array('repo', $_SERVER['argv'])) {
+ if (in_array('empty', $_SERVER['argv'])) {
+ $res=$db->query("SELECT * FROM repo WHERE stamp IS NULL");
+ } else if (in_array('old', $_SERVER['argv'])) {
+ $res=$db->query("SELECT * FROM repo");
+ } else {
+ $res=$db->query("SELECT * FROM repo WHERE active=1");
+ }
+ if (!$res) echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
+ else while ($row = $res->fetchObject()) {
+ echo date("r : ") . "REPOSITORY " . $row->main . " " . $row->sub . "\n";
+ $TimRemote = 0;
+ $repomd = simplexml_load_file($row->url . "repodata/repomd.xml");
+ if ($repomd) foreach($repomd->data as $data) if ($data->attributes()=="primary") {
+ $TimRemote = $data->timestamp;
+ $UrlRemote = $row->url . $data->location->attributes();
+ }
+ if ($TimRemote > $row->stamp) {
+ echo date("r : ") . "Loading $UrlRemote\n";
+
+ //$fic=gzopen("primary.xml.gz", "r");
+ $fic=gzopen($UrlRemote, "r");
+ if ($fic) {
+ $txt="";
+ while ($buf=gzread($fic,8196))
+ $txt .= $buf;
+ echo date("r : ") . "Read " . strlen($txt) . " bytes\n";
+ gzclose($fic);
+
+ $primary = simplexml_load_string($txt);
+ echo date("r : ") . "Read " . $primary->attributes() . " packages\n";
+ unset($txt);
+
+ $sql = sprintf("DELETE FROM rpm WHERE repo_main='%s' AND repo_sub='%s'",
+ $row->main, $row->sub);
+ $nb=$db->exec($sql);
+ if ($nb===false) echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
+ else echo date("r : ") . "Delete $nb packages\n";
+
+ $tot=0;
+ foreach ($primary->package as $package) if ($package->attributes()=='rpm'){
+ $ver = $package->version->attributes();
+ $sql = sprintf("INSERT INTO rpm SET repo_main='%s', repo_sub='%s', name='%s', epoch='%s', ver='%s', rel='%s', summary='%s', url='%s'",
+ $row->main, $row->sub, $package->name, $ver['epoch'], $ver['ver'], $ver['rel'], addslashes($package->summary), $package->url);
+ $nb=$db->exec($sql);
+ if ($nb) $tot+=$nb;
+ else echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
+ }
+ echo date("r : ") . "Write $tot packages\n";
+
+ $sql=sprintf("UPDATE repo SET stamp=%d WHERE ID=%d", $TimRemote, $row->ID);
+ $nb=$db->exec($sql);
+ if ($nb===false) echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
+
+ unset($primary);
+ } else {
+ echo date("r : ") . "ERROR : can't read $UrlRemote\n";
+ }
+ } else {
+ echo date("r : ") . "no update needed : $TimRemote / " . $row->stamp . "\n";
+ }
+ }
+ } // If ask
+
+ // -------------------------------------------------------------------
+ // Upstream Version
+ // -------------------------------------------------------------------
+ $sql="CREATE TABLE IF NOT EXISTS `upstream` (
+ `name` varchar(100) NOT NULL,
+ `type` varchar(20) NOT NULL,
+ `channel` varchar(20) NOT NULL,
+ `stable` varchar(20) DEFAULT NULL,
+ `unstable` varchar(20) DEFAULT NULL,
+ `state` varchar(20) DEFAULT NULL,
+ PRIMARY KEY (`name`,`type`),
+ KEY `name` (`name`),
+ KEY `type` (`type`),
+ KEY `channel` (`channel`))";
+
+ if ($db->exec($sql)!==false)
+ echo date("r : ") . "Check table 'upstream' ok\n";
+ else echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
+
+ // -------------------------------------------------------------------
+ if ($_SERVER['argc']==1 || in_array('pecl', $_SERVER['argv'])) {
+ echo date("r : ") . "PECL listLatestReleases - stable\n";
+
+ $request = xmlrpc_encode_request("package.listLatestReleases", "stable");
+ $context = stream_context_create(array('http' => array(
+ 'method' => "POST",
+ 'header' => "Content-Type: text/xml",
+ 'content' => $request
+ )));
+ $file = file_get_contents("http://pecl.php.net/xmlrpc.php", false, $context) or die ("Can't file_get_contents(http://pecl.php.net/xmlrpc.php)");
+ $stable = xmlrpc_decode($file);
+ if (xmlrpc_is_fault($stable)) {
+ echo date("r : ") . "ERROR xmlrpc: $stable[faultString] ($stable[faultCode])";
+ } else {
+ $sql = sprintf("DELETE FROM upstream WHERE type='pecl' AND channel='pecl'");
+ $nb=$db->exec($sql);
+ if ($nb===false) echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
+ else echo date("r : ") . "Delete $nb packages\n";
+
+ $nb=0;
+ foreach ($stable as $name => $info) {
+ $rpmname="php-pecl-".str_replace("_","-",$name);
+
+ $nb += addUpstream($db, "pecl", "pecl", $rpmname, "stable", $info["version"]);
+ }
+ echo date("r : ") . "Write $nb packages\n";
+ // echo date("r : ") . "saved " . file_put_contents("cache/pecl-stable", serialize($stable)) . " bytes\n";
+ }
+
+ // -------------------------------------------------------------------
+ echo date("r : ") . "PECL listLatestReleases - unstable\n";
+
+ $request = xmlrpc_encode_request("package.listLatestReleases", array());
+ $context = stream_context_create(array('http' => array(
+ 'method' => "POST",
+ 'header' => "Content-Type: text/xml",
+ 'content' => $request
+ )));
+ $file = file_get_contents("http://pecl.php.net/xmlrpc.php", false, $context) or die ("Can't file_get_contents(http://pecl.php.net/xmlrpc.php)");
+ $unstable = xmlrpc_decode($file);
+ if (xmlrpc_is_fault($unstable)) {
+ echo date("r : ") . "ERROR xmlrpc: $stable[faultString] ($stable[faultCode])";
+ } else {
+ $nb=0;
+ foreach ($unstable as $name => $info) {
+ $rpmname="php-pecl-".str_replace("_","-",$name);
+
+ $nb += addUpstream($db, "pecl", "pecl", $rpmname, "unstable", $info["version"], $info["state"]);
+ }
+ echo date("r : ") . "Write $nb packages\n";
+ //echo date("r : ") . "saved " . file_put_contents("cache/pecl-unstable", serialize($unstable)) . " bytes\n";
+ }
+ } // if in options
+
+ // -------------------------------------------------------------------
+ if ($_SERVER['argc']==1 || in_array('pear', $_SERVER['argv'])) {
+ echo date("r : ") . "PEAR reading channels\n";
+ $channels=array(
+ "pear" => "pear.php.net"
+ ,"doctrine" => "pear.phpdoctrine.org"
+ ,"ezc" => "components.ez.no"
+ ,"pdepend" => "pear.pdepend.org"
+ ,"phing" => "pear.phing.info"
+ ,"phpdb" => "pear.phpdb.org"
+ ,"phpmd" => "pear.phpmd.org"
+ ,"phpunit" => "pear.phpunit.de"
+ ,"swift" => "pear.swiftmailer.org"
+ ,"symphony" => "pear.symfony-project.com"
+ );
+ try {
+ $nbtot=0;
+
+ foreach ($channels as $channelname => $channelurl) {
+
+ $channel = @simplexml_load_file("http://$channelurl/channel.xml");
+ if (!$channel) throw new Exception("can't read PEAR site (channel of $channelname)");
+
+ $rest = $channel->servers->primary->rest->baseurl[0];
+ echo date("r : ") . "PEAR reading channel=$channelname, baseurl = $rest\n";
+
+ $categories = @simplexml_load_file($rest."c/categories.xml");
+ if (!$categories) throw new Exception("can't read PEAR site (categories)");
+
+ $sql = sprintf("DELETE FROM upstream WHERE type='pear' AND channel='$channelname'");
+ $nb=$db->exec($sql);
+ if ($nb===false) echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
+ else echo date("r : ") . "Delete $nb packages\n";
+
+ $nb=0;
+ if (!isset($categories->c[0])) {
+ echo date("r : ") . "Reading ALL\n"; // ezc only
+ $pitxt = @file_get_contents($rest."p/packages.xml");
+ if (!$pitxt) throw new Exception("can't read PEAR site (".$rest."p/packagesinfo.xml)");
+ $allpi = @simplexml_load_string($pitxt);
+ foreach ($allpi->p as $name) {
+ $pitxt = @file_get_contents($rest."r/".strtolower($name)."/allreleases.xml");
+ if (!$pitxt) throw new Exception("can't read PEAR site (".$rest."r/".strtolower($name)."/allreleases.xml");
+ $pi = @simplexml_load_string($pitxt);
+
+ $rpmname1="php-".$channelname."-".str_replace("_","-",$name);
+ $rpmname2="php-".$channelname."-".$name;
+
+ //echo $rpmname ."/".(string)$pi->r[0]->v."/". (string)$pi->r[0]->s."\n";
+ addUpstream($db, "pear", $channelname, $rpmname1, "unstable", (string)$pi->r[0]->v, (string)$pi->r[0]->s);
+ addUpstream($db, "pear", $channelname, $rpmname2, "unstable", (string)$pi->r[0]->v, (string)$pi->r[0]->s);
+ foreach($pi->r as $rev) if ($rev->s=='stable') {
+ //echo $rpmname ."/".(string)$rev->v."/". (string)$rev->s."\n";
+ addUpstream($db, "pear", $channelname, $rpmname1, "stable", (string)$rev->v);
+ addUpstream($db, "pear", $channelname, $rpmname2, "stable", (string)$rev->v);
+ break;
+ }
+ $nb++;
+ }
+
+ } else foreach ($categories->c as $cat) {
+ echo date("r : ") . "Reading $cat\n";
+
+ $pitxt = @file_get_contents($rest."c/".urlencode($cat)."/packagesinfo.xml");
+ if (!$pitxt) throw new Exception("can't read PEAR site (".$rest."c/".urlencode($cat)."/packagesinfo.xml)");
+ $pitxt = "<?" . preg_replace("/<\?xml.*?>/U", "", str_replace("\r\n", "\n", substr($pitxt, 2)));
+
+ $pi = @simplexml_load_string($pitxt);
+ if (!$pi) throw new Exception("can't read response ($cat)");
+ foreach ($pi->pi as $ps) if (isset($ps->p->n) && isset($ps->a->r)) {
+ $name=(string)$ps->p->n;
+
+ if ($channelname=='phing' && $name=='phing') {
+ $rpmname1="php-pear-phing";
+ } else if ($channelname=='phpunit' && $name=='PHPUnit') {
+ $rpmname1="php-pear-PHPUnit";
+ } else {
+ $rpmname1="php-".$channelname."-".str_replace("_","-",$name);
+ }
+ $rpmname2="php-".$channelname."-".$name;
+
+ addUpstream($db, "pear", $channelname, $rpmname1, "unstable", (string)$ps->a->r[0]->v, (string)$ps->a->r[0]->s);
+ addUpstream($db, "pear", $channelname, $rpmname2, "unstable", (string)$ps->a->r[0]->v, (string)$ps->a->r[0]->s);
+ foreach($ps->a->r as $rev) if ($rev->s=='stable') {
+ addUpstream($db, "pear", $channelname, $rpmname1, "stable", (string)$rev->v);
+ addUpstream($db, "pear", $channelname, $rpmname2, "stable", (string)$rev->v);
+ break;
+ }
+ $nb++;
+ // echo $ps->p->n."\n";
+ }
+ }
+ echo date("r : ") . "read $nb packages in $channelname\n";
+ $nbtot += $nb;
+ }
+ echo date("r : ") . "read $nbtot packages in all channels\n";
+
+ } catch (Exception $e) {
+ echo date("r : ") . 'ERROR ' . $e->getMessage(), "\n";
+ }
+ } // if in options
+ // -------------------------------------------------------------------
+ if ($_SERVER['argc']==1 || in_array('R', $_SERVER['argv'])) {
+
+ $repos = array(
+ array("name"=>"R", "state"=>"stable", "url" => "http://cran.at.r-project.org/src/contrib/PACKAGES"),
+ //array("name"=>"R-forge","state"=>"unstable", "url" => "http://r-forge.r-project.org/src/contrib/PACKAGES"),
+ array("name"=>"biocp", "state"=>"stable", "url" => "http://www.bioconductor.org/packages/release/bioc/src/contrib/PACKAGES"),
+ array("name"=>"biocp", "state"=>"unstable", "url" => "http://www.bioconductor.org/packages/devel/bioc/src/contrib/PACKAGES"),
+ array("name"=>"bioca", "state"=>"stable", "url" => "http://www.bioconductor.org/packages/release/data/annotation/src/contrib/PACKAGES"),
+ array("name"=>"bioca", "state"=>"unstable", "url" => "http://www.bioconductor.org/packages/devel/data/annotation/src/contrib/PACKAGES"),
+ array("name"=>"bioce", "state"=>"stable", "url" => "http://www.bioconductor.org/packages/release/data/experiment/src/contrib/PACKAGES"),
+ array("name"=>"bioce", "state"=>"unstable", "url" => "http://www.bioconductor.org/packages/devel/data/experiment/src/contrib/PACKAGES")
+ );
+ $tottot=0;
+ foreach ($repos as $repo) {
+ echo date("r : ") . "Reading " . $repo["name"] . " (" . $repo["state"] . ")\n";
+ $index = @file_get_contents($repo["url"]);
+ if (!$index) {
+ echo date("r : ") . "Can't read [" . $repo["url"] . "], skip this channel\n";
+ continue;
+ }
+ if ($repo["state"]=="stable") {
+ $sql = sprintf("DELETE FROM upstream WHERE type='R' AND channel='%s'", $repo["name"]);
+ $nb=$db->exec($sql);
+ if ($nb===false) echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
+ else echo date("r : ") . "Delete $nb packages\n";
+ }
+ $results=array();
+ if (preg_match_all('/Package: *(.*)\nVersion: *(.*)\n/i',$index,$results,PREG_SET_ORDER)) {
+ $tot=0;
+ foreach ($results as $result) {
+ //echo $result[1]." = ".$result[2]."\n";
+ $rpmname = "R-".$result[1];
+ $ver = str_replace('-', '.', $result[2]);
+ if (addUpstream($db, "R", $repo["name"], $rpmname, $repo["state"], $ver, ($repo["state"]=="stable"?"":"devel"))) {
+ $tot++;
+ }
+ }
+ echo date("r : ") . "Write $tot packages in this channel\n";
+ $tottot += $tot;
+ } else {
+ echo date("r : ") . "No package in this channel\n";
+ }
+ }
+ echo date("r : ") . "Write $tottot packages in all channels\n";
+/*
+ * OLD VERSION parsing the HTML pages
+ $repos = array(
+ array("name"=>"R", "state"=>"stable", "url" => "http://cran.r-project.org/web/packages/"),
+ array("name"=>"biocp", "state"=>"stable", "url" => "http://bioconductor.org/packages/release/bioc/"),
+ array("name"=>"biocp", "state"=>"unstable", "url" => "http://bioconductor.org/packages/devel/bioc/"),
+ array("name"=>"bioca", "state"=>"stable", "url" => "http://bioconductor.org/packages/release/data/annotation/"),
+ array("name"=>"bioca", "state"=>"unstable", "url" => "http://bioconductor.org/packages/devel/data/annotation/"),
+ array("name"=>"bioce", "state"=>"stable", "url" => "http://bioconductor.org/packages/release/data/experiment/"),
+ array("name"=>"bioce", "state"=>"unstable", "url" => "http://bioconductor.org/packages/devel/data/experiment/")
+ );
+ $tottot=0;
+ foreach ($repos as $repo) {
+ echo date("r : ") . "Reading " . $repo["name"] . " (" . $repo["state"] . ")\n";
+ $index = @file_get_contents($repo["url"]);
+ if (!$index) {
+ echo date("r : ") . "Can't read [" . $repo["url"] . "], skip this channel\n";
+ continue;
+ }
+ if ($repo["state"]=="stable") {
+ $sql = sprintf("DELETE FROM upstream WHERE type='R' AND channel='%s'", $repo["name"]);
+ $nb=$db->exec($sql);
+ if ($nb===false) echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
+ else echo date("r : ") . "Delete $nb packages\n";
+ }
+ if ($repo["name"] == "R") {
+ $pos = strpos($index, 'ID="available-packages');
+ $pat1 = '/<A HREF="(\.\.\/\.\.\/web\/.*)">(.*)<\/A>/iU';
+ } else {
+ $pos = 0;
+ $pat1 = '/<a href="(.*)">(.*)<\/A>/iu';
+ }
+ $results=array();
+ if (preg_match_all($pat1,$index,$results,PREG_SET_ORDER,$pos)) {
+ $tot=0;
+ foreach ($results as $result) {
+ $page = @file_get_contents($repo["url"].$result[1]);
+ $name = $result[2];
+ $rpmname = "R-".$result[2];
+ $ver=array();
+ if (!$page) {
+ echo date("r : ") . "Can't read [" . $repo["url"].$result[1] . "], skip this package\n";
+
+ } else if (preg_match("/".$name."_((\d|-|\.)*)\.tar.gz/", $page, $ver)) {
+
+ $ver = str_replace('-', '.', $ver[1]);
+ $nb = addUpstream($db, "R", $repo["name"], $rpmname, $repo["state"], $ver, ($repo["state"]=="stable"?"":"devel"));
+
+ }
+
+ if ($nb) $tot+=$nb;
+
+ }
+ echo date("r : ") . "Write $tot packages in this channel\n";
+ $tottot += $tot;
+ } // Each package
+ } // Each repo
+ echo date("r : ") . "Write $tottot packages in all channels\n";
+ */
+ } // If R in options
+
+ // -------------------------------------------------------------------
+ // Package Owners from pkgdb (thanks Smootherfrog)
+ // -------------------------------------------------------------------
+ if ($_SERVER['argc']==1 || in_array('owner', $_SERVER['argv'])) {
+
+ $sql="CREATE TABLE IF NOT EXISTS `acls` (
+ `ID` int(11) NOT NULL AUTO_INCREMENT,
+ `collection` varchar(100) NOT NULL,
+ `name` varchar(100) NOT NULL,
+ `summary` varchar(200) NOT NULL,
+ `owner` varchar(50) DEFAULT NULL,
+ `qa` varchar(50) DEFAULT NULL,
+ `cc` varchar(100) DEFAULT NULL,
+ PRIMARY KEY (`ID`),
+ KEY `name` (`name`),
+ KEY `collection` (`collection`),
+ KEY `owner` (`owner`)) ENGINE=MyISAM";
+
+ if ($db->exec($sql)!==false)
+ echo date("r : ") . "Check table 'acls' ok\n";
+ else echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
+
+ $fic=fopen("https://admin.fedoraproject.org/pkgdb/acls/bugzilla?tg_format=plain", "r");
+ if (!$fic) {
+ echo date("r : ") . "ERROR reading pkgdb\n";
+ } else {
+ $sql="TRUNCATE `acls`";
+ $nb=$db->exec($sql);
+ if ($nb===false) echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
+ else echo date("r : ") . "Delete $nb packages\n";
+
+ for ($tot=0 ; $line=fgetcsv($fic,1024,'|') ; ) if (count($line)>5 && substr($line[0],0,1)!='#') {
+ for ($i=0; $i<6; $i++) $line[$i]=trim($line[$i]);
+ $sql=sprintf("INSERT INTO `acls` SET collection='%s', name='%s', summary='%s'", $line[0], $line[1], addslashes($line[2]));
+ if (!empty($line[3])) $sql .= sprintf(", owner='%s'", $line[3]);
+ if (!empty($line[4])) $sql .= sprintf(", qa='%s'", $line[4]);
+ if (!empty($line[5])) $sql .= sprintf(", cc='%s'", $line[5]);
+ $nb=$db->exec($sql);
+ if ($nb) $tot+=$nb;
+ else echo date("r : ") . "SQL ERROR = " . implode(" ", $db->errorInfo()) . "\n";
+ }
+ fclose($fic);
+ echo date("r : ") . "wrote $tot package's owner\n";
+ }
+ } // If in options
+
+}
+catch(PDOException $e) {
+ printf("%s ERREUR : %s\n", date("r"), $e->getMessage());
+}
+
+if (isset($_SERVER["SERVER_NAME"])) echo "</pre>";
+?>
diff --git a/rpm.php b/rpm.php
new file mode 100644
index 0000000..2da5bfc
--- /dev/null
+++ b/rpm.php
@@ -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 />" : "&nbsp;"),
+ ($upstream->unstable && (!$upstream->stable || $upstream->stable!=$upstream->unstable) ? $upstream->unstable." <small>(".$upstream->state.")</small>" : "&nbsp;"));
+
+ $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>&nbsp;</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>
+ &nbsp;<img src='http://docs.fedoraproject.org/images/link-offsite-side.png' />
+ <a href="./">Reports home</a>
+ &nbsp;<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">&nbsp;</div>
+ <div class="fedora-corner-tl">&nbsp;</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>&nbsp</p>";
+
+}
+catch(PDOException $e) {
+ printf("%s ERREUR : %s\n", date("r"), $e->getMessage());
+}
+
+?>
+
+<table id='fedora-list-packages'><tr><th>Legend:&nbsp;</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">&nbsp;</div>
+ <div class="fedora-corner-bl">&nbsp;</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>
+
diff --git a/zoom.php b/zoom.php
new file mode 100644
index 0000000..d597ec4
--- /dev/null
+++ b/zoom.php
@@ -0,0 +1,207 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
+<html>
+ <head>
+ <title>Packages 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
+
+require "config.inc.php";
+if (!isset($_GET['rpm'])) {
+ die("missing arg.");
+}
+$name = $_GET['rpm'];
+
+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">
+
+ </div>
+
+ </div>
+
+ <div id="fedora-nav"></div>
+ &nbsp;<img src='http://docs.fedoraproject.org/images/link-offsite-side.png' />
+ <a href="./">Reports home</a>
+ &nbsp;<img src='http://docs.fedoraproject.org/images/link-offsite-side.png' />
+ Package detail
+ <!-- header END -->
+
+ <!-- leftside BEGIN -->
+ <div id="fedora-side-left">
+ </div>
+
+ <!-- leftside END -->
+
+ <!-- content BEGIN -->
+ <div id="fedora-middle-one">
+ <div class="fedora-corner-tr">&nbsp;</div>
+ <div class="fedora-corner-tl">&nbsp;</div>
+ <div id="fedora-content">
+
+ <!-- document BEGIN -->
+
+<?php
+ echo "<h1>$name</h1>\n";
+
+ $sql = "SELECT rpm.*
+ FROM rpm
+ INNER JOIN repo ON (repo.main=rpm.repo_main AND repo.sub=rpm.repo_sub)
+ WHERE rpm.name='$name'
+ ORDER BY repo.id DESC";
+ $resrpm = $db->query($sql);
+ $rpm = ($resrpm ? $resrpm->fetchObject() : false);
+
+ $sql = "SELECT * FROM upstream WHERE name = '$name'";
+ $resup=$db->query($sql);
+ $up = ($resup ? $resup->fetchObject() : false);
+
+ $sql = "SELECT * FROM acls WHERE name = '$name'";
+ $resown=$db->query($sql);
+ $owner = ($resown ? $resown->fetchObject() : false);
+
+ echo "<table id='fedora-list-packages'>\n";
+ echo "<tr><th colspan='2'>Upstream info</th></tr>\n";
+ $i=0;
+
+ if ($rpm && $rpm->summary) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Summary</td><td><strong>". $rpm->summary . "</strong></td></tr>\n";
+ } else if ($owner->summary) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Summary</td><td><strong>". $owner->summary . "</strong></td></tr>\n";
+ }
+ if ($rpm && $rpm->url) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "URL</td><td><strong><a href='".$rpm->url."'>". $rpm->url . "</a></strong></td></tr>\n";
+ }
+ if ($up && $up->type) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Type</td><td><strong>". $up->type . "</strong></td></tr>\n";
+ }
+ if ($up && $up->channel) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Channel</td><td><strong>". $up->channel . "</strong></td></tr>\n";
+ }
+ if ($up && $up->stable) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Stable version</td><td><strong>". $up->stable . "</strong></td></tr>\n";
+ }
+ if ($up && $up->unstable && $up->stable!=$up->unstable) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Unstable version</td><td><strong>". $up->unstable . "</strong>";
+ if ($up->state) {
+ echo " (". $up->state . ")\n";
+ }
+ echo "</td></tr>\n";
+ }
+ if ($owner && $owner->owner) {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'><td>"; $i++;
+ echo "Owner</td><td><strong>". $owner->owner . "</strong>";
+ if ($owner->cc) {
+ echo " (". $owner->cc . ")\n";
+ }
+ }
+ echo "</table>";
+
+ if ($rpm) {
+ echo "<br /><table id='fedora-list-packages'>\n";
+ echo "<tr><th colspan='3'>Packages available in Fedora Repositories</th></tr>\n";
+ $prev=false;
+ do {
+ echo "<tr class='".($i%2 ? 'odd' : 'even')."'>"; $i++;
+ echo "<td><strong>".($rpm->repo_main==$prev ? "&nbsp;" : $prev=$rpm->repo_main)."</strong></td>";
+ echo "<td>".$rpm->repo_sub."</td>";
+ echo "<td>".($rpm->epoch ? $rpm->epoch.":" : "").$rpm->ver."-".$rpm->rel."</td>";
+ echo "</tr>\n";
+ } while ($rpm = $resrpm->fetchObject());
+ echo "</table>";
+ }
+
+}
+catch(PDOException $e) {
+ printf("%s ERREUR : %s\n", date("r"), $e->getMessage());
+}
+
+?>
+
+
+ <!-- document END -->
+ </div>
+ <div class="fedora-corner-br">&nbsp;</div>
+ <div class="fedora-corner-bl">&nbsp;</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>
+