diff options
author | Remi Collet <fedora@famillecollet.com> | 2014-05-16 13:46:18 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2014-05-16 13:46:18 +0200 |
commit | 91bb99ae0070f8eaa40e87ca625f265bb958e1db (patch) | |
tree | 1aa9765f2aa4ae10ddc8ac1ec7bfea5b62448207 /checkpkgist.php | |
parent | e4ef04a41f883a171a910760d02f980fcbeef343 (diff) |
checkpkgist: display max version, when < current
Diffstat (limited to 'checkpkgist.php')
-rwxr-xr-x | checkpkgist.php | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/checkpkgist.php b/checkpkgist.php index 5ffcccc..b864d4e 100755 --- a/checkpkgist.php +++ b/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 !'); } |