summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2021-04-07 16:09:09 +0200
committerRemi Collet <remi@remirepo.net>2021-04-07 16:09:09 +0200
commit7c2f6e605ea40c745d4033bc1d2423fe935f56bc (patch)
tree1c3c8bda19bcbad319f4f9a7a06972acca679c4b
parentd7847cc32f608b4f0d100f22b526940ba7dcc60e (diff)
fix FTBFS with PHP 8
l---------makesrc.sh1
-rwxr-xr-xphp-react-http-client-get-source.sh74
-rw-r--r--php-react-http-client-php8.patch12
-rw-r--r--php-react-http-client.spec14
4 files changed, 98 insertions, 3 deletions
diff --git a/makesrc.sh b/makesrc.sh
new file mode 120000
index 0000000..3dc77d8
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1 @@
+php-react-http-client-get-source.sh \ No newline at end of file
diff --git a/php-react-http-client-get-source.sh b/php-react-http-client-get-source.sh
new file mode 100755
index 0000000..3947de4
--- /dev/null
+++ b/php-react-http-client-get-source.sh
@@ -0,0 +1,74 @@
+#/bin/sh
+
+GIT=`which git`
+RPM=`which rpm`
+
+if [ -z "$GIT" ]
+then
+ echo "ERROR: 'git' command not found" 1>&2
+ exit 1
+elif [ -z "$RPM" ]
+then
+ echo "ERROR: 'rpm' command not found" 1>&2
+ exit 1
+fi
+
+function print {
+ echo -e "\e[0;33m>>>>> ${1}\e[0m"
+}
+
+if [ -x "$1" ]
+then
+ SPEC=$1
+else
+ SPEC=`ls *.spec | head -1`
+fi
+
+SPEC_DIR=`pwd`
+
+print "SPEC_DIR = $SPEC_DIR"
+
+NAME=`echo $SPEC | sed 's#\.spec##'`
+VERSION=`egrep '%global\s*github_version' $SPEC | awk '{print $3}'`
+
+print "SPEC = $SPEC"
+print "NAME = $NAME"
+
+GIT_OWNER=`egrep '%global\s*github_owner' $SPEC | awk '{print $3}'`
+GIT_NAME=`egrep '%global\s*github_name' $SPEC | awk '{print $3}'`
+GIT_COMMIT=`egrep '%global\s*github_commit' $SPEC | awk '{print $3}'`
+GIT_REPO=https://github.com/${GIT_OWNER}/${GIT_NAME}
+GIT_DIR=`echo $GIT_REPO | sed 's#.*/##'`
+
+print "GIT_OWNER = $GIT_OWNER"
+print "GIT_NAME = $GIT_NAME"
+print "GIT_COMMIT = $GIT_COMMIT"
+print "GIT_REPO = $GIT_REPO"
+print "GIT_DIR = $GIT_DIR"
+
+TEMP_DIR=$(mktemp --dir)
+
+pushd $TEMP_DIR
+ print "Cloning git repo..."
+ $GIT clone $GIT_REPO
+
+ pushd $GIT_DIR
+ print "Checking out commit..."
+ $GIT checkout $GIT_COMMIT
+ cp composer.json ${SPEC_DIR}/composer.json
+ popd
+
+ TAR_DIR=${GIT_NAME}-${GIT_COMMIT}
+ print "TAR_DIR = $TAR_DIR"
+
+ mv $GIT_DIR $TAR_DIR
+
+ TAR_FILE=${SPEC_DIR}/${NAME}-${VERSION}-${GIT_COMMIT}.tar.gz
+ print "TAR_FILE = $TAR_FILE"
+
+ [ -e $TAR_FILE ] && rm -f $TAR_FILE
+ tar --exclude-vcs -czf $TAR_FILE $TAR_DIR
+ chmod 0644 $TAR_FILE
+popd
+
+rm -rf $TEMP_DIR
diff --git a/php-react-http-client-php8.patch b/php-react-http-client-php8.patch
new file mode 100644
index 0000000..2a5ee7b
--- /dev/null
+++ b/php-react-http-client-php8.patch
@@ -0,0 +1,12 @@
+diff -up ./src/ChunkedStreamDecoder.php.php8 ./src/ChunkedStreamDecoder.php
+--- ./src/ChunkedStreamDecoder.php.php8 2021-04-07 16:01:26.474243377 +0200
++++ ./src/ChunkedStreamDecoder.php 2021-04-07 16:01:46.823149969 +0200
+@@ -111,7 +111,7 @@ class ChunkedStreamDecoder extends Event
+ }
+ }
+ $this->nextChunkIsLength = false;
+- if (dechex(@hexdec($lengthChunk)) !== strtolower($lengthChunk)) {
++ if (dechex((int)@hexdec($lengthChunk)) !== strtolower($lengthChunk)) {
+ $this->emit('error', array(
+ new Exception('Unable to validate "' . $lengthChunk . '" as chunk length header'),
+ ));
diff --git a/php-react-http-client.spec b/php-react-http-client.spec
index 66956eb..4522c81 100644
--- a/php-react-http-client.spec
+++ b/php-react-http-client.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-react-http-client
#
-# Copyright (c) 2017-2020 Shawn Iwinski <shawn@iwin.ski>
+# Copyright (c) 2017-2021 Shawn Iwinski <shawn@iwin.ski>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -59,7 +59,7 @@
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
-Release: 6%{?github_release}%{?dist}
+Release: 9%{?github_release}%{?dist}
Summary: Asynchronous HTTP client library
License: MIT
@@ -70,6 +70,10 @@ URL: https://reactphp.org/http-client/
Source0: %{name}-%{github_version}-%{github_commit}.tar.gz
Source1: %{name}-get-source.sh
+# minimal PHP 8 patch
+# not submitted upstream as dead project
+Patch0: %{name}-php8.patch
+
BuildArch: noarch
# Tests
%if %{with_tests}
@@ -149,6 +153,7 @@ Autoloader: %{phpdir}/React/HttpClient/autoload.php
%prep
%setup -qn %{github_name}-%{github_commit}
+%patch0 -p1
%build
@@ -200,7 +205,7 @@ rm -f tests/FunctionalIntegrationTest.php
: Upstream tests
RETURN_CODE=0
PHPUNIT=$(which phpunit7)
-for PHP_EXEC in "" php72 php73 php74 php80; do
+for PHP_EXEC in "" php73 php74 php80; do
if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
$PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php \
|| RETURN_CODE=1
@@ -221,6 +226,9 @@ exit $RETURN_CODE
%changelog
+* Wed Apr 7 2021 Remi Collet <remi@remirepo.net> - 0.5.10-9
+- fix FTBFS with PHP 8
+
* Sat Jun 06 2020 Shawn Iwinski <shawn@iwin.ski> - 0.5.10-1
- Update to 0.5.10 (RHBZ #1791054)
- Use PHPUnit 7