summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2017-03-23 13:27:35 +0100
committerRemi Collet <fedora@famillecollet.com>2017-03-23 13:27:35 +0100
commitab6509f1cf430963a41d77cc4c4705c7ac8c5a2b (patch)
treee62d973c13b6ae505338358aa53b3666b4a27a68
parentd5a3ce25bd8422869b0dd9baf961307db83f255b (diff)
tools/checkpkgist moved to git.remirepo.net
-rw-r--r--checkpkgist/.gitignore1
-rw-r--r--checkpkgist/checkpkgist.json29
-rwxr-xr-xcheckpkgist/checkpkgist.php274
-rwxr-xr-xcheckpkgist/get10
-rw-r--r--checkpkgist/hoa.json29
-rw-r--r--checkpkgist/multiver.json16
6 files changed, 0 insertions, 359 deletions
diff --git a/checkpkgist/.gitignore b/checkpkgist/.gitignore
deleted file mode 100644
index 6ebac36..0000000
--- a/checkpkgist/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-rpmphp.json
diff --git a/checkpkgist/checkpkgist.json b/checkpkgist/checkpkgist.json
deleted file mode 100644
index f03a9e4..0000000
--- a/checkpkgist/checkpkgist.json
+++ /dev/null
@@ -1,29 +0,0 @@
-{
- "php-google-recaptcha": "google\/recaptcha",
- "php-phpmyadmin-sql-parser": "phpmyadmin\/sql-parser",
- "php-ZendFramework": "zendframework\/zendframework1",
- "php-phpunit-phpdcd": "sebastian\/phpdcd",
- "php-tecnickcom-tc-lib-pdf-parser": "tecnickcom\/tc-lib-pdf-parser",
- "php-tecnickcom-tc-lib-file": "tecnickcom\/tc-lib-file",
- "php-tecnickcom-tc-lib-pdf-encrypt": "tecnickcom\/tc-lib-pdf-encrypt",
- "php-tecnickcom-tc-lib-pdf-filter": "tecnickcom\/tc-lib-pdf-filter",
- "php-tecnickcom-tc-lib-pdf-graph": "tecnickcom\/tc-lib-pdf-graph",
- "php-tecnickcom-tc-lib-pdf-page": "tecnickcom\/tc-lib-pdf-page",
- "php-tecnickcom-tc-lib-unicode": "tecnickcom\/tc-lib-unicode",
- "php-tecnickcom-tc-lib-unicode-data": "tecnickcom\/tc-lib-unicode-data",
- "php-tedivm-jshrink": "tedivm\/jshrink",
- "php-sebastian-comparator2": "sebastian\/comparator",
- "php-sebastian-object-enumerator3": "sebastian\/object-enumerator",
- "php-justinrainbow-json-schema5": "justinrainbow\/json-schema",
- "php-sebastian-object-reflector": "sebastian\/object-reflector",
- "php-phpunit-dbunit3": "phpunit\/dbunit",
- "phpcov": "phpunit\/phpcov",
- "phpunit6": "phpunit\/phpunit",
- "php-phine-path": "phine\/path",
- "php-phine-exception": "phine\/exception",
- "php-pimple-lib": "pimple\/pimple",
- "php-theseer-fxsl": "theseer\/fxsl",
- "php-morris-lessql": "morris\/lessql",
- "phan": "etsy\/phan",
- "phinx": "robmorgan\/phinx"
-} \ No newline at end of file
diff --git a/checkpkgist/checkpkgist.php b/checkpkgist/checkpkgist.php
deleted file mode 100755
index a91e1ab..0000000
--- a/checkpkgist/checkpkgist.php
+++ /dev/null
@@ -1,274 +0,0 @@
-#!/usr/bin/env php
-<?php
-/**
- * CheckPkgist is a tool to check RPM update needed
- * using information from https://packagist.org/
- *
- * PHP version 5
- *
- * Copyright (C) 2014 Remi Collet
- * https://github.com/remicollet/remirepo/tree/master/tools/checkpkgist
- *
- * CheckPkgist is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) any later version.
- *
- * FedoraClient is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * See <http://www.gnu.org/licenses/>
- *
- * @category CheckPkgist
- * @package FedoraClient
- *
- * @author Remi Collet <remi@fedoraproject.org>
- * @copyright 2014 Remi Collet
- * @license http://www.gnu.org/licenses/lgpl-2.1.txt LGPL License 2.1 or (at your option) any later version
- * @link https://github.com/remicollet/remirepo/tree/master/tools/checkpkgist
- */
-
-require_once 'Cache/Lite.php';
-
-if (!ini_get('date.timezone')) {
- ini_set('date.timezone', 'Europe/Paris');
-}
-
-define ('VERSION', '1.0.0-dev');
-
-class PkgClient {
- const URL = 'https://packagist.org/';
- protected $cache;
-
- function __construct () {
- $dir = "/tmp/pkgist-".posix_getlogin()."/";
- @mkdir($dir);
- $this->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);
- }
-}
-
-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;
- }
- if (!strpos($name, '/')) {
- // e.g. ext-foo
- return;
- }
- list($owner, $library) = explode('/', $name, 2);
- if (in_array($owner, ['horde', 'kolab'])) {
- return;
- }
-
- if (!$quiet) {
- printf(" %-80s\r", $rpm);
- }
-
- $rpmver = exec("rpm -q --qf '%{VERSION}' $rpm", $out, $ret);
- if ($ret) {
- if ($quiet) {
- return;
- }
- $rpmver = "n/a";
- }
- $pkgs = $client->getPackage($name);
- if ($pkgs) {
- $maxver = "";
- $maxdat = false;
- $display = false;
- foreach ($pkgs['package']['versions'] 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'));
- }
- $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}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 (in_array('-h', $_SERVER['argv']) || in_array('--help', $_SERVER['argv'])) {
- echo <<<END
-usage checkpkg [ options ] [ name ... ]
-
- -h
- --help Display help (this page)
-
- -v
- --verbose Display all packages, with upsteam information
-
- -q
- --quiet Don't display not installed packages
- or packages with latest version installed
-
- -s
- --sort Sort output by package name
-END;
- die("\n\n");
-}
-
-$sort = (in_array('-s', $_SERVER['argv']) || in_array('--sort', $_SERVER['argv']));
-$verb = (in_array('-v', $_SERVER['argv']) || in_array('--verbose', $_SERVER['argv']));
-$quiet = (in_array('-q', $_SERVER['argv']) || in_array('--quiet', $_SERVER['argv']));
-$client = new PkgClient();
-
-$pkgs = file_get_contents(__DIR__."/rpmphp.json");
-if (!$pkgs) {
- die("Missing configuration file rpmphp\n");
-}
-$pkgs = json_decode($pkgs, true, 5);
-if (!$pkgs) {
- die("Bad configuration file rpmphp\n");
-}
-$pkg2 = file_get_contents(__DIR__."/checkpkgist.json");
-if (!$pkg2) {
- die("Missing configuration file checkpkgist\n");
-}
-$pkg2 = json_decode($pkg2, true, 5);
-if (!$pkg2) {
- die("Bad configuration file checkpkgist\n");
-}
-
-$change = false;
-foreach ($pkg2 as $rpm => $pkg) {
- if (isset($pkgs[$rpm])) {
- unset($pkg2[$rpm]);
- $change = true;
- } else {
- $pkgs[$rpm] = $pkg2[$rpm];
- }
-}
-if ($change) {
- if (file_put_contents(__DIR__."/checkpkgist.json", json_encode($pkg2, JSON_PRETTY_PRINT))) {
- printf("Configuration file changes saved\n");
- }
-}
-
-if ($sort) {
- natcasesort($pkgs);
-}
-printf(" %-50s %15s %15s %15s\n", "Name", "Version", "Upstream", "Date");
-
-$tmp = array();
-for ($i=1 ; $i<$_SERVER['argc'] ; $i++) {
- if (is_dir($rpm = $_SERVER['argv'][$i])) {
- $rpm = basename(realpath($_SERVER['argv'][$i]));
- }
- if (isset($pkgs[$rpm])) {
- $tmp[$rpm] = $pkgs[$rpm];
- }
-}
-if (count($tmp)) {
- $verb = true;
- $scan = $tmp;
-} else {
- $scan = $pkgs;
-}
-foreach ($scan as $rpm => $name) {
- run($name, $rpm);
-}
-echo str_repeat(' ', 80)."\n";
diff --git a/checkpkgist/get b/checkpkgist/get
deleted file mode 100755
index c2ed34a..0000000
--- a/checkpkgist/get
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/bin/sh
-
-mv rpmphp.json.prev /tmp
-if wget 'http://rpms.famillecollet.com/rpmphp/get.php?table=packagist2' -O rpmphp.json.new
-then
- mv rpmphp.json rpmphp.json.prev && \
- mv rpmphp.json.new rpmphp.json && \
- echo done
- colordiff rpmphp.json.prev rpmphp.json
-fi
diff --git a/checkpkgist/hoa.json b/checkpkgist/hoa.json
deleted file mode 100644
index 6c45249..0000000
--- a/checkpkgist/hoa.json
+++ /dev/null
@@ -1,29 +0,0 @@
- "php-hoa-event": "hoa\/event",
- "php-hoa-exception": "hoa\/exception",
- "php-hoa-cli": "hoa\/cli",
- "php-hoa-compiler": "hoa\/compiler",
- "php-hoa-consistency": "hoa\/consistency",
- "php-hoa-console": "hoa\/console",
- "php-hoa-devtools": "hoa\/devtools",
- "php-hoa-dispatcher": "hoa\/dispatcher",
- "php-hoa-iterator": "hoa\/iterator",
- "php-hoa-json": "hoa\/json",
- "php-hoa-file": "hoa\/file",
- "php-hoa-locale": "hoa\/locale",
- "php-hoa-math": "hoa\/math",
- "php-hoa-praspel": "hoa\/praspel",
- "php-hoa-protocol": "hoa\/protocol",
- "php-hoa-realdom": "hoa\/realdom",
- "php-hoa-regex": "hoa\/regex",
- "php-hoa-router": "hoa\/router",
- "php-hoa-stream": "hoa\/stream",
- "php-hoa-stringbuffer": "hoa\/stringbuffer",
- "php-hoa-http": "hoa\/http",
- "php-hoa-test": "hoa\/test",
- "php-hoa-ustring": "hoa\/ustring",
- "php-hoa-view": "hoa\/view",
- "php-hoa-visitor": "hoa\/visitor",
- "php-hoa-xml": "hoa\/xml",
- "php-hoa-xyl": "hoa\/xyl",
- "php-hoa-zformat": "hoa\/zformat",
-
diff --git a/checkpkgist/multiver.json b/checkpkgist/multiver.json
deleted file mode 100644
index d4a6032..0000000
--- a/checkpkgist/multiver.json
+++ /dev/null
@@ -1,16 +0,0 @@
-{
- "php-JsonSchema": 1,
- "php-justinrainbow-json-schema": 2,
- "php-PHPParser": 1,
- "php-pimple1": 1,
- "php-phpunit-PHPUnit": 5,
- "php-phpunit-PHPUnit-MockObject": 3,
- "php-phpunit-PHP-CodeCoverage": 4,
- "php-phpunit-DbUnit": 2,
- "php-phpunit-phpcov": 3,
- "php-robrichards-xmlseclibs1": 1,
- "php-robrichards-xmlseclibs": 2,
- "php-symfony": 2,
- "php-udan11-sql-parser": 3
-}
-