From 1d9140560f969d4545e5b1ba762a90a5385f62f4 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Sat, 22 May 2010 14:51:15 +0200 Subject: import current version --- .gitignore | 1 + all.php | 286 ++++++++++++++++++++++++++++++++++ config.inc.php.dist | 7 + index.php | 171 ++++++++++++++++++++ install.txt | 127 +++++++++++++++ refresh.php | 437 ++++++++++++++++++++++++++++++++++++++++++++++++++++ rpm.php | 310 +++++++++++++++++++++++++++++++++++++ zoom.php | 207 +++++++++++++++++++++++++ 8 files changed, 1546 insertions(+) create mode 100644 .gitignore create mode 100644 all.php create mode 100644 config.inc.php.dist create mode 100644 index.php create mode 100644 install.txt create mode 100644 refresh.php create mode 100644 rpm.php create mode 100644 zoom.php 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 @@ + + + + Packages in Fedora + + + + + + + + + + + +
+ + +
+ +
+ + +
+ +
+ +
+ +
+   + Reports home +   + All packages + + + +
+
+ + + + +
+
 
+
 
+
+ + + + + +query($sql); + if ($res && $row=$res->fetchObject()) { + printf("

Repositories last updated %s.

", date("r", $row->stamp)); + } + + if ($what) Report($db); + else echo "

Choose a criteria from the search menu

"; + + //echo "
"; print_r($rpms); echo "
"; + +} +catch(PDOException $e) { + printf("%s ERREUR : %s\n", date("r"), $e->getMessage()); +} + +?> +

 

+ + + + + + +
Legend: Repo: bold for latest release.
Lastest released (as in rawhide)
Lastest in testing
Lastest not available
+ + +
+
 
+
 
+
+ + + + + + + + + + + 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 @@ + + diff --git a/index.php b/index.php new file mode 100644 index 0000000..77a6663 --- /dev/null +++ b/index.php @@ -0,0 +1,171 @@ + + + + Packages in Fedora + + + + + + + + + + + +
+ + +
+ +
+ +
+ +
+   + Reports home + + + +
+
+ + + + +
+
 
+
 
+
+ + + +

Packages in Fedora repositories

+

Package reports

+ +

Analysed repositories

+ + +\n"; + echo "MainActiveSubUrlLast update\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 ("%s%s%s%s%s\n", + ($i%2 ? 'odd' : 'even'), + ($repo->main != $prev ? $repo->main : " "), + ($repo->main != $prev ? ($repo->active ? "Yes" : "no") : " "), + $repo->sub, $repo->url, $repo->url, date("r", $repo->stamp)); + } + echo "\n"; + +} +catch(PDOException $e) { + printf("%s ERREUR : %s\n", date("r"), $e->getMessage()); +} + +?> + +

Script sources

+ + "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 ("\n", + ($i%2 ? 'odd' : 'even'), $page, $page, $name, date("r", $stat["mtime"])); + $i++; + } +?> +
NameDescriptionDate
%s%s%s
+

Any feedback, RFE and patches are welcome.

+ + +
+
 
+
 
+
+ + + + + + + + + + + diff --git a/install.txt b/install.txt new file mode 100644 index 0000000..65a6a67 --- /dev/null +++ b/install.txt @@ -0,0 +1,127 @@ + + Installation Base pour RPM-PHP + + +

Installation Base pour RPM-PHP

+%s\n", $Sql); + $nb=$db->exec($Sql); + if ($nb === false) { + $err=$db->errorInfo(); + printf("Erreur SQL : %s\n", $err[2]); + if ($AbortIfError) die("
** Abandon **"); + } + else { + $ret = $db->lastInsertId(); + if ($nb) printf("Nombre de rangées affectées : %d

\n", $nb); + else if ($ret) printf("Valeur de l'index : %d

\n", $ret); + return ($ret); + } +// else echo "OK.

