summaryrefslogtreecommitdiffstats
path: root/checkpkgist/checkpkgist.php
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2014-05-16 13:46:18 +0200
committerRemi Collet <fedora@famillecollet.com>2014-05-16 13:46:18 +0200
commit3db6f533713c255588d381baef61a30bcb2bc439 (patch)
tree07113c891616c70f6db798a18e9c71c7124d1240 /checkpkgist/checkpkgist.php
parent02f7ecd8471810253e35cc8155034670ae4b8710 (diff)
checkpkgist: display max version, when < current
Diffstat (limited to 'checkpkgist/checkpkgist.php')
-rwxr-xr-xcheckpkgist/checkpkgist.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/checkpkgist/checkpkgist.php b/checkpkgist/checkpkgist.php
index 5ffcccc..b864d4e 100755
--- a/checkpkgist/checkpkgist.php
+++ b/checkpkgist/checkpkgist.php
@@ -105,11 +105,18 @@ foreach ($pkgs as $name => $rpm) {
}
$pkgs = $client->getPackage($name);
if ($pkgs) {
+ $maxver = "";
+ $maxdat = false;
+ $display = false;
foreach ($pkgs['package']['versions'] as $pkver => $pkg) {
if (strpos($pkver, 'dev') !== false) {
continue;
}
$date = new DateTime($pkg['time']);
+ if (version_compare($pkver, $maxver, 'gt')) {
+ $maxver = $pkver;
+ $maxdat = $date;
+ }
if (version_compare($pkver, $rpmver, 'gt')) {
$diff = $date->diff(new DateTime("now"));
if ($diff->days <2) {
@@ -127,13 +134,18 @@ foreach ($pkgs as $name => $rpm) {
($pkg['source']['url']?:'unkown'),
($pkg['source']['reference']?:'unkown'));
}
+ $display = true;
break;
}
else if (version_compare($pkver, $rpmver, 'eq') && $verb) {
printf(" %-40s %15s %15s %15s\n", $rpm, $rpmver, $pkver, $date->format("Y-m-d"));
+ $display = true;
break;
}
}
+ if ($verb && !$display) {
+ printf(" %-40s %15s %15s %15s\n", $rpm, $rpmver, ($maxver ?: 'unkown'), ($maxdat ? $date->format("Y-m-d") : ''));
+ }
} else {
printf(" %-40s %15s %15s\n", $rpm, $rpmver, 'Not found !');
}