summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-01-13 10:43:21 +0100
committerRemi Collet <remi@remirepo.net>2021-01-13 10:43:21 +0100
commitce0e24d41ca611073971051ef16bc83e3ce54368 (patch)
treed7ad1dbda92b49869e01d44461ba56e7889ed894
parent106c70d1a29de76233b57e907da2d84d146d54c9 (diff)
use rpminfo ext and report all provided libHEADmaster
-rw-r--r--checkpkgist.json15
-rwxr-xr-xcheckpkgist.php141
2 files changed, 99 insertions, 57 deletions
diff --git a/checkpkgist.json b/checkpkgist.json
index 92a2966..e758cae 100644
--- a/checkpkgist.json
+++ b/checkpkgist.json
@@ -27,9 +27,20 @@
"php-phpunitgoodpractices-traits": "phpunitgoodpractices\/traits",
"php-oneup-flysystem-bundle": "oneup\/flysystem-bundle",
"php-zendframework-zend-di3": "zendframework\/zend-di",
- "php-laminas-config3": "laminas\/laminas-config",
"php-laminas-di3": "laminas\/laminas-di",
"php-laminas-diactoros2": "laminas\/laminas-diactoros",
"php-laminas-hydrator3": "laminas\/laminas-hydrator",
+ "php-phpunit-php-timer4": "phpunit\/php-timer",
+ "php-monolog2": "monolog\/monolog",
+ "php-symfony-requirements-checker": "symfony\/requirements-checker",
+ "php-symfony5": "symfony\/symfony",
+ "php-clue-http-proxy-react": "clue\/http-proxy-react",
+ "php-clue-socks-react": "clue\/socks-react",
+ "php-clue-reactphp-ssh-proxy": "clue\/reactphp-ssh-proxy",
+ "php-doctrine-dbal3": "doctrine\/dbal",
+ "php-yoast-phpunit-polyfills": "yoast\/phpunit-polyfills",
+ "php-phpseclib3": "phpseclib\/phpseclib",
+ "php-sanmai-phpunit-legacy-adapter": "sanmai\/phpunit-legacy-adapter",
+ "php-laminas-code4": "laminas\/laminas-code",
"phinx": "robmorgan\/phinx"
-} \ No newline at end of file
+}
diff --git a/checkpkgist.php b/checkpkgist.php
index 4ed6531..418c875 100755
--- a/checkpkgist.php
+++ b/checkpkgist.php
@@ -36,7 +36,7 @@ if (!ini_get('date.timezone')) {
ini_set('date.timezone', 'Europe/Paris');
}
-define ('VERSION', '1.0.0-dev');
+define ('VERSION', '1.1.0-dev');
class PkgClient {
const URL = 'https://packagist.org/';
@@ -109,6 +109,14 @@ function getMax($name, $rpm) {
return $max;
}
+function displayName($rpm, $pkg, $len=50) {
+ $len -= strlen($rpm) + 3;
+ if (strlen($pkg) > $len) {
+ $pkg = '.' . substr($pkg, -($len-1));
+ }
+ return "$rpm ($pkg)";
+}
+
function run($name, $rpm) {
global $quiet, $verb, $client;
@@ -132,76 +140,99 @@ function run($name, $rpm) {
printf(" %-80s\r", $rpm);
}
- $rpmver = exec("rpm -q --qf '%{VERSION}' $rpm", $out, $ret);
- if ($ret) {
+ $rpminfo=rpmdbinfo($rpm);
+
+ if ($rpminfo) {
+ $rpminfo = $rpminfo[0];
+ $rpmmainver = $rpminfo['Version'];
+ } else {
if ($quiet) {
return;
}
- $rpmver = "n/a";
+ $rpmmainver = "n/a";
+ $rpminfo['Providename'] = ["php-composer($name)"];
+ $rpminfo['Provideversion'] = $rpmmainver;
}
- $pkgs = $client->getPackage($name);
- if ($pkgs && isset($pkgs['packages'][$name])) {
- $maxver = "";
- $maxdat = false;
- $display = false;
-
- foreach ($pkgs['packages'][$name] as $pkver => $pkg) {
- if (preg_match('/^v[\.0-9]*$/', $pkver)) {
- $pkver = substr($pkver, 1);
- }
- if (strpos($pkver, 'dev') !== false) {
- continue;
- }
- $date = new DateTime($pkg['time']??'now');
- if (version_compare($pkver, $maxver, 'gt')) {
- $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;
- if ($diff->days <2) {
- $note = "(Just released)";
- $rpm2 = substr($rpm . ' ' . str_repeat('.', $len), 0, $len);
- } else if ($diff->days <20) {
- $note = $diff->format("(%a days)");
- } else {
- $note = "";
+ foreach($rpminfo['Providename'] as $i => $n) {
+ if (preg_match('/php-composer\((.*)\)/', $n, $res)) {
+ $rpmver = $rpminfo['Provideversion'][$i];
+ $name = $res[1];
+ } else {
+ continue;
+ }
+ if (strpos($name, '-implementation') || strpos($name, '-api') || strpos($name, '/zend')) {
+ continue;
+ }
+ $pkgs = $client->getPackage($name);
+ if ($pkgs && isset($pkgs['packages'][$name])) {
+ $maxver = "";
+ $maxdat = false;
+ $display = false;
+
+ foreach ($pkgs['packages'][$name] as $pkver => $pkg) {
+ if (preg_match('/^v[\.0-9]*$/', $pkver)) {
+ $pkver = substr($pkver, 1);
+ }
+ if (strpos($pkver, 'dev') !== false) {
+ continue;
+ }
+ $date = new DateTime($pkg['time']??'now');
+ if (version_compare($pkver, $maxver, 'gt')) {
+ $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;
+ if ($diff->days <2) {
+ $note = "(Just released)";
+ $rpm2 = substr($rpm . ' ' . str_repeat('.', $len), 0, $len);
+ } else if ($diff->days <20) {
+ $note = $diff->format("(%a days)");
+ } else {
+ $note = "";
+ }
- //print_r($pkg);
- printf(" %-{$len}s %15s %15s %15s %s\n", $rpm2, $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'));
+ //print_r($pkg);
+ printf(" %-{$len}.{$len}s %15s %15s %15s %s\n", ($verb ? displayName($rpm2, $name, $len) : $rpm2), $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'));
+ }
+ $display = true;
+ if (!$verb) {
+ break;
+ }
}
- $display = true;
- if (!$verb) {
- break;
+ else if (version_compare($pkver, $rpmver, 'eq') && $verb && !$display) {
+ printf(" %-{$len}.{$len}s %15s %15s %15s\n", displayName($rpm, $name, $len), $rpmver, $pkver, $date->format("Y-m-d"));
+ $display = true;
+ if (!$verb) {
+ break;
+ }
}
}
- else if (version_compare($pkver, $rpmver, 'eq') && $verb && !$display) {
- printf(" %-{$len}s %15s %15s %15s\n", $rpm, $rpmver, $pkver, $date->format("Y-m-d"));
- $display = true;
- if (!$verb) {
- break;
- }
+ if ($verb && !$display) {
+ printf(" %-{$len}.{$len}s %15s %15s %15s\n", displayName($rpm, $name, $len), $rpmver, ($maxver ?: 'unkown'), ($maxdat ? $date->format("Y-m-d") : ''));
}
+ } else if (!$quiet) {
+ printf(" %-{$len}.{$len}s %15s %15s\n", displayName($rpm, $name, $len), $rpmver, "Not found!");
}
- if ($verb && !$display) {
- printf(" %-{$len}s %15s %15s %15s\n", $rpm, $rpmver, ($maxver ?: 'unkown'), ($maxdat ? $date->format("Y-m-d") : ''));
- }
- } else {
- printf(" %-{$len}s %15s %15s\n", $rpm, $rpmver, 'Not found !');
}
}
printf("\nCheckPkgist version %s by Remi Collet.\n\n", VERSION);
+if (!extension_loaded('rpminfo')) {
+ die("rpminfo extension is missing\n");
+}
+rpmaddtag(RPMTAG_PROVIDES);
+rpmaddtag(RPMTAG_PROVIDEVERSION);
+
if (in_array('-h', $_SERVER['argv']) || in_array('--help', $_SERVER['argv'])) {
echo <<<END
usage checkpkg [ options ] [ name ... ]