\n"; + return 0; + +} +function Query ($Sql) +{ + global $db; + + printf("
%s
\n", $Sql); + $res=$db->query($Sql); + if (!$res) { + $err=$db->errorInfo(); + printf("Erreur SQL : %s\n", $err[2]); + } else { + echo ""; + for ($i=0 ; $i<$res->columnCount() ; $i++) { + $meta=$res->getColumnMeta($i); + //echo ""; + printf("", $meta["name"]); + } + while ($row = $res->fetch()) { + echo ""; + // echo ""; + for ($i=0 ; $i<$res->columnCount() ; $i++) { + printf("", $row[$i]); + } + echo ""; + } + echo "\n"; + echo "
"; print_r($meta); echo "
%s
"; print_r($row); echo "
%s 
\n"; + } +} +try { +$db = new PDO ("mysql:host=" .MYHOST, MYUSER, MYPASS); + +printf("

Verion PHP : %s
\n", phpversion()); +foreach ($db->query("SELECT VERSION() AS Version") as $Row) + printf ("Version du serveur : %s

\n", $Row["Version"]); + +echo "

Création du SCHEMA

"; + +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 @@ +"; + 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 = "/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>/iU'; + } else { + $pos = 0; + $pat1 = '/(.*)<\/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 ""; +?> 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 echo $type; ?> extensions in Fedora + + + + + + + + + + + +
+ + +
+ +"; + echo ""; +?> + + + + +
+ +
+ +
+   + Reports home +   + + + + +
+
+ + + + +
+
 
+
 
+
+ + + + + +query($sql); + if ($res && $row=$res->fetchObject()) { + printf("

Repositories last updated %s.

", date("r", $row->stamp)); + } + + Report($db, $type); + echo "

 

"; + +} +catch(PDOException $e) { + printf("%s ERREUR : %s\n", date("r"), $e->getMessage()); +} + +?> + + + + + + +
Legend: Upstream: bold if stable. Repo: bold for latest release.
Lastest released (stable if exists)
Lastest in testing
Lastest not available
+ + +
+
 
+
 
+
+ + + + + + + + + + + diff --git a/zoom.php b/zoom.php new file mode 100644 index 0000000..d597ec4 --- /dev/null +++ b/zoom.php @@ -0,0 +1,207 @@ + + + + Packages in Fedora + + + + + + + + + + + +
+ + +
+ +
+ +
+ +
+   + Reports home +   + Package detail + + + +
+
+ + + + +
+
 
+
 
+
+ + + +$name\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 "\n"; + echo "\n"; + $i=0; + + if ($rpm && $rpm->summary) { + echo "\n"; + } else if ($owner->summary) { + echo "\n"; + } + if ($rpm && $rpm->url) { + echo "\n"; + } + if ($up && $up->type) { + echo "\n"; + } + if ($up && $up->channel) { + echo "\n"; + } + if ($up && $up->stable) { + echo "\n"; + } + if ($up && $up->unstable && $up->stable!=$up->unstable) { + echo "\n"; + } + if ($owner && $owner->owner) { + echo "
Upstream info
"; $i++; + echo "Summary". $rpm->summary . "
"; $i++; + echo "Summary". $owner->summary . "
"; $i++; + echo "URL". $rpm->url . "
"; $i++; + echo "Type". $up->type . "
"; $i++; + echo "Channel". $up->channel . "
"; $i++; + echo "Stable version". $up->stable . "
"; $i++; + echo "Unstable version". $up->unstable . ""; + if ($up->state) { + echo " (". $up->state . ")\n"; + } + echo "
"; $i++; + echo "Owner". $owner->owner . ""; + if ($owner->cc) { + echo " (". $owner->cc . ")\n"; + } + } + echo "
"; + + if ($rpm) { + echo "
\n"; + echo "\n"; + $prev=false; + do { + echo ""; $i++; + echo ""; + echo ""; + echo ""; + echo "\n"; + } while ($rpm = $resrpm->fetchObject()); + echo "
Packages available in Fedora Repositories
".($rpm->repo_main==$prev ? " " : $prev=$rpm->repo_main)."".$rpm->repo_sub."".($rpm->epoch ? $rpm->epoch.":" : "").$rpm->ver."-".$rpm->rel."
"; + } + +} +catch(PDOException $e) { + printf("%s ERREUR : %s\n", date("r"), $e->getMessage()); +} + +?> + + + +
+
 
+
 
+
+ + + + + + + + + + + -- cgit