From 89e0895f236a5e5ee4b5467a6bae5f03644bc934 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 9 Aug 2021 09:21:47 +0200 Subject: update to 4.2.0 --- 352.patch | 54 --------------------------------------------- composer.json | 53 ++++++++++++++++++++++++-------------------- php-ramsey-uuid-tests.patch | 41 ---------------------------------- php-ramsey-uuid.spec | 44 ++++++++++++++++-------------------- 4 files changed, 48 insertions(+), 144 deletions(-) delete mode 100644 352.patch delete mode 100644 php-ramsey-uuid-tests.patch diff --git a/352.patch b/352.patch deleted file mode 100644 index b7ba70d..0000000 --- a/352.patch +++ /dev/null @@ -1,54 +0,0 @@ -From 2a39b0a67413e902274b09f640c6b68ffbd199fa Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 29 Oct 2020 16:34:55 +0100 -Subject: [PATCH 1/2] catch ValueError raised by PHP 8 - ---- - src/Generator/DefaultNameGenerator.php | 6 +++++- - 1 file changed, 5 insertions(+), 1 deletion(-) - -diff --git a/src/Generator/DefaultNameGenerator.php b/src/Generator/DefaultNameGenerator.php -index 270e8fbe..be552b91 100644 ---- a/src/Generator/DefaultNameGenerator.php -+++ b/src/Generator/DefaultNameGenerator.php -@@ -29,7 +29,11 @@ class DefaultNameGenerator implements NameGeneratorInterface - public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string - { - /** @var string|bool $bytes */ -- $bytes = @hash($hashAlgorithm, $ns->getBytes() . $name, true); -+ try { -+ $bytes = @hash($hashAlgorithm, $ns->getBytes() . $name, true); -+ } catch (\ValueError $e) { -+ $bytes = false; // keep same behavior than PHP 7 */ -+ } - - if ($bytes === false) { - throw new NameException(sprintf( - -From 3a488f24e05e711809f61626aeb8740d53e56feb Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 29 Oct 2020 16:40:08 +0100 -Subject: [PATCH 2/2] CS - ---- - src/Generator/DefaultNameGenerator.php | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/Generator/DefaultNameGenerator.php b/src/Generator/DefaultNameGenerator.php -index be552b91..1c0b0048 100644 ---- a/src/Generator/DefaultNameGenerator.php -+++ b/src/Generator/DefaultNameGenerator.php -@@ -28,11 +28,11 @@ class DefaultNameGenerator implements NameGeneratorInterface - /** @psalm-pure */ - public function generate(UuidInterface $ns, string $name, string $hashAlgorithm): string - { -- /** @var string|bool $bytes */ - try { -+ /** @var string|bool $bytes */ - $bytes = @hash($hashAlgorithm, $ns->getBytes() . $name, true); - } catch (\ValueError $e) { -- $bytes = false; // keep same behavior than PHP 7 */ -+ $bytes = false; // keep same behavior than PHP 7 - } - - if ($bytes === false) { diff --git a/composer.json b/composer.json index 41d500b..a29d483 100644 --- a/composer.json +++ b/composer.json @@ -7,7 +7,6 @@ "identifier", "guid" ], - "homepage": "https://github.com/ramsey/uuid", "license": "MIT", "require": { "php": "^7.2 || ^8", @@ -16,47 +15,50 @@ "ramsey/collection": "^1.0", "symfony/polyfill-ctype": "^1.8" }, + "replace": { + "rhumsaa/uuid": "self.version" + }, "require-dev": { - "codeception/aspect-mock": "^3", - "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7.0", + "captainhook/captainhook": "^5.10", + "captainhook/plugin-composer": "^5.3", + "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", "doctrine/annotations": "^1.8", - "goaop/framework": "^2", + "ergebnis/composer-normalize": "^2.15", "mockery/mockery": "^1.3", "moontoast/math": "^1.1", "paragonie/random-lib": "^2", + "php-mock/php-mock": "^2.2", "php-mock/php-mock-mockery": "^1.3", - "php-mock/php-mock-phpunit": "^2.5", "php-parallel-lint/php-parallel-lint": "^1.1", - "phpbench/phpbench": "^0.17.1", + "phpbench/phpbench": "^1.0", "phpstan/extension-installer": "^1.0", "phpstan/phpstan": "^0.12", "phpstan/phpstan-mockery": "^0.12", "phpstan/phpstan-phpunit": "^0.12", - "phpunit/phpunit": "^8.5", - "psy/psysh": "^0.10.0", - "slevomat/coding-standard": "^6.0", + "phpunit/phpunit": "^8.5 || ^9", + "slevomat/coding-standard": "^7.0", "squizlabs/php_codesniffer": "^3.5", - "vimeo/psalm": "3.9.4" + "vimeo/psalm": "^4.9" }, "suggest": { "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", "ext-ctype": "Enables faster processing of character classification using ctype functions.", "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", - "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type.", - "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter" + "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", + "ramsey/uuid-doctrine": "Allows the use of Ramsey\\Uuid\\Uuid as Doctrine field type." }, "config": { "sort-packages": true }, "extra": { "branch-alias": { - "dev-master": "4.x-dev" + "dev-main": "4.x-dev" + }, + "captainhook": { + "force-install": true } }, - "replace": { - "rhumsaa/uuid": "self.version" - }, "autoload": { "psr-4": { "Ramsey\\Uuid\\": "src/" @@ -72,18 +74,26 @@ "Ramsey\\Uuid\\Test\\": "tests/" } }, + "minimum-stability": "dev", + "prefer-stable": true, "scripts": { + "analyze": [ + "@phpstan", + "@psalm" + ], + "build:clean": "git clean -fX build/", "lint": "parallel-lint src tests", + "lint:paths": "parallel-lint", "phpbench": "phpbench run", "phpcbf": "phpcbf -vpw --cache=build/cache/phpcs.cache", "phpcs": "phpcs --cache=build/cache/phpcs.cache", "phpstan": [ - "phpstan analyse -c tests/phpstan.neon --no-progress", - "phpstan analyse -c tests/phpstan-tests.neon --no-progress" + "phpstan analyse --no-progress", + "phpstan analyse -c phpstan-tests.neon --no-progress" ], - "psalm": "psalm --show-info=false --config=tests/psalm.xml", "phpunit": "phpunit --verbose --colors=always", "phpunit-coverage": "phpunit --verbose --colors=always --coverage-html build/coverage", + "psalm": "psalm --show-info=false --config=psalm.xml", "test": [ "@lint", "@phpbench", @@ -92,10 +102,5 @@ "@psalm", "@phpunit" ] - }, - "support": { - "issues": "https://github.com/ramsey/uuid/issues", - "rss": "https://github.com/ramsey/uuid/releases.atom", - "source": "https://github.com/ramsey/uuid" } } diff --git a/php-ramsey-uuid-tests.patch b/php-ramsey-uuid-tests.patch deleted file mode 100644 index d7964fb..0000000 --- a/php-ramsey-uuid-tests.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff -up ./tests/bootstrap.php.rpm ./tests/bootstrap.php ---- ./tests/bootstrap.php.rpm 2020-10-02 10:51:10.570005924 +0200 -+++ ./tests/bootstrap.php 2020-10-02 10:51:32.465928798 +0200 -@@ -11,8 +11,6 @@ error_reporting(E_ALL & ~E_DEPRECATED); - // Ensure floating-point precision is set to 14 (the default) for tests. - ini_set('precision', '14'); - --use AspectMock\Kernel; -- - require_once __DIR__ . '/../vendor/autoload.php'; // composer autoload - require_once __DIR__ . '/phpstan-bootstrap.php'; - -@@ -24,9 +22,3 @@ if (!is_dir($cacheDir)) { - } - } - --$kernel = Kernel::getInstance(); --$kernel->init([ -- 'debug' => true, -- 'cacheDir' => $cacheDir, -- 'includePaths' => [__DIR__ . '/../src'] --]); -diff -up ./tests/TestCase.php.rpm ./tests/TestCase.php ---- ./tests/TestCase.php.rpm 2020-10-02 10:51:20.047972540 +0200 -+++ ./tests/TestCase.php 2020-10-02 10:51:26.799948757 +0200 -@@ -4,7 +4,6 @@ declare(strict_types=1); - - namespace Ramsey\Uuid\Test; - --use AspectMock\Test as AspectMock; - use Mockery; - use PHPUnit\Framework\TestCase as PhpUnitTestCase; - -@@ -17,7 +16,6 @@ class TestCase extends PhpUnitTestCase - protected function tearDown(): void - { - parent::tearDown(); -- AspectMock::clean(); - Mockery::close(); - } - diff --git a/php-ramsey-uuid.spec b/php-ramsey-uuid.spec index a8171f5..202e91e 100644 --- a/php-ramsey-uuid.spec +++ b/php-ramsey-uuid.spec @@ -10,7 +10,7 @@ %bcond_without tests # Github -%global gh_commit cd4032040a750077205918c86049aa0f43d22947 +%global gh_commit 7231612a5221f5524d3575bebdce20eeef8547a1 %global gh_short %(c=%{gh_commit}; echo ${c:0:7}) %global gh_owner ramsey %global gh_project uuid @@ -22,8 +22,8 @@ %global ns_project Uuid Name: php-%{pk_vendor}-%{pk_name} -Version: 4.1.1 -Release: 3%{?dist} +Version: 4.2.0 +Release: 1%{?dist} Summary: Library for generating and working with UUIDs License: MIT @@ -32,10 +32,6 @@ Source0: %{name}-%{version}-%{gh_short}.tgz # Create git snapshot as tests are excluded from official tarball Source1: makesrc.sh -# don't use codeception/aspect-mock -Patch0: %{name}-tests.patch -Patch1: https://patch-diff.githubusercontent.com/raw/ramsey/uuid/pull/352.patch - BuildArch: noarch BuildRequires: php(language) >= 7.2 @@ -46,46 +42,42 @@ BuildRequires: php-json BuildRequires: php-pcre BuildRequires: php-spl # From composer.json, "require-dev": { -# "codeception/aspect-mock": "^3", -# "dealerdirect/phpcodesniffer-composer-installer": "^0.6.2 || ^0.7.0", +# "captainhook/captainhook": "^5.10", +# "captainhook/plugin-composer": "^5.3", +# "dealerdirect/phpcodesniffer-composer-installer": "^0.7.0", # "doctrine/annotations": "^1.8", -# "goaop/framework": "^2", +# "ergebnis/composer-normalize": "^2.15", # "mockery/mockery": "^1.3", # "moontoast/math": "^1.1", # "paragonie/random-lib": "^2", +# "php-mock/php-mock": "^2.2", # "php-mock/php-mock-mockery": "^1.3", -# "php-mock/php-mock-phpunit": "^2.5", # "php-parallel-lint/php-parallel-lint": "^1.1", -# "phpbench/phpbench": "^0.17.1", +# "phpbench/phpbench": "^1.0", # "phpstan/extension-installer": "^1.0", # "phpstan/phpstan": "^0.12", # "phpstan/phpstan-mockery": "^0.12", # "phpstan/phpstan-phpunit": "^0.12", -# "phpunit/phpunit": "^8.5", -# "psy/psysh": "^0.10.0", -# "slevomat/coding-standard": "^6.0", +# "phpunit/phpunit": "^8.5 || ^9", +# "slevomat/coding-standard": "^7.0", # "squizlabs/php_codesniffer": "^3.5", -# "vimeo/psalm": "3.9.4" +# "vimeo/psalm": "^4.9" %if %{with tests} # remirepo:1 %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 BuildRequires: (php-composer(brick/math) >= 0.8 with php-composer(brick/math) < 0.10) BuildRequires: (php-composer(ramsey/collection) >= 1.0 with php-composer(ramsey/collection) < 2) BuildRequires: (php-composer(mockery/mockery) >= 1.3 with php-composer(mockery/mockery) < 2) -# remirepo:5 +BuildRequires: (php-composer(php-mock/php-mock) >= 2.2 with php-composer(php-mock/php-mock) < 3) +# remirepo:6 %else BuildRequires: php-brick-math >= 0.8 BuildRequires: php-ramsey-collection >= 1.0 BuildRequires: php-mockery >= 1.3 +BuildRequires: php-mock2 >= 2.2 %endif -%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9 -# https://github.com/ramsey/uuid/pull/350 BuildRequires: phpunit9 %global phpunit %{_bindir}/phpunit9 -%else -BuildRequires: phpunit8 >= 8.5 -%global phpunit %{_bindir}/phpunit8 -%endif %endif # Autoloader BuildRequires: php-fedora-autoloader-devel @@ -129,8 +121,6 @@ Autoloader: %{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php %prep %setup -q -n %{gh_project}-%{gh_commit} -%patch0 -p1 -b .rpm -%patch1 -p1 -b .pr352 %build @@ -164,6 +154,7 @@ require '%{buildroot}%{_datadir}/php/%{ns_vendor}/%{ns_project}/autoload.php'; \Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\%{ns_project}\\Test\\', dirname(__DIR__) . '/tests'); \Fedora\Autoloader\Dependencies::required([ '%{_datadir}/php/Mockery1/autoload.php', + '%{_datadir}/tests/phpmock2/autoload.php', ]); EOF @@ -200,6 +191,9 @@ exit $ret %changelog +* Mon Aug 9 2021 Remi Collet - 4.2.0-1 +- update to 4.2.0 + * Fri Jan 29 2021 Remi Collet - 4.1.1-3 - ignore 2 tests and fix FTBFS -- cgit