From 0dab4a961881056290ff61af9603344437784293 Mon Sep 17 00:00:00 2001
From: Remi Collet <remi@remirepo.net>
Date: Mon, 8 Jun 2020 14:05:16 +0200
Subject: v1.1.1 from Fedora

---
 composer.json                  |  2 +-
 makesrc.sh                     |  1 +
 php-react-stream-get-source.sh | 73 ++++++++++++++++++++++++++++++++++++++++++
 php-react-stream.spec          | 39 +++++++++++++++-------
 4 files changed, 102 insertions(+), 13 deletions(-)
 create mode 120000 makesrc.sh
 create mode 100755 php-react-stream-get-source.sh

diff --git a/composer.json b/composer.json
index f6faa66..4bf0c4f 100644
--- a/composer.json
+++ b/composer.json
@@ -9,7 +9,7 @@
         "evenement/evenement": "^3.0 || ^2.0 || ^1.0"
     },
     "require-dev": {
-        "phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35",
+        "phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35",
         "clue/stream-filter": "~1.2"
     },
     "autoload": {
diff --git a/makesrc.sh b/makesrc.sh
new file mode 120000
index 0000000..6a0ed83
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1 @@
+php-react-stream-get-source.sh
\ No newline at end of file
diff --git a/php-react-stream-get-source.sh b/php-react-stream-get-source.sh
new file mode 100755
index 0000000..b2ac62b
--- /dev/null
+++ b/php-react-stream-get-source.sh
@@ -0,0 +1,73 @@
+#/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
+    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-stream.spec b/php-react-stream.spec
index 60128a2..ed89440 100644
--- a/php-react-stream.spec
+++ b/php-react-stream.spec
@@ -2,7 +2,7 @@
 #
 # Fedora spec file for php-react-stream
 #
-# Copyright (c) 2017-2019 Shawn Iwinski <shawn@iwin.ski>
+# Copyright (c) 2017-2020 Shawn Iwinski <shawn@iwin.ski>
 #
 # License: MIT
 # http://opensource.org/licenses/MIT
@@ -12,8 +12,8 @@
 
 %global github_owner     reactphp
 %global github_name      stream
-%global github_version   1.1.0
-%global github_commit    50426855f7a77ddf43b9266c22320df5bf6c6ce6
+%global github_version   1.1.1
+%global github_commit    7c02b510ee3f582c810aeccd3a197b9c2f52ff1a
 
 %global composer_vendor  react
 %global composer_project stream
@@ -33,24 +33,35 @@
 # Build using "--without tests" to disable tests
 %global with_tests 0%{!?_without_tests:1}
 
+# Range dependencies supported?
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+%global with_range_dependencies 1
+%else
+%global with_range_dependencies 0
+%endif
+
 %{!?phpdir:  %global phpdir  %{_datadir}/php}
 
 Name:          php-%{composer_vendor}-%{composer_project}
 Version:       %{github_version}
-Release:       1%{?github_release}%{?dist}
+Release:       2%{?github_release}%{?dist}
 Summary:       Basic readable and writable stream interfaces that support piping
 
 License:       MIT
 URL:           https://reactphp.org/stream/
-Source0:       https://github.com/%{github_owner}/%{github_name}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
+
+# GitHub export does not include tests
+# Run php-react-stream-get-source.sh to create full source
+Source0:       %{name}-%{github_version}-%{github_commit}.tar.gz
+Source1:       %{name}-get-source.sh
 
 BuildArch:     noarch
 # Tests
 %if %{with_tests}
 ## composer.json
 BuildRequires: php(language) >= %{php_min_ver}
-BuildRequires: phpunit6
-%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+BuildRequires: phpunit7
+%if %{with_range_dependencies}
 BuildRequires: (php-composer(clue/stream-filter) >= %{clue_stream_filter_min_ver} with php-composer(clue/stream-filter) < %{clue_stream_filter_max_ver})
 BuildRequires: (php-composer(evenement/evenement) >= %{evenement_min_ver} with php-composer(evenement/evenement) < %{evenement_max_ver})
 BuildRequires: (php-composer(react/event-loop) >= %{react_event_loop_min_ver} with php-composer(react/event-loop) < %{react_event_loop_max_ver})
@@ -62,7 +73,7 @@ BuildRequires: php-composer(evenement/evenement) >= %{evenement_min_ver}
 BuildRequires: php-composer(react/event-loop) <  %{react_event_loop_max_ver}
 BuildRequires: php-composer(react/event-loop) >= %{react_event_loop_min_ver}
 %endif
-# phpcompatinfo (computed from version 1.1.0)
+# phpcompatinfo (computed from version 1.1.1)
 BuildRequires: php-spl
 ## Autoloader
 BuildRequires: php-composer(fedora/autoloader)
@@ -70,7 +81,7 @@ BuildRequires: php-composer(fedora/autoloader)
 
 # composer.json
 Requires:      php(language) >= %{php_min_ver}
-%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+%if %{with_range_dependencies}
 Requires:      (php-composer(evenement/evenement) >= %{evenement_min_ver} with php-composer(evenement/evenement) < %{evenement_max_ver})
 Requires:      (php-composer(react/event-loop) >= %{react_event_loop_min_ver} with php-composer(react/event-loop) < %{react_event_loop_max_ver})
 %else
@@ -79,7 +90,7 @@ Requires:      php-composer(evenement/evenement) >= %{evenement_min_ver}
 Requires:      php-composer(react/event-loop) <  %{react_event_loop_max_ver}
 Requires:      php-composer(react/event-loop) >= %{react_event_loop_min_ver}
 %endif
-# phpcompatinfo (computed from version 1.1.0)
+# phpcompatinfo (computed from version 1.1.1)
 Requires:      php-spl
 # Autoloader
 Requires:      php-composer(fedora/autoloader)
@@ -150,8 +161,8 @@ rm -f tests/FunctionalInternetTest.php
 
 : Upstream tests
 RETURN_CODE=0
-PHPUNIT=$(which phpunit6)
-for PHP_EXEC in "" php71 php72 php73 php74; do
+PHPUNIT=$(which phpunit7)
+for PHP_EXEC in "" php72 php73 php74 php80; do
     if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
         $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php \
             || RETURN_CODE=1
@@ -172,6 +183,10 @@ exit $RETURN_CODE
 
 
 %changelog
+* Sat Jun 06 2020 Shawn Iwinski <shawn@iwin.ski> - 1.1.1-1
+- Update to 1.1.1 (RHBZ #1830919)
+- Use PHPUnit 7
+
 * Sat Dec 14 2019 Shawn Iwinski <shawn@iwin.ski> - 1.1.0-1
 - Update to 1.1.0 (RHBZ #1600309)
 - Use PHPUnit 6
-- 
cgit