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 | 8ad1266d2ef409e50204410963666cd8506af59c (patch) | |
tree | 0960fe03a9e4769c68052a62cc83d38fe52a77d6 /checkpkgist.php | |
parent | a52812be79ab79dac4190988c6e837ddf436ffc9 (diff) |
checkpkgist: display release date
Diffstat (limited to 'checkpkgist.php')
-rwxr-xr-x | checkpkgist.php | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/checkpkgist.php b/checkpkgist.php index 0a0c961..4d39f1b 100755 --- a/checkpkgist.php +++ b/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; } |