From de5c166947adedbd5a19ad493a47a675123eb4c5 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Fri, 1 Sep 2023 10:19:23 +0200 Subject: build out of sources tree add patch for 8.3 from https://github.com/supermetrics-public/pecl-jsonpath/pull/169 --- 169.patch | 36 +++++++++++++++++++++ php-pecl-jsonpath.spec | 87 ++++++++++++++++++++++---------------------------- 2 files changed, 75 insertions(+), 48 deletions(-) create mode 100644 169.patch diff --git a/169.patch b/169.patch new file mode 100644 index 0000000..351ada2 --- /dev/null +++ b/169.patch @@ -0,0 +1,36 @@ +From eedeeb06c4fc02c0d28bf1aab3a1622666a52de2 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Fri, 1 Sep 2023 10:11:30 +0200 +Subject: [PATCH] relax test for 8.3 + +--- + tests/comparison_root/003_php8.phpt | 2 +- + tests/comparison_root/004_php8.phpt | 2 +- + 2 files changed, 2 insertions(+), 2 deletions(-) + +diff --git a/tests/comparison_root/003_php8.phpt b/tests/comparison_root/003_php8.phpt +index 8f814df..1539aac 100644 +--- a/tests/comparison_root/003_php8.phpt ++++ b/tests/comparison_root/003_php8.phpt +@@ -14,7 +14,7 @@ $result = $jsonPath->find($data, "$"); + var_dump($result); + ?> + --EXPECTF-- +-Fatal error: Uncaught TypeError: JsonPath\JsonPath::find(): Argument #1 ($data) must be of type array, bool given in %s003_php8.php:%d ++Fatal error: Uncaught TypeError: JsonPath\JsonPath::find(): Argument #1 ($data) must be of type array, %s given in %s003_php8.php:%d + Stack trace: + %s + %s +diff --git a/tests/comparison_root/004_php8.phpt b/tests/comparison_root/004_php8.phpt +index 4fd994f..69275b9 100644 +--- a/tests/comparison_root/004_php8.phpt ++++ b/tests/comparison_root/004_php8.phpt +@@ -14,7 +14,7 @@ $result = $jsonPath->find($data, "$"); + var_dump($result); + ?> + --EXPECTF-- +-Fatal error: Uncaught TypeError: JsonPath\JsonPath::find(): Argument #1 ($data) must be of type array, bool given in %s004_php8.php:%d ++Fatal error: Uncaught TypeError: JsonPath\JsonPath::find(): Argument #1 ($data) must be of type array, %s given in %s004_php8.php:%d + Stack trace: + %s + %s diff --git a/php-pecl-jsonpath.spec b/php-pecl-jsonpath.spec index a2dd47a..570819f 100644 --- a/php-pecl-jsonpath.spec +++ b/php-pecl-jsonpath.spec @@ -1,35 +1,31 @@ # remirepo spec file for php-pecl-jsonpath # -# Copyright (c) 2021-2022 Remi Collet -# License: CC-BY-SA +# Copyright (c) 2021-2023 Remi Collet +# License: CC-BY-SA-4.0 # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # -%if 0%{?scl:1} -%global sub_prefix %{scl_prefix} -%scl_package php-pecl-jsonpath -%endif -%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} -%global pecl_name jsonpath -%global with_tests %{?_without_tests:0}%{!?_without_tests:1} -%if "%{php_version}" < "5.6" -# after json -%global ini_name %{pecl_name}.ini -%else -# after 40-json.ini -%global ini_name 50-%{pecl_name}.ini -%endif -#global prever RC2 +%{?scl:%scl_package php-pecl-jsonpath} + +%bcond_without tests +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} +%global pecl_name jsonpath +%global ini_name 50-%{pecl_name}.ini +#global prever RC2 +%global sources %{pecl_name}-%{version}%{?prever} +%global _configure ../%{sources}/configure Summary: Extract data using JSONPath notation -Name: %{?sub_prefix}php-pecl-jsonpath +Name: %{?scl_prefix}php-pecl-jsonpath Version: 1.0.0 -Release: 1%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} -License: PHP +Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}} +License: PHP-3.01 URL: https://pecl.php.net/package/%{pecl_name} -Source0: https://pecl.php.net/get/%{pecl_name}-%{version}%{?prever}.tgz +Source0: https://pecl.php.net/get/%{sources}.tgz + +Patch0: https://patch-diff.githubusercontent.com/raw/supermetrics-public/pecl-jsonpath/pull/169.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -39,24 +35,12 @@ BuildRequires: %{?scl_prefix}php-pear Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} Requires: %{?scl_prefix}php-json%{?_isa} -%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}} Provides: %{?scl_prefix}php-%{pecl_name} = %{version} Provides: %{?scl_prefix}php-%{pecl_name}%{?_isa} = %{version} Provides: %{?scl_prefix}php-pecl(%{pecl_name}) = %{version} Provides: %{?scl_prefix}php-pecl(%{pecl_name})%{?_isa} = %{version} -%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -# Other third party repo stuff -Obsoletes: php74-pecl-%{pecl_name} <= %{version} -%if "%{php_version}" > "8.0" -Obsoletes: php80-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "8.1" -Obsoletes: php81-pecl-%{pecl_name} <= %{version} -%endif -%endif - %description This extension allows you to use the versatile JSONPath query language to @@ -67,14 +51,15 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -q -c -mv %{pecl_name}-%{version}%{?prever} NTS # Don't install/register tests sed -e 's/role="test"/role="src"/' \ %{?_licensedir:-e '/LICENSE/s/role="doc"/role="src"/' } \ -i package.xml -cd NTS +cd %{sources} +%patch -P0 -p1 -b.pr169 + # Sanity check, really often broken extver=$(sed -n '/#define PHP_JSONPATH_VERSION/{s/.* "//;s/".*$//;p}' php_jsonpath.h) if test "x${extver}" != "x%{version}%{?prever}"; then @@ -83,9 +68,9 @@ if test "x${extver}" != "x%{version}%{?prever}"; then fi cd .. +mkdir NTS %if %{with_zts} -# Duplicate source tree for NTS / ZTS build -cp -pr NTS ZTS +mkdir ZTS %endif # Create configuration file @@ -98,19 +83,20 @@ EOF %build %{?dtsenable} -cd NTS -%{_bindir}/phpize +cd %{sources} +%{__phpize} + +cd ../NTS %configure \ --enable-jsonpath \ - --with-php-config=%{_bindir}/php-config + --with-php-config=%{__phpconfig} make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize %configure \ --enable-jsonpath \ - --with-php-config=%{_bindir}/zts-php-config + --with-php-config=%{__ztsphpconfig} make %{?_smp_mflags} %endif @@ -134,7 +120,7 @@ install -D -m 644 %{ini_name} %{buildroot}%{php_ztsinidir}/%{ini_name} # Documentation for i in $(grep 'role="doc"' package.xml | sed -e 's/^.*name="//;s/".*$//') -do install -Dpm 644 NTS/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i +do install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done @@ -159,20 +145,20 @@ fi %check -cd NTS +cd %{sources} + : Minimal load test for NTS extension %{__php} -n \ --define extension=%{buildroot}%{php_extdir}/%{pecl_name}.so \ --modules | grep '^%{pecl_name}$' -%if %{with_tests} +%if %{with tests} : Upstream test suite for NTS extension -TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ +TEST_PHP_ARGS="-n -d extension=$PWD/../NTS/modules/%{pecl_name}.so" \ %{__php} -n run-tests.php -q --show-diff %{?_smp_mflags} %endif %if %{with_zts} -cd ../ZTS : Minimal load test for ZTS extension %{__ztsphp} -n \ --define extension=%{buildroot}%{php_ztsextdir}/%{pecl_name}.so \ @@ -182,7 +168,7 @@ cd ../ZTS %files %doc %{pecl_docdir}/%{pecl_name} -%{?_licensedir:%license NTS/LICENSE} +%{?_licensedir:%license %{sources}/LICENSE} %{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{ini_name} @@ -195,6 +181,11 @@ cd ../ZTS %changelog +* Fri Sep 1 2023 Remi Collet - 1.0.0-2 +- build out of sources tree +- add patch for 8.3 from + https://github.com/supermetrics-public/pecl-jsonpath/pull/169 + * Mon Mar 21 2022 Remi Collet - 1.0.0-1 - update to 1.0.0 -- cgit