summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--class/PackagistClient.php9
-rw-r--r--class/Parser.php12
-rw-r--r--refresh.php2
-rw-r--r--smarty/templates/rpmphp/zoom.tpl2
-rw-r--r--zoom.php2
5 files changed, 20 insertions, 7 deletions
diff --git a/class/PackagistClient.php b/class/PackagistClient.php
index 2fbb522..5ea8429 100644
--- a/class/PackagistClient.php
+++ b/class/PackagistClient.php
@@ -68,10 +68,9 @@ class PackagistClient
return ($rep ? json_decode($rep, true) : false);
}
- function getPackage($name)
+ function getPackage($name, $crt=0, $max=0)
{
$unstable = array('alpha', 'beta', 'rc');
-
$ret = false;
$pkgs = $this->getPackageData($name);
if ($pkgs) {
@@ -81,7 +80,11 @@ class PackagistClient
'unstable' => NULL,
'state' => NULL,
);
- foreach ($pkgs['package']['versions'] as $pkver => $pkg) {
+ foreach ($pkgs['package']['versions'] as $notused => $pkg) {
+ $pkver = $pkg['version'];
+ if ($pkver < $crt || $pkver > $max) {
+ continue;
+ }
if (preg_match('/^v[0-9]/', $pkver)) {
$pkver = substr($pkver, 1);
}
diff --git a/class/Parser.php b/class/Parser.php
index ca00ac8..bb5306f 100644
--- a/class/Parser.php
+++ b/class/Parser.php
@@ -516,12 +516,20 @@ class Parser
self::log("Packagist search releases");
$pk = new PackagistClient();
- $nb = $uptable->delete(array('type'=>'composer'));
+ $nb = $uptable->delete(['type'=>'composer']);
self::log("Delete $nb packages");
$tot = 0;
foreach($pktable->request(array('ORDER'=>'rpmname')) as $rec) {
- if ($rep = $pk->getPackage($rec['pkgname'])) {
+ if (preg_match('/[0-9]+$/', $rec['rpmname'], $reg)) {
+ // This already a versionned name
+ $crt = intval($reg[0]);
+ $max = $crt+1;
+ } else {
+ $crt = 0;
+ $max = 99999;
+ }
+ if ($rep = $pk->getPackage($rec['pkgname'], $crt, $max)) {
$v = explode('/', $rec['pkgname']);
switch(count($v)) {
case 3:
diff --git a/refresh.php b/refresh.php
index 7fb4810..90ba2a1 100644
--- a/refresh.php
+++ b/refresh.php
@@ -119,7 +119,7 @@ try {
if ($_SERVER['argc']==1 || in_array('owner', $_SERVER['argv'])) {
$url = "https://admin.fedoraproject.org/pkgdb/api/bugzilla";
- Parser::readAcls($acltable, $url);
+ // Parser::readAcls($acltable, $url);
}
if ($_SERVER['argc']==1 || in_array('optimize', $_SERVER['argv'])) {
diff --git a/smarty/templates/rpmphp/zoom.tpl b/smarty/templates/rpmphp/zoom.tpl
index 960a908..6bc91d1 100644
--- a/smarty/templates/rpmphp/zoom.tpl
+++ b/smarty/templates/rpmphp/zoom.tpl
@@ -43,6 +43,8 @@
<td{if $k eq 'Description'} id="pkgdb_desc"{/if}>
{if $k eq 'Bugzilla'}
<a href="{$v}">Active bugs</a>
+ {elseif $k eq 'Packagist'}
+ <a href="https://packagist.org/packages/{$v}">{$v}</a>
{elseif $k eq 'URL' or $k eq 'Pagure' or $k eq 'Packages' or $k eq 'Koschei'}
<a href="{$v}">{$v}</a>
{else}
diff --git a/zoom.php b/zoom.php
index bada131..8ce667c 100644
--- a/zoom.php
+++ b/zoom.php
@@ -140,7 +140,7 @@ if ( !isset($name) || !$name ) {
$summary['Type'] = $up['type'];
}
if ($rpm->pkgname) {
- $summary['Composer name'] = $rpm->pkgname;
+ $summary['Packagist'] = $rpm->pkgname;
} else if ($up && $up['channel']) {
$summary['Channel'] = $up['channel'];
}