summaryrefslogtreecommitdiffstats
path: root/checkpkgist
diff options
context:
space:
mode:
Diffstat (limited to 'checkpkgist')
-rwxr-xr-xcheckpkgist/checkpkgist.php45
-rw-r--r--checkpkgist/multiver.json10
2 files changed, 53 insertions, 2 deletions
diff --git a/checkpkgist/checkpkgist.php b/checkpkgist/checkpkgist.php
index 6acc6c8..33aee0e 100755
--- a/checkpkgist/checkpkgist.php
+++ b/checkpkgist/checkpkgist.php
@@ -65,10 +65,46 @@ class PkgClient {
}
}
+function getMax($name, $rpm) {
+ static $vers = NULL;
+ global $pkgs;
+
+ if (is_null($vers)) {
+ if ($vers = file_get_contents(__DIR__."/multiver.json")) {
+ $vers = json_decode($vers, true, 5);
+ } else {
+ $vers = [];
+ }
+ }
+
+ $rpms = array_keys($pkgs, $name);
+ $crt = 0;
+ $max = 9999;
+
+ if (preg_match('/[0-9]+$/', $rpm, $reg)) {
+ // This already a versionned name
+ $crt = intval($reg[0]);
+ }
+ if (isset($vers[$rpm])) {
+ $crt = $vers[$rpm];
+ $max = $crt+1;
+ }
+ foreach($rpms as $alt) {
+ if ($alt != $rpm && preg_match('/[0-9]+$/', $alt, $reg)) {
+ $ver = intval($reg[0]);
+ if ($ver>$crt && $ver<$max) {
+ $max = $ver;
+ }
+ }
+ }
+ return $max;
+}
+
function run($name, $rpm) {
global $quiet, $verb, $client;
$len = 50;
+ $limit = getMax($name, $rpm);
if (in_array($name, ['znerol/php-stringprep', 'psr/http-message-implementation'])) {
return;
@@ -110,6 +146,9 @@ function run($name, $rpm) {
$maxver = $pkver;
$maxdat = $date;
}
+ if (version_compare($pkver, $limit, 'ge')) {
+ continue;
+ }
if (version_compare($pkver, $rpmver, 'gt')) {
$diff = $date->diff(new DateTime("now"));
$rpm2 = $rpm;
@@ -225,9 +264,11 @@ for ($i=1 ; $i<$_SERVER['argc'] ; $i++) {
}
if (count($tmp)) {
$verb = true;
- $pkgs = $tmp;
+ $scan = $tmp;
+} else {
+ $scan = $pkgs;
}
-foreach ($pkgs as $rpm => $name) {
+foreach ($scan as $rpm => $name) {
run($name, $rpm);
}
echo str_repeat(' ', 80)."\n";
diff --git a/checkpkgist/multiver.json b/checkpkgist/multiver.json
new file mode 100644
index 0000000..d81f241
--- /dev/null
+++ b/checkpkgist/multiver.json
@@ -0,0 +1,10 @@
+{
+ "php-JsonSchema": 1,
+ "php-justinrainbow-json-schema": 2,
+ "php-PHPParser": 1,
+ "php-pimple1": 1,
+ "php-robrichards-xmlseclibs1": 1,
+ "php-robrichards-xmlseclibs": 2,
+ "php-symfony": 2
+}
+