summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2020-09-22 15:45:17 +0200
committerRemi Collet <remi@remirepo.net>2020-09-22 15:45:17 +0200
commit949e6cdb917bf6e60fabe3cf662983e13c644a30 (patch)
tree3e428797d29eb7c5d267797bf2aaafbee4a1024e
parentb6ee1442bdf8d265a7fc1de79976bb79b90eaec4 (diff)
add patches for PHP 8 from upstream and from
https://github.com/kjdev/php-ext-lz4/pull/26
-rw-r--r--26.patch50
-rw-r--r--9f78918579daa110baa7aa70eaa969ba1c23725d.patch24
-rw-r--r--ef4f39b2149765cac1f9a7bc5a360e09e9e506e6.patch201
-rwxr-xr-xmakesrc.sh27
-rw-r--r--php-lz4.spec48
5 files changed, 320 insertions, 30 deletions
diff --git a/26.patch b/26.patch
new file mode 100644
index 0000000..e6a7553
--- /dev/null
+++ b/26.patch
@@ -0,0 +1,50 @@
+From ffa7fd32ebd7e64a69868cae3ae1059ef33790ab Mon Sep 17 00:00:00 2001
+From: Remi Collet <remi@remirepo.net>
+Date: Tue, 22 Sep 2020 15:38:38 +0200
+Subject: [PATCH] parameter => argument in 8.0.0beta4
+
+---
+ tests/002_b.phpt | 4 ++--
+ tests/005_b.phpt | 4 ++--
+ 2 files changed, 4 insertions(+), 4 deletions(-)
+
+diff --git a/tests/002_b.phpt b/tests/002_b.phpt
+index a56dac8..a2dc434 100644
+--- a/tests/002_b.phpt
++++ b/tests/002_b.phpt
+@@ -50,13 +50,13 @@ try {
+ *** Testing lz4_compress() : error conditions ***
+
+ -- Testing lz4_compress() function with Zero arguments --
+-ArgumentCountError: lz4_compress() expects at least 1 parameter, 0 given in %s:%d
++ArgumentCountError: lz4_compress() expects at least 1 argument, 0 given in %s:%d
+ Stack trace:
+ #0 %s(%d): lz4_compress()
+ #1 {main}
+
+ -- Testing lz4_compress() function with more than expected no. of arguments --
+-ArgumentCountError: lz4_compress() expects at most 3 parameters, 4 given in %s:%d
++ArgumentCountError: lz4_compress() expects at most 3 arguments, 4 given in %s:%d
+ Stack trace:
+ #0 %s(%d): lz4_compress(%s)
+ #1 {main}
+diff --git a/tests/005_b.phpt b/tests/005_b.phpt
+index afb5158..c212d24 100644
+--- a/tests/005_b.phpt
++++ b/tests/005_b.phpt
+@@ -57,13 +57,13 @@ try {
+ *** Testing lz4_uncompress() : error conditions ***
+
+ -- Testing lz4_uncompress() function with Zero arguments --
+-ArgumentCountError: lz4_uncompress() expects at least 1 parameter, 0 given in %s:%d
++ArgumentCountError: lz4_uncompress() expects at least 1 argument, 0 given in %s:%d
+ Stack trace:
+ #0 %s(%d): lz4_uncompress()
+ #1 {main}
+
+ -- Testing lz4_uncompress() function with more than expected no. of arguments --
+-ArgumentCountError: lz4_uncompress() expects at most 3 parameters, 4 given in %s:%d
++ArgumentCountError: lz4_uncompress() expects at most 3 arguments, 4 given in %s:%d
+ Stack trace:
+ #0 %s(%d): lz4_uncompress(%s)
+ #1 {main}
diff --git a/9f78918579daa110baa7aa70eaa969ba1c23725d.patch b/9f78918579daa110baa7aa70eaa969ba1c23725d.patch
new file mode 100644
index 0000000..168b6ad
--- /dev/null
+++ b/9f78918579daa110baa7aa70eaa969ba1c23725d.patch
@@ -0,0 +1,24 @@
+From 9f78918579daa110baa7aa70eaa969ba1c23725d Mon Sep 17 00:00:00 2001
+From: kj <kjclev@gmail.com>
+Date: Tue, 27 Aug 2019 08:32:40 +0900
+Subject: [PATCH] Fixed for parameter arguments in nightly
+
+---
+ php_lz4.h | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+diff --git a/php_lz4.h b/php_lz4.h
+index 000582b..8786614 100644
+--- a/php_lz4.h
++++ b/php_lz4.h
+@@ -47,4 +47,10 @@ extern zend_module_entry lz4_module_entry;
+ #define LZ4_G(v) (lz4_globals.v)
+ #endif
+
++#if ZEND_MODULE_API_NO >= 20190128
++#ifndef TSRMLS_CC
++#define TSRMLS_CC
++#endif
++#endif
++
+ #endif /* PHP_LZ4_H */
diff --git a/ef4f39b2149765cac1f9a7bc5a360e09e9e506e6.patch b/ef4f39b2149765cac1f9a7bc5a360e09e9e506e6.patch
new file mode 100644
index 0000000..cba330d
--- /dev/null
+++ b/ef4f39b2149765cac1f9a7bc5a360e09e9e506e6.patch
@@ -0,0 +1,201 @@
+From ef4f39b2149765cac1f9a7bc5a360e09e9e506e6 Mon Sep 17 00:00:00 2001
+From: kj <kjclev@gmail.com>
+Date: Tue, 27 Aug 2019 08:49:35 +0900
+Subject: [PATCH] Fixed for tests in nightly
+
+---
+ tests/002.phpt | 4 ++-
+ tests/002_b.phpt | 68 +++++++++++++++++++++++++++++++++++++++++
+ tests/005.phpt | 2 ++
+ tests/005_b.phpt | 78 ++++++++++++++++++++++++++++++++++++++++++++++++
+ 4 files changed, 151 insertions(+), 1 deletion(-)
+ create mode 100644 tests/002_b.phpt
+ create mode 100644 tests/005_b.phpt
+
+diff --git a/tests/002.phpt b/tests/002.phpt
+index 5e1f519..adf8509 100644
+--- a/tests/002.phpt
++++ b/tests/002.phpt
+@@ -1,8 +1,10 @@
+ --TEST--
+ Test lz4_compress() function : error conditions
+ --SKIPIF--
++<?php
++if (version_compare(PHP_VERSION, '8.0', '>=')) die('skip PHP is too old');
+ --FILE--
+-<?php
++<?php
+ if (!extension_loaded('lz4')) {
+ dl('lz4.' . PHP_SHLIB_SUFFIX);
+ }
+diff --git a/tests/002_b.phpt b/tests/002_b.phpt
+new file mode 100644
+index 0000000..a56dac8
+--- /dev/null
++++ b/tests/002_b.phpt
+@@ -0,0 +1,68 @@
++--TEST--
++Test lz4_compress() function : error conditions
++--SKIPIF--
++<?php
++if (version_compare(PHP_VERSION, '8.0', '<')) die('skip PHP is too new');
++--FILE--
++<?php
++if (!extension_loaded('lz4')) {
++ dl('lz4.' . PHP_SHLIB_SUFFIX);
++}
++
++include(dirname(__FILE__) . '/data.inc');
++
++echo "*** Testing lz4_compress() : error conditions ***\n";
++
++// Zero arguments
++echo "\n-- Testing lz4_compress() function with Zero arguments --\n";
++try {
++ var_dump(lz4_compress());
++} catch (Error $e) {
++ echo $e, PHP_EOL;
++}
++
++//Test lz4_compress with one more than the expected number of arguments
++echo "\n-- Testing lz4_compress() function with more than expected no. of arguments --\n";
++$data = 'string_val';
++$extra_arg = 10;
++try {
++ var_dump(lz4_compress($data, 6, false, $extra_arg));
++} catch (Error $e) {
++ echo $e, PHP_EOL;
++}
++
++class Tester {
++ function Hello() {
++ echo "Hello\n";
++ }
++}
++
++echo "\n-- Testing with incorrect parameters --\n";
++$testclass = new Tester();
++try {
++ var_dump(lz4_compress($testclass));
++} catch (Error $e) {
++ echo $e, PHP_EOL;
++}
++?>
++===Done===
++--EXPECTF--
++*** Testing lz4_compress() : error conditions ***
++
++-- Testing lz4_compress() function with Zero arguments --
++ArgumentCountError: lz4_compress() expects at least 1 parameter, 0 given in %s:%d
++Stack trace:
++#0 %s(%d): lz4_compress()
++#1 {main}
++
++-- Testing lz4_compress() function with more than expected no. of arguments --
++ArgumentCountError: lz4_compress() expects at most 3 parameters, 4 given in %s:%d
++Stack trace:
++#0 %s(%d): lz4_compress(%s)
++#1 {main}
++
++-- Testing with incorrect parameters --
++
++Warning: lz4_compress : expects parameter to be string. in %s on line %d
++bool(false)
++===Done===
+diff --git a/tests/005.phpt b/tests/005.phpt
+index 19add34..6133d83 100644
+--- a/tests/005.phpt
++++ b/tests/005.phpt
+@@ -1,6 +1,8 @@
+ --TEST--
+ Test lz4_uncompress() function : error conditions
+ --SKIPIF--
++<?php
++if (version_compare(PHP_VERSION, '8.0', '>=')) die('skip PHP is too old');
+ --FILE--
+ <?php
+ if (!extension_loaded('lz4')) {
+diff --git a/tests/005_b.phpt b/tests/005_b.phpt
+new file mode 100644
+index 0000000..afb5158
+--- /dev/null
++++ b/tests/005_b.phpt
+@@ -0,0 +1,78 @@
++--TEST--
++Test lz4_uncompress() function : error conditions
++--SKIPIF--
++<?php
++if (version_compare(PHP_VERSION, '8.0', '<')) die('skip PHP is too new');
++--FILE--
++<?php
++if (!extension_loaded('lz4')) {
++ dl('lz4.' . PHP_SHLIB_SUFFIX);
++}
++
++echo "*** Testing lz4_uncompress() : error conditions ***\n";
++
++// Zero arguments
++echo "\n-- Testing lz4_uncompress() function with Zero arguments --\n";
++try {
++ var_dump( lz4_uncompress() );
++} catch (Error $e) {
++ echo $e, PHP_EOL;
++}
++
++//Test lz4_uncompress with one more than the expected number of arguments
++echo "\n-- Testing lz4_uncompress() function with more than expected no. of arguments --\n";
++$data = 'string_val';
++$extra_arg = 10;
++try {
++ var_dump( lz4_uncompress($data, -1, -1, $extra_arg) );
++} catch (Error $e) {
++ echo $e, PHP_EOL;
++}
++
++
++echo "\n-- Testing with incorrect arguments --\n";
++try {
++ var_dump(lz4_uncompress(123));
++} catch (Error $e) {
++ echo $e, PHP_EOL;
++}
++
++class Tester
++{
++ function Hello()
++ {
++ echo "Hello\n";
++ }
++}
++
++$testclass = new Tester();
++try {
++ var_dump(lz4_uncompress($testclass));
++} catch (Error $e) {
++ echo $e, PHP_EOL;
++}
++?>
++===DONE===
++--EXPECTF--
++*** Testing lz4_uncompress() : error conditions ***
++
++-- Testing lz4_uncompress() function with Zero arguments --
++ArgumentCountError: lz4_uncompress() expects at least 1 parameter, 0 given in %s:%d
++Stack trace:
++#0 %s(%d): lz4_uncompress()
++#1 {main}
++
++-- Testing lz4_uncompress() function with more than expected no. of arguments --
++ArgumentCountError: lz4_uncompress() expects at most 3 parameters, 4 given in %s:%d
++Stack trace:
++#0 %s(%d): lz4_uncompress(%s)
++#1 {main}
++
++-- Testing with incorrect arguments --
++
++Warning: lz4_uncompress : expects parameter to be string. in %s on line %d
++bool(false)
++
++Warning: lz4_uncompress : expects parameter to be string. in %s on line %d
++bool(false)
++===DONE===
diff --git a/makesrc.sh b/makesrc.sh
new file mode 100755
index 0000000..ea1e7e8
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+NAME=$(basename $PWD)
+OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec)
+PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec)
+VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec)
+COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec)
+SHORT=${COMMIT:0:7}
+
+echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n"
+
+echo "Cloning..."
+rm -rf $PROJECT-$COMMIT
+git clone --recursive https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT
+
+echo "Getting commit..."
+pushd $PROJECT-$COMMIT
+git checkout $COMMIT
+popd
+
+echo "Archiving..."
+tar czf $NAME-$VERSION-$SHORT.tgz --exclude .git $PROJECT-$COMMIT
+
+echo "Cleaning..."
+rm -rf $PROJECT-$COMMIT
+
+echo "Done."
diff --git a/php-lz4.spec b/php-lz4.spec
index 8ea54c7..4d89cad 100644
--- a/php-lz4.spec
+++ b/php-lz4.spec
@@ -1,6 +1,6 @@
# remirepo spec file for php-lz4
#
-# Copyright (c) 2016-2018 Remi Collet
+# Copyright (c) 2016-2020 Remi Collet
# License: CC-BY-SA
# http://creativecommons.org/licenses/by-sa/4.0/
#
@@ -34,7 +34,7 @@ Version: 0.3.6
%if 0%{?gh_date:1}
Release: 2%{gh_date}git%{gh_short}%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
%else
-Release: 2%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
+Release: 3%{?dist}%{!?scl:%{!?nophptag:%(%{__php} -r 'echo ".".PHP_MAJOR_VERSION.".".PHP_MINOR_VERSION;')}}
%endif
License: MIT
Group: Development/Languages
@@ -43,6 +43,10 @@ Source0: %{pkg_name}-%{version}-%{gh_short}.tgz
# retrieve a recursive git snapshot with submodule
Source1: makesrc.sh
+Patch0: https://github.com/kjdev/php-ext-lz4/commit/9f78918579daa110baa7aa70eaa969ba1c23725d.patch
+Patch1: https://github.com/kjdev/php-ext-lz4/commit/ef4f39b2149765cac1f9a7bc5a360e09e9e506e6.patch
+Patch2: https://patch-diff.githubusercontent.com/raw/kjdev/php-ext-lz4/pull/26.patch
+
BuildRequires: %{?dtsprefix}gcc
BuildRequires: %{?scl_prefix}php-devel
%if %{?with_liblz4}
@@ -55,39 +59,15 @@ Requires: %{?scl_prefix}php(zend-abi) = %{php_zend_api}
Requires: %{?scl_prefix}php(api) = %{php_core_api}
%{?_sclreq:Requires: %{?scl_prefix}runtime%{?_sclreq}%{?_isa}}
-%if "%{?vendor}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
-# Other third party repo stuff
-Obsoletes: php53-%{pecl_name} <= %{version}
-Obsoletes: php53u-%{pecl_name} <= %{version}
-Obsoletes: php54-%{pecl_name} <= %{version}
-Obsoletes: php54w-%{pecl_name} <= %{version}
-%if "%{php_version}" > "5.5"
-Obsoletes: php55u-%{pecl_name} <= %{version}
-Obsoletes: php55w-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "5.6"
-Obsoletes: php56u-%{pecl_name} <= %{version}
-Obsoletes: php56w-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.0"
-Obsoletes: php70u-%{pecl_name} <= %{version}
-Obsoletes: php70w-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.1"
-Obsoletes: php71u-%{pecl_name} <= %{version}
-Obsoletes: php71w-%{pecl_name} <= %{version}
-%endif
-%if "%{php_version}" > "7.2"
-Obsoletes: php72u-%{pecl_name} <= %{version}
-Obsoletes: php72w-%{pecl_name} <= %{version}
-%endif
+%if "%{?packager}" == "Remi Collet" && 0%{!?scl:1} && 0%{?rhel}
%if "%{php_version}" > "7.3"
Obsoletes: php73-%{pecl_name} <= %{version}
-Obsoletes: php73w-%{pecl_name} <= %{version}
%endif
%if "%{php_version}" > "7.4"
Obsoletes: php74-%{pecl_name} <= %{version}
-Obsoletes: php74w-%{pecl_name} <= %{version}
+%endif
+%if "%{php_version}" > "8.0"
+Obsoletes: php80-%{pecl_name} <= %{version}
%endif
%endif
@@ -109,6 +89,10 @@ Package built for PHP %(%{__php} -r 'echo PHP_MAJOR_VERSION.".".PHP_MINOR_VERSIO
mv %{gh_project}-%{gh_commit} NTS
cd NTS
+%patch0 -p1 -b .up0
+%patch1 -p1 -b .up1
+%patch2 -p1 -b .pr26
+
%if %{?with_liblz4}
# Use the system library
rm -r lz4
@@ -223,6 +207,10 @@ REPORT_EXIT_STATUS=1 \
%changelog
+* Tue Sep 22 2019 Remi Collet <remi@remirepo.net> - 0.3.6-3
+- add patches for PHP 8 from upstream and from
+ https://github.com/kjdev/php-ext-lz4/pull/26
+
* Tue Sep 03 2019 Remi Collet <remi@remirepo.net> - 0.3.6-2
- rebuild for 7.4.0RC1