From eac227482063e1f9badd5c31d4387fb66dda56f8 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 31 Mar 2021 14:11:39 +0200 Subject: add minimal patch for PHP 8 --- composer.json | 58 +++++++++++++++++++++++++++++++++++++++++++++++ php-JsonSchema-php8.patch | 12 ++++++++++ php-JsonSchema.spec | 14 ++++++++---- 3 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 composer.json create mode 100644 php-JsonSchema-php8.patch diff --git a/composer.json b/composer.json new file mode 100644 index 0000000..68b3933 --- /dev/null +++ b/composer.json @@ -0,0 +1,58 @@ +{ + "name": "justinrainbow/json-schema", + "description": "A library to validate a json schema.", + "keywords": ["json", "schema"], + "homepage": "https://github.com/justinrainbow/json-schema", + "type": "library", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Bruno Prieto Reis", + "email": "bruno.p.reis@gmail.com" + }, + { + "name": "Justin Rainbow", + "email": "justin.rainbow@gmail.com" + }, + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + }, + { + "name": "Robert Schönthal", + "email": "seroscho@googlemail.com" + } + ], + "repositories": [{ + "type": "package", + "package": { + "name": "json-schema/JSON-Schema-Test-Suite", + "version": "1.1.0", + "source": { + "url": "https://github.com/json-schema/JSON-Schema-Test-Suite", + "type": "git", + "reference": "1.1.0" + } + } + }], + "require": { + "php": ">=5.3.29" + }, + "require-dev": { + "json-schema/JSON-Schema-Test-Suite": "1.1.0", + "phpunit/phpunit": "~3.7", + "phpdocumentor/phpdocumentor": "~2" + }, + "autoload": { + "psr-4": { "JsonSchema\\": "src/JsonSchema/" } + }, + "autoload-dev": { + "psr-4": { "JsonSchema\\Tests\\": "tests/JsonSchema/Tests/" } + }, + "bin": ["bin/validate-json"], + "extra": { + "branch-alias": { + "dev-master": "1.6.x-dev" + } + } +} diff --git a/php-JsonSchema-php8.patch b/php-JsonSchema-php8.patch new file mode 100644 index 0000000..21ea2c5 --- /dev/null +++ b/php-JsonSchema-php8.patch @@ -0,0 +1,12 @@ +diff -up ./src/JsonSchema/Uri/UriResolver.php.php8 ./src/JsonSchema/Uri/UriResolver.php +--- ./src/JsonSchema/Uri/UriResolver.php.php8 2021-03-31 14:05:54.880445272 +0200 ++++ ./src/JsonSchema/Uri/UriResolver.php 2021-03-31 14:06:03.008417398 +0200 +@@ -112,7 +112,7 @@ class UriResolver + if ($relativePath == '') { + return $basePath; + } +- if ($relativePath{0} == '/') { ++ if ($relativePath[0] == '/') { + return $relativePath; + } + diff --git a/php-JsonSchema.spec b/php-JsonSchema.spec index 5f09374..d252e27 100644 --- a/php-JsonSchema.spec +++ b/php-JsonSchema.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-JsonSchema # -# Copyright (c) 2012-2018 Shawn Iwinski +# Copyright (c) 2012-2021 Shawn Iwinski # # License: MIT # http://opensource.org/licenses/MIT @@ -33,10 +33,9 @@ Name: php-%{lib_name} Version: %{github_version} -Release: 10%{?dist} +Release: 16%{?dist} Summary: PHP implementation of JSON schema -Group: Development/Libraries License: BSD URL: https://github.com/%{github_owner}/%{github_name} # Use a git snapshot as upstream remove tests from distribution @@ -46,6 +45,9 @@ Source2: %{name}-makesrc.sh # https://github.com/justinrainbow/json-schema/pull/292 Patch0: %{name}-pr292.patch +# Minimal patch for PHP 8 +Patch1: %{name}-php8.patch + BuildArch: noarch %if %{with_tests} @@ -100,6 +102,7 @@ See http://json-schema.org for more details. %prep %setup -qn %{github_name}-%{github_commit} %patch0 -p1 +%patch1 -p1 : Create autoloader cat <<'AUTOLOAD' | tee src/%{lib_name}/autoload.php @@ -139,7 +142,7 @@ require '%{buildroot}%{phpdir}/%{lib_name}/autoload.php'; EOF ret=0 -for cmd in php php70 php71 php72 php73; do +for cmd in php php73 php74 php80; do if which $cmd; then $cmd %{_bindir}/phpunit --verbose || ret=1 fi @@ -161,6 +164,9 @@ exit $ret %changelog +* Wed Mar 31 2021 Remi Collet - 1.6.1-16 +- add minimal patch for PHP 8 + * Sun Dec 9 2018 Remi Collet - 1.6.1-10 - cleanup for EL-8 -- cgit