diff options
author | Remi Collet <fedora@famillecollet.com> | 2014-05-16 11:20:32 +0200 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2014-05-16 11:20:32 +0200 |
commit | f9e3d0058ebaf131f85561f9a290b10da0853bbf (patch) | |
tree | b268b99c4be768f6c60466310c9da6d11916feb3 /checkpkgist | |
parent | 01cc66a23361366660fd1de194b4ec0777baa4f3 (diff) |
checkpkgist: display release date
Diffstat (limited to 'checkpkgist')
-rwxr-xr-x | checkpkgist/checkpkgist.php | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/checkpkgist/checkpkgist.php b/checkpkgist/checkpkgist.php index 0a0c961..4d39f1b 100755 --- a/checkpkgist/checkpkgist.php +++ b/checkpkgist/checkpkgist.php @@ -60,7 +60,7 @@ if (!$pkgs) { die("Bad configuration file\n"); } -printf(" %-40s %15s %15s\n", "Name", "Version", "Upstream"); +printf(" %-40s %15s %15s %15s\n", "Name", "Version", "Upstream", "Date"); foreach ($pkgs as $name => $rpm) { $rpmver = exec("rpm -q --qf '%{VERSION}' $rpm", $out, $ret); @@ -77,13 +77,22 @@ foreach ($pkgs as $name => $rpm) { continue; } if (version_compare($pkver, $rpmver, 'gt')) { - if ($pkg['source']['type']=='git') { - printf(" %-40s %15s %15s\n", $rpm, $rpmver, $pkver); - if ($verb) { - printf("\tURL: %s\n\tHash: %s\n", - ($pkg['source']['url']?:'unkown'), - ($pkg['source']['reference']?:'unkown')); - } + $date = new DateTime($pkg['time']); + $diff = $date->diff(new DateTime("now")); + if ($diff->days <2) { + $note = "(Just released)"; + } else if ($diff->days <20) { + $note = $diff->format("(%a days)"); + } else { + $note = ""; + } + + //print_r($pkg); + printf(" %-40s %15s %15s %15s %s\n", $rpm, $rpmver, $pkver, $date->format("Y-m-d"), $note); + if ($pkg['source']['type']=='git' && $verb) { + printf("\tURL: %s\n\tHash: %s\n", + ($pkg['source']['url']?:'unkown'), + ($pkg['source']['reference']?:'unkown')); } break; } |