summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <remi@remirepo.net>2022-09-23 16:00:18 +0200
committerRemi Collet <remi@php.net>2022-09-23 16:00:18 +0200
commit7c31ce6a8dd9db1183a4fc258eb4c8001a798ba3 (patch)
treebcd781a16629c9b243aaf29900e2a29dfb36c99b
Initial package
-rw-r--r--.gitignore9
-rw-r--r--Makefile4
-rw-r--r--composer.json44
l---------makesrc.sh1
-rwxr-xr-xphp-react-async-get-source.sh74
-rw-r--r--php-react-async.spec167
6 files changed, 299 insertions, 0 deletions
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..01f0400
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,9 @@
+clog
+package-*.xml
+*.tgz
+*.tar.bz2
+*.tar.gz
+*.tar.xz
+*.tar.xz.asc
+*.src.rpm
+*/*rpm
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..13af741
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,4 @@
+SRCDIR := $(shell pwd)
+NAME := $(shell basename $(SRCDIR))
+include ../../../common/Makefile
+
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..0be4bf5
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,44 @@
+{
+ "name": "react/async",
+ "description": "Async utilities for ReactPHP",
+ "keywords": ["async", "ReactPHP"],
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Christian Lück",
+ "homepage": "https://clue.engineering/",
+ "email": "christian@clue.engineering"
+ },
+ {
+ "name": "Cees-Jan Kiewiet",
+ "homepage": "https://wyrihaximus.net/",
+ "email": "reactphp@ceesjankiewiet.nl"
+ },
+ {
+ "name": "Jan Sorgalla",
+ "homepage": "https://sorgalla.com/",
+ "email": "jsorgalla@gmail.com"
+ },
+ {
+ "name": "Chris Boden",
+ "homepage": "https://cboden.dev/",
+ "email": "cboden@gmail.com"
+ }
+ ],
+ "require": {
+ "php": ">=7.1",
+ "react/event-loop": "^1.2",
+ "react/promise": "^3.0 || ^2.8 || ^1.2.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^9.3 || ^7.5"
+ },
+ "autoload": {
+ "files": [
+ "src/functions_include.php"
+ ]
+ },
+ "autoload-dev": {
+ "psr-4": { "React\\Tests\\Async\\": "tests/" }
+ }
+}
diff --git a/makesrc.sh b/makesrc.sh
new file mode 120000
index 0000000..35c4b62
--- /dev/null
+++ b/makesrc.sh
@@ -0,0 +1 @@
+php-react-async-get-source.sh \ No newline at end of file
diff --git a/php-react-async-get-source.sh b/php-react-async-get-source.sh
new file mode 100755
index 0000000..88bcd7a
--- /dev/null
+++ b/php-react-async-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 || exit 1
+ cp composer.json ${SPEC_DIR}/
+ 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-async.spec b/php-react-async.spec
new file mode 100644
index 0000000..fe99883
--- /dev/null
+++ b/php-react-async.spec
@@ -0,0 +1,167 @@
+# remirepo/Fedora spec file for php-react-async
+#
+# Copyright (c) 2022 Remi Collet
+#
+# License: MIT
+# http://opensource.org/licenses/MIT
+#
+# Please preserve changelog entries
+#
+
+%global github_owner reactphp
+%global github_name async
+%global github_version 3.0.0
+%global github_commit 3c3b812be77aec14bf8300b052ba589c9a5bc95b
+
+%global composer_vendor react
+%global composer_project async
+
+%global ns_vendor React
+%global ns_project Async
+
+# "php": ">=7.1"
+%global php_min_ver 7.1
+# "react/event-loop": "^1.2",
+%global react_event_loop_min_ver 1.2
+%global react_event_loop_max_ver 2
+# "react/promise": "^3.0 || ^2.8 || ^1.2.1"
+%global react_promise_min_ver 2.8
+%global react_promise_max_ver 4
+
+# Build using "--without tests" to disable tests
+%bcond_without tests
+
+# 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}
+Summary: Async utilities for ReactPHP
+
+License: MIT
+URL: https://reactphp.org/async/
+
+# GitHub export does not include tests
+# Run php-react-async-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: phpunit9 >= 9.3
+%if %{with_range_dependencies}
+BuildRequires: (php-composer(react/promise) >= %{react_promise_min_ver} with php-composer(react/promise) < %{react_promise_max_ver})
+BuildRequires: (php-composer(react/event-loop) >= %{react_event_loop_min_ver} with php-composer(react/event-loop) < %{react_event_loop_max_ver})
+%else
+BuildRequires: php-composer(react/promise) < %{react_promise_max_ver}
+BuildRequires: php-composer(react/promise) >= %{react_promise_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 3.0.0)
+BuildRequires: php-spl
+%endif
+## Autoloader
+BuildRequires: php-fedora-autoloader-devel
+
+# composer.json
+Requires: php(language) >= %{php_min_ver}
+%if %{with_range_dependencies}
+Requires: (php-composer(react/promise) >= %{react_promise_min_ver} with php-composer(react/promise) < %{react_promise_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
+Requires: php-composer(react/promise) < %{react_promise_max_ver}
+Requires: php-composer(react/promise) >= %{react_promise_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 3.0.0)
+Requires: php-spl
+# Autoloader
+Requires: php-composer(fedora/autoloader)
+
+# Composer
+Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version}
+
+
+%description
+Async utilities for ReactPHP.
+
+This library allows you to manage async control flow. It provides a number of
+combinators for Promise-based APIs. Instead of nesting or chaining promise
+callbacks, you can declare them as a list, which is resolved sequentially in
+an async manner. React/Async will not automagically change blocking code to
+be async. You need to have an actual event loop and non-blocking libraries
+interacting with that event loop for it to work. As long as you have a
+Promise-based API that runs in an event loop, it can be used with this library.
+
+Autoloader: %{phpdir}/%{ns_vendor}/%{ns_project}/autoload.php
+
+
+%prep
+%setup -qn %{github_name}-%{github_commit}
+
+
+%build
+: Create autoloader
+cat <<'AUTOLOAD' | tee src/autoload.php
+<?php
+require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
+
+\Fedora\Autoloader\Dependencies::required(array(
+ __DIR__ . '/functions_include.php',
+ '%{phpdir}/%{ns_vendor}/Promise/autoload.php',
+ '%{phpdir}/%{ns_vendor}/EventLoop/autoload.php',
+));
+AUTOLOAD
+
+
+%install
+mkdir -p %{buildroot}%{phpdir}/%{ns_vendor}
+cp -rp src %{buildroot}%{phpdir}/%{ns_vendor}/%{ns_project}
+
+
+%check
+%if %{with tests}
+: Create tests bootstrap
+cat <<'BOOTSTRAP' | tee bootstrap.php
+<?php
+require '%{buildroot}%{phpdir}/%{ns_vendor}/%{ns_project}/autoload.php';
+\Fedora\Autoloader\Autoload::addPsr4('%{ns_vendor}\\Tests\\%{ns_project}\\', __DIR__.'/tests');
+BOOTSTRAP
+
+: Upstream tests
+RETURN_CODE=0
+for PHP_EXEC in php php80 php81 php82; do
+ if which $PHP_EXEC; then
+ $PHP_EXEC %{_bindir}/phpunit9 --verbose --bootstrap bootstrap.php \
+ || RETURN_CODE=1
+ fi
+done
+exit $RETURN_CODE
+%else
+: Tests skipped
+%endif
+
+
+%files
+%{!?_licensedir:%global license %%doc}
+%license LICENSE
+%doc *.md
+%doc composer.json
+%{phpdir}/%{ns_vendor}/%{ns_project}
+
+
+%changelog
+* Fri Sep 23 2022 Remi Collet <remi@remirepo.net> - 3.0.0-1
+- Initial package