From a52812be79ab79dac4190988c6e837ddf436ffc9 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 16 May 2014 10:24:22 +0200 Subject: checkpkgist: new tool, to check upstream new version, using packagist --- checkpkgist.json | 50 +++++++++++++++++++++++++++++ checkpkgist.php | 98 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 148 insertions(+) create mode 100644 checkpkgist.json create mode 100755 checkpkgist.php diff --git a/checkpkgist.json b/checkpkgist.json new file mode 100644 index 0000000..86aa3d8 --- /dev/null +++ b/checkpkgist.json @@ -0,0 +1,50 @@ +/* + CheckPkgist configuration file + + Key: packagist name + Value: RPM name + + Last update: 2014-05-16 +*/ +{ + "michelf/php-markdown": "php-markdown", + "mikey179/vfsStream": "php-mikey179-vfsstream", + "sabberworm/php-css-parser": "php-PHP-CSS-Parser", + "solarium/solarium": "php-solarium", + "twig/twig": "php-twig-Twig", + "zendframework/zendframework1": "php-ZendFramework", + + "bartlett/php-compatinfo": "php-bartlett-PHP-CompatInfo", + "bartlett/php-reflect": "php-bartlett-PHP-Reflect", + + "sabre/dav": "php-sabre-dav", + "sabre/event": "php-sabre-event", + "sabre/http": "php-sabre-http", + "sabre/vobject": "php-sabre-vobject", + + "phploc/phploc": "php-phpunit-phploc", + + "phpunit/dbunit": "php-phpunit-DbUnit", + "phpunit/phpcov": "php-phpunit-phpcov", + "phpunit/php-code-coverage": "php-phpunit-PHP-CodeCoverage", + "phpunit/php-file-iterator": "php-phpunit-File-Iterator", + "phpunit/php-invoker": "php-phpunit-PHP-Invoker", + "phpunit/php-text-template": "php-phpunit-Text-Template", + "phpunit/php-timer": "php-phpunit-PHP-Timer", + "phpunit/php-token-stream": "php-phpunit-PHP-TokenStream", + "phpunit/phpunit": "php-phpunit-PHPUnit", + "phpunit/phpunit-mock-objects": "php-phpunit-PHPUnit-MockObject", + "phpunit/phpunit-selenium": "php-phpunit-PHPUnit-Selenium", + "phpunit/phpunit-skeleton-generator": "php-phpunit-PHPUnit-SkeletonGenerator", + "phpunit/phpunit-story": "php-phpunit-PHPUnit-Story", + + "sebastian/comparator": "php-phpunit-comparator", + "sebastian/diff": "php-phpunit-diff", + "sebastian/environment": "php-phpunit-environment", + "sebastian/exporter": "php-phpunit-exporter", + "sebastian/finder-facade": "php-phpunit-FinderFacade", + "sebastian/git": "php-phpunit-git", + "sebastian/phpcpd": "php-phpunit-phpcpd", + "sebastian/phpdcd": "php-phpunit-phpdcd", + "sebastian/version": "php-phpunit-Version", +} \ No newline at end of file diff --git a/checkpkgist.php b/checkpkgist.php new file mode 100755 index 0000000..0a0c961 --- /dev/null +++ b/checkpkgist.php @@ -0,0 +1,98 @@ +#!/usr/bin/php +cache = new Cache_Lite( + array( + 'memoryCaching' => true, + 'cacheDir' => $dir, + 'automaticSerialization' => true + ) + ); + } + + function getPackage($name) { + $url = self::URL.'packages/'.$name.'.json'; + $rep = $this->cache->get(__METHOD__, $url); + if (!$rep) { + $rep = @file_get_contents($url); + $this->cache->save($rep, __METHOD__, $url); + } + return ($rep ? json_decode($rep, true) : false); + } +} + +if (in_array('-h', $_SERVER['argv']) || in_array('--help', $_SERVER['argv'])) { + echo << $rpm) { + $rpmver = exec("rpm -q --qf '%{VERSION}' $rpm", $out, $ret); + if ($ret) { + if ($quiet) { + continue; + } + $rpmver = "n/a"; + } + $pkgs = $client->getPackage($name); + if ($pkgs) { + foreach ($pkgs['package']['versions'] as $pkver => $pkg) { + if (strpos($pkver, 'dev') !== false) { + 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')); + } + } + break; + } + else if (version_compare($pkver, $rpmver, 'eq') && $verb) { + printf(" %-40s %15s %15s\n", $rpm, $rpmver, $pkver); + break; + } + } + } else { + printf(" %-40s %15s %15s\n", $rpm, $rpmver, 'Not found !'); + } +} \ No newline at end of file -- cgit