From c35754b2b68107ee5d11feba1f2493c2f28f7f3e Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 4 Nov 2020 14:28:32 +0100 Subject: update to 1.1.0 switch to phpunit9 --- composer.json | 26 +++++++++++++-- makesrc.sh | 1 + php-react-cache-get-source.sh | 74 +++++++++++++++++++++++++++++++++++++++++++ php-react-cache.spec | 51 ++++++++++++++++++----------- 4 files changed, 132 insertions(+), 20 deletions(-) create mode 120000 makesrc.sh create mode 100755 php-react-cache-get-source.sh diff --git a/composer.json b/composer.json index 51573b6..ad0d9fe 100644 --- a/composer.json +++ b/composer.json @@ -3,9 +3,31 @@ "description": "Async, Promise-based cache interface for ReactPHP", "keywords": ["cache", "caching", "promise", "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": ">=5.3.0", - "react/promise": "~2.0|~1.1" + "react/promise": "^3.0 || ^2.0 || ^1.1" }, "autoload": { "psr-4": { "React\\Cache\\": "src/" } @@ -14,6 +36,6 @@ "psr-4": { "React\\Tests\\Cache\\": "tests/" } }, "require-dev": { - "phpunit/phpunit": "^6.4 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" } } diff --git a/makesrc.sh b/makesrc.sh new file mode 120000 index 0000000..7b1a633 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1 @@ +php-react-cache-get-source.sh \ No newline at end of file diff --git a/php-react-cache-get-source.sh b/php-react-cache-get-source.sh new file mode 100755 index 0000000..8b02c4f --- /dev/null +++ b/php-react-cache-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}/ + 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-cache.spec b/php-react-cache.spec index 731be9f..10b6b8b 100644 --- a/php-react-cache.spec +++ b/php-react-cache.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-react-cache # -# Copyright (c) 2017-2019 Shawn Iwinski +# Copyright (c) 2017-2020 Shawn Iwinski # # License: MIT # http://opensource.org/licenses/MIT @@ -12,15 +12,16 @@ %global github_owner reactphp %global github_name cache -%global github_version 1.0.0 -%global github_commit aa10d63a1b40a36a486bdf527f28bac607ee6466 +%global github_version 1.1.0 +%global github_commit 44a568925556b0bd8cacc7b49fb0f1cf0d706a0c %global composer_vendor react %global composer_project cache # "php": ">=5.3.0", %global php_min_ver 5.3.0 -# "react/promise": "~2.0|~1.1" +# "react/promise": "^3.0 || ~2.0|~1.1" +# ignore v3 not yet packaged %global react_promise_min_ver 1.1 %global react_promise_max_ver 3.0 @@ -36,21 +37,31 @@ Summary: Async caching License: MIT URL: https://reactphp.org/cache/ -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-cache-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} >= 32 || 0%{?rhel} >= 9 +# "phpunit/phpunit": "^9.3 || ^5.7 || ^4.8.35" +%global phpunit %{_bindir}/phpunit9 +BuildRequires: phpunit9 >= 9.3 +%else +%global phpunit %{_bindir}/phpunit +BuildRequires: php-phpunit-PHPUnit >= 4.8.35 +%endif %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 BuildRequires: (php-composer(react/promise) >= %{react_promise_min_ver} with php-composer(react/promise) < %{react_promise_max_ver}) %else -BuildRequires: php-composer(react/promise) < %{react_promise_max_ver} -BuildRequires: php-composer(react/promise) >= %{react_promise_min_ver} +BuildRequires: php-react-promise >= %{react_promise_min_ver} %endif -## phpcompatinfo (computed from version 1.0.0) +## phpcompatinfo (computed from version 1.1.0) # ## Autoloader BuildRequires: php-composer(fedora/autoloader) @@ -61,10 +72,9 @@ Requires: php(language) >= %{php_min_ver} %if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 Requires: (php-composer(react/promise) >= %{react_promise_min_ver} with php-composer(react/promise) < %{react_promise_max_ver}) %else -Requires: php-composer(react/promise) < %{react_promise_max_ver} -Requires: php-composer(react/promise) >= %{react_promise_min_ver} +Requires: php-react-promise >= %{react_promise_min_ver} %endif -# phpcompatinfo (computed from version 1.0.0) +# phpcompatinfo (computed from version 1.1.0) # # Autoloader Requires: php-composer(fedora/autoloader) @@ -112,18 +122,19 @@ cp -rp src %{buildroot}%{phpdir}/React/Cache %check %if %{with_tests} : Create tests bootstrap -cat <<'BOOTSTRAP' | tee bootstrap.php +mkdir vendor +cat <<'BOOTSTRAP' | tee vendor/autoload.php - 1.1.0-1 +- update to 1.1.0 +- switch to phpunit9 + * Sat Dec 14 2019 Shawn Iwinski - 1.0.0-1 - Update to 1.0.0 (RHBZ #1727191) - Use PHPUnit 6 -- cgit