From e349d92d34ae21199778801afbee394c200a680e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 4 Sep 2023 12:02:36 +0200 Subject: add patch for PHP 8.3 from ammended https://github.com/cataphract/php-rar/pull/18 build out of sources tree --- REFLECTION | 125 +++++++++++++++++++++++++++++++++++++----------------- php-pecl-rar.spec | 112 ++++++++++++++++++++++-------------------------- 2 files changed, 136 insertions(+), 101 deletions(-) diff --git a/REFLECTION b/REFLECTION index ba9be69..c8cc94d 100644 --- a/REFLECTION +++ b/REFLECTION @@ -1,4 +1,4 @@ -Extension [ extension #117 rar version 4.2.0 ] { +Extension [ extension #125 rar version 4.2.0 ] { - Constants [6] { Constant [ int RAR_HOST_MSDOS ] { 0 } @@ -14,8 +14,8 @@ Extension [ extension #117 rar version 4.2.0 ] { - Parameters [3] { Parameter #0 [ $filename ] - Parameter #1 [ $password ] - Parameter #2 [ $volume_callback ] + Parameter #1 [ $password = ] + Parameter #2 [ $volume_callback = ] } } Function [ function rar_list ] { @@ -70,7 +70,7 @@ Extension [ extension #117 rar version 4.2.0 ] { } - Classes [3] { - Class [ final class RarArchive implements Traversable ] { + Class [ final class RarArchive implements Stringable, IteratorAggregate, Traversable ] { - Constants [0] { } @@ -83,8 +83,8 @@ Extension [ extension #117 rar version 4.2.0 ] { - Parameters [3] { Parameter #0 [ $filename ] - Parameter #1 [ $password ] - Parameter #2 [ $volume_callback ] + Parameter #1 [ $password = ] + Parameter #2 [ $volume_callback = ] } } } @@ -92,7 +92,7 @@ Extension [ extension #117 rar version 4.2.0 ] { - Properties [0] { } - - Methods [9] { + - Methods [10] { Method [ public method getEntries ] { - Parameters [0] { @@ -137,10 +137,11 @@ Extension [ extension #117 rar version 4.2.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ private method __construct ] { @@ -148,10 +149,17 @@ Extension [ extension #117 rar version 4.2.0 ] { - Parameters [0] { } } + + Method [ public method getIterator ] { + + - Parameters [0] { + } + - Return [ Traversable ] + } } } - Class [ final class RarEntry ] { + Class [ final class RarEntry implements Stringable ] { - Constants [46] { Constant [ public int HOST_MSDOS ] { 0 } @@ -209,32 +217,33 @@ Extension [ extension #117 rar version 4.2.0 ] { } - Properties [15] { - Property [ private $rarfile ] - Property [ private $position ] - Property [ private $name ] - Property [ private $unpacked_size ] - Property [ private $packed_size ] - Property [ private $host_os ] - Property [ private $file_time ] - Property [ private $crc ] - Property [ private $attr ] - Property [ private $version ] - Property [ private $method ] - Property [ private $flags ] - Property [ private $redir_type ] - Property [ private $redir_to_directory ] - Property [ private $redir_target ] + Property [ private $rarfile = NULL ] + Property [ private $position = NULL ] + Property [ private $name = NULL ] + Property [ private $unpacked_size = NULL ] + Property [ private $packed_size = NULL ] + Property [ private $host_os = NULL ] + Property [ private $file_time = NULL ] + Property [ private $crc = NULL ] + Property [ private $attr = NULL ] + Property [ private $version = NULL ] + Property [ private $method = NULL ] + Property [ private $flags = NULL ] + Property [ private $redir_type = NULL ] + Property [ private $redir_to_directory = NULL ] + Property [ private $redir_target = NULL ] } - Methods [19] { Method [ public method extract ] { - Parameters [4] { - Parameter #0 [ $path ] - Parameter #1 [ $filename ] - Parameter #2 [ $password ] - Parameter #3 [ $extended_data ] + Parameter #0 [ ?string $dir ] + Parameter #1 [ ?string $filepath = '' ] + Parameter #2 [ ?string $password = null ] + Parameter #3 [ bool $extended_data = false ] } + - Return [ bool ] } Method [ public method getPosition ] { @@ -300,7 +309,7 @@ Extension [ extension #117 rar version 4.2.0 ] { Method [ public method getStream ] { - Parameters [1] { - Parameter #0 [ $password ] + Parameter #0 [ $password = ] } } @@ -334,10 +343,11 @@ Extension [ extension #117 rar version 4.2.0 ] { } } - Method [ public method __toString ] { + Method [ public method __toString ] { - Parameters [0] { } + - Return [ string ] } Method [ private method __construct ] { @@ -348,13 +358,13 @@ Extension [ extension #117 rar version 4.2.0 ] { } } - Class [ final class RarException extends Exception implements Throwable ] { + Class [ final class RarException extends Exception implements Throwable, Stringable ] { - Constants [0] { } - Static properties [1] { - Property [ public static $usingExceptions ] + Property [ public static $usingExceptions = false ] } - Static methods [2] { @@ -373,47 +383,82 @@ Extension [ extension #117 rar version 4.2.0 ] { } - Properties [4] { - Property [ protected $message ] - Property [ protected $code ] - Property [ protected $file ] - Property [ protected $line ] + Property [ protected $message = '' ] + Property [ protected $code = 0 ] + Property [ protected string $file = '' ] + Property [ protected int $line = 0 ] } - Methods [10] { Method [ public method __construct ] { - Parameters [3] { - Parameter #0 [ $message ] - Parameter #1 [ $code ] - Parameter #2 [ $previous ] + Parameter #0 [ string $message = "" ] + Parameter #1 [ int $code = 0 ] + Parameter #2 [ ?Throwable $previous = null ] } } Method [ public method __wakeup ] { + + - Parameters [0] { + } + - Tentative return [ void ] } Method [ final public method getMessage ] { + + - Parameters [0] { + } + - Return [ string ] } Method [ final public method getCode ] { + + - Parameters [0] { + } } Method [ final public method getFile ] { + + - Parameters [0] { + } + - Return [ string ] } Method [ final public method getLine ] { + + - Parameters [0] { + } + - Return [ int ] } Method [ final public method getTrace ] { + + - Parameters [0] { + } + - Return [ array ] } Method [ final public method getPrevious ] { + + - Parameters [0] { + } + - Return [ ?Throwable ] } Method [ final public method getTraceAsString ] { + + - Parameters [0] { + } + - Return [ string ] } - Method [ public method __toString ] { + Method [ public method __toString ] { + + - Parameters [0] { + } + - Return [ string ] } } } diff --git a/php-pecl-rar.spec b/php-pecl-rar.spec index 669d5c7..ea22e2c 100644 --- a/php-pecl-rar.spec +++ b/php-pecl-rar.spec @@ -1,31 +1,37 @@ # spec file for php-pecl-rar # -# Copyright (c) 2013-2021 Remi Collet +# Copyright (c) 2013-2022 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # -%{?scl: %scl_package php-pecl-rar} +%{?scl:%scl_package php-pecl-rar} -%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} -%global pecl_name rar +%bcond_without tests + +%global with_zts 0%{!?_without_zts:%{?__ztsphp:1}} +%global pecl_name rar %if "%{php_version}" < "5.6" -%global ini_name %{pecl_name}.ini +%global ini_name %{pecl_name}.ini %else -%global ini_name 40-%{pecl_name}.ini +%global ini_name 40-%{pecl_name}.ini %endif +%global sources %{pecl_name}-%{version} +%global _configure ../%{sources}/configure Summary: PHP extension for reading RAR archives Name: %{?scl_prefix}php-pecl-%{pecl_name} Version: 4.2.0 -Release: 2%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} -License: PHP and Freeware with further limitations +Release: 4%{?dist}%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')} +License: PHP-3.01 and Freeware with further limitations Group: Development/Languages URL: https://pecl.php.net/package/%{pecl_name} -Source0: https://pecl.php.net/get/%{pecl_name}-%{version}.tgz +Source0: https://pecl.php.net/get/%{sources}.tgz Patch0: %{pecl_name}-php81.patch +Patch1: %{pecl_name}-php82.patch +Patch2: %{pecl_name}-php83.patch BuildRequires: make BuildRequires: %{?dtsprefix}gcc @@ -34,32 +40,11 @@ BuildRequires: %{?scl_prefix}php-pear Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api} Requires: %{?scl_prefix}php(api) = %{php_core_api} -%{?_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 "%{?scl_prefix}" != "%{?sub_prefix}" -Provides: %{?scl_prefix}php-pecl-%{pecl_name} = %{version}-%{release} -Provides: %{?scl_prefix}php-pecl-%{pecl_name}%{?_isa} = %{version}-%{release} -%endif - -%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel} -# Other third party repo stuff -%if "%{php_version}" > "7.3" -Obsoletes: php73-pecl-%{pecl_name} <= %{version} -%endif -%if "%{php_version}" > "7.4" -Obsoletes: php74-pecl-%{pecl_name} <= %{version} -%endif -%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 @@ -72,15 +57,16 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO %prep %setup -q -c -mv %{pecl_name}-%{version} 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 -%patch0 -p1 +cd %{sources} +%patch -P0 -p1 +%patch -P1 -p1 +%patch -P2 -p1 # Sanity check, really often broken extver=$(sed -n '/#define PHP_RAR_VERSION/{s/.* "//;s/".*$//;p}' php_rar.h) @@ -90,9 +76,9 @@ if test "x${extver}" != "x%{version}%{?prever:-%{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 @@ -105,20 +91,21 @@ EOF %build %{?dtsenable} -cd NTS -%{_bindir}/phpize +cd %{sources} +%{__phpize} + +cd ../NTS %configure \ --with-libdir=%{_lib} \ - --with-php-config=%{_bindir}/php-config + --with-php-config=%{__phpconfig} make %{?_smp_mflags} %if %{with_zts} cd ../ZTS -%{_bindir}/zts-phpize %configure \ --with-libdir=%{_lib} \ - --with-php-config=%{_bindir}/zts-php-config + --with-php-config=%{__ztsphpconfig} make %{?_smp_mflags} %endif @@ -144,7 +131,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 + install -Dpm 644 %{sources}/$i %{buildroot}%{pecl_docdir}/%{pecl_name}/$i done @@ -169,39 +156,33 @@ fi %check +cd %{sources} + : Minimal load test for NTS extension -cd NTS -%{_bindir}/php --no-php-ini \ - --define extension=modules/%{pecl_name}.so \ - --modules | grep %{pecl_name} +%{__php} --no-php-ini \ + --define extension=../NTS/modules/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' +%if %{with tests} : Upstream test suite for NTS extension -TEST_PHP_EXECUTABLE=%{_bindir}/php \ -TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ -NO_INTERACTION=1 \ +TEST_PHP_EXECUTABLE=%{__php} \ +TEST_PHP_ARGS="-n -d extension=$PWD/../NTS/modules/%{pecl_name}.so" \ REPORT_EXIT_STATUS=1 \ -%{_bindir}/php -n run-tests8.php --show-diff +%{__php} -n run-tests8.php -q --show-diff +%endif %if %{with_zts} : Minimal load test for ZTS extension -cd ../ZTS %{__ztsphp} --no-php-ini \ - --define extension=modules/%{pecl_name}.so \ - --modules | grep %{pecl_name} - -: Upstream test suite for ZTS extension -TEST_PHP_EXECUTABLE=%{__ztsphp} \ -TEST_PHP_ARGS="-n -d extension=$PWD/modules/%{pecl_name}.so" \ -NO_INTERACTION=1 \ -REPORT_EXIT_STATUS=1 \ -%{__ztsphp} -n run-tests8.php --show-diff + --define extension=../ZTS/modules/%{pecl_name}.so \ + --modules | grep '^%{pecl_name}$' %endif %files -%{?_licensedir:%license NTS/LICENSE} -%{?_licensedir:%license NTS/unrar/LICENSE.txt} +%{?_licensedir:%license %{sources}/LICENSE} +%{?_licensedir:%license %{sources}/unrar/LICENSE.txt} %doc %{pecl_docdir}/%{pecl_name} %{pecl_xmldir}/%{name}.xml %config(noreplace) %{php_inidir}/%{ini_name} @@ -214,6 +195,15 @@ REPORT_EXIT_STATUS=1 \ %changelog +* Mon Sep 4 2023 Remi Collet - 4.2.0-4 +- add patch for PHP 8.3 from ammended + https://github.com/cataphract/php-rar/pull/18 +- build out of sources tree + +* Thu Sep 15 2022 Remi Collet - 4.2.0-3 +- add patch for PHP 8.2 from + https://github.com/cataphract/php-rar/pull/18 + * Fri Sep 10 2021 Remi Collet - 4.2.0-2 - add upstream patch for PHP 8.1 -- cgit