diff options
author | Remi Collet <remi@remirepo.net> | 2020-11-04 14:22:14 +0100 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2020-11-04 14:22:14 +0100 |
commit | 2a103e7ae96600b15197b5cb32cd9b8eeb3da576 (patch) | |
tree | 70fa8615bf5ce30f3addc3341b06d922a46749f5 | |
parent | 19b50a74d3b5ab1d695e77c3f62e9349e74fb8d0 (diff) |
update to 1.4.0
switch to phpunit9
-rw-r--r-- | composer.json | 26 | ||||
l--------- | makesrc.sh | 1 | ||||
-rwxr-xr-x | php-react-dns-get-source.sh | 74 | ||||
-rw-r--r-- | php-react-dns.spec | 78 |
4 files changed, 142 insertions, 37 deletions
diff --git a/composer.json b/composer.json index 5c0e47a..ea644ae 100644 --- a/composer.json +++ b/composer.json @@ -3,16 +3,38 @@ "description": "Async DNS resolver for ReactPHP", "keywords": ["dns", "dns-resolver", "ReactPHP", "async"], "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/cache": "^1.0 || ^0.6 || ^0.5", "react/event-loop": "^1.0 || ^0.5", - "react/promise": "^2.7 || ^1.2.1", + "react/promise": "^3.0 || ^2.7 || ^1.2.1", "react/promise-timer": "^1.2" }, "require-dev": { "clue/block-react": "^1.2", - "phpunit/phpunit": "^7.0 || ^6.4 || ^5.7 || ^4.8.35" + "phpunit/phpunit": "^9.3 || ^4.8.35" }, "autoload": { "psr-4": { "React\\Dns\\": "src" } diff --git a/makesrc.sh b/makesrc.sh new file mode 120000 index 0000000..b6f0b15 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1 @@ +php-react-dns-get-source.sh
\ No newline at end of file diff --git a/php-react-dns-get-source.sh b/php-react-dns-get-source.sh new file mode 100755 index 0000000..8b02c4f --- /dev/null +++ b/php-react-dns-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-dns.spec b/php-react-dns.spec index d758237..4044334 100644 --- a/php-react-dns.spec +++ b/php-react-dns.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-react-dns # -# 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 dns -%global github_version 1.2.0 -%global github_commit a214d90c2884dac18d0cac6176202f247b66d762 +%global github_version 1.4.0 +%global github_commit 665260757171e2ab17485b44e7ffffa7acb6ca1f %global composer_vendor react %global composer_project dns @@ -29,7 +29,8 @@ # "react/event-loop": "^1.0 || ^0.5" %global react_event_loop_min_ver 0.5 %global react_event_loop_max_ver 2.0 -# "react/promise": "^2.7 || ^1.2.1" +# "react/promise": "^3.0 || ^2.7 || ^1.2.1" +# ignore v3 not yet packaged %global react_promise_min_ver 1.2.1 %global react_promise_max_ver 3.0 # "react/promise-timer": "^1.2" @@ -37,7 +38,7 @@ %global react_promise_timer_max_ver 2.0 # Build using "--without tests" to disable tests -%global with_tests 0%{!?_without_tests:1} +%bcond_without tests %{!?phpdir: %global phpdir %{_datadir}/php} @@ -48,14 +49,25 @@ Summary: Async DNS resolver License: MIT URL: https://reactphp.org/dns/ -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-dns-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} +%if %{with tests} ## composer.json BuildRequires: php(language) >= %{php_min_ver} -BuildRequires: phpunit7 +%if 0%{?fedora} >= 32 || 0%{?rhel} >= 9 +# "phpunit/phpunit": "^9.3 || ^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(clue/block-react) >= %{clue_block_react_min_ver} with php-composer(clue/block-react) < %{clue_block_react_max_ver}) BuildRequires: (php-composer(react/cache) >= %{react_cache_min_ver} with php-composer(react/cache) < %{react_cache_max_ver}) @@ -63,18 +75,13 @@ BuildRequires: (php-composer(react/event-loop) >= %{react_event_loop_min_ver} wi BuildRequires: (php-composer(react/promise-timer) >= %{react_promise_timer_min_ver} with php-composer(react/promise-timer) < %{react_promise_timer_max_ver}) BuildRequires: (php-composer(react/promise) >= %{react_promise_min_ver} with php-composer(react/promise) < %{react_promise_max_ver}) %else -BuildRequires: php-composer(clue/block-react) < %{clue_block_react_max_ver} -BuildRequires: php-composer(clue/block-react) >= %{clue_block_react_min_ver} -BuildRequires: php-composer(react/cache) < %{react_cache_max_ver} -BuildRequires: php-composer(react/cache) >= %{react_cache_min_ver} -BuildRequires: php-composer(react/event-loop) < %{react_event_loop_max_ver} -BuildRequires: php-composer(react/event-loop) >= %{react_event_loop_min_ver} -BuildRequires: php-composer(react/promise-timer) < %{react_promise_timer_max_ver} -BuildRequires: php-composer(react/promise-timer) >= %{react_promise_timer_min_ver} -BuildRequires: php-composer(react/promise) < %{react_promise_max_ver} -BuildRequires: php-composer(react/promise) >= %{react_promise_min_ver} +BuildRequires: php-clue-block-react >= %{clue_block_react_min_ver} +BuildRequires: php-react-cache >= %{react_cache_min_ver} +BuildRequires: php-react-event-loop >= %{react_event_loop_min_ver} +BuildRequires: php-react-promise-timer >= %{react_promise_timer_min_ver} +BuildRequires: php-react-promise >= %{react_promise_min_ver} %endif -## phpcompatinfo (computed from version 1.2.0) +## phpcompatinfo (computed from version 1.4.0) BuildRequires: php-filter BuildRequires: php-json BuildRequires: php-pcre @@ -93,16 +100,12 @@ Requires: (php-composer(react/event-loop) >= %{react_event_loop_min_ver} wi Requires: (php-composer(react/promise-timer) >= %{react_promise_timer_min_ver} with php-composer(react/promise-timer) < %{react_promise_timer_max_ver}) Requires: (php-composer(react/promise) >= %{react_promise_min_ver} with php-composer(react/promise) < %{react_promise_max_ver}) %else -Requires: php-composer(react/cache) < %{react_cache_max_ver} -Requires: php-composer(react/cache) >= %{react_cache_min_ver} -Requires: php-composer(react/event-loop) < %{react_event_loop_max_ver} -Requires: php-composer(react/event-loop) >= %{react_event_loop_min_ver} -Requires: php-composer(react/promise-timer) < %{react_promise_timer_max_ver} -Requires: php-composer(react/promise-timer) >= %{react_promise_timer_min_ver} -Requires: php-composer(react/promise) < %{react_promise_max_ver} -Requires: php-composer(react/promise) >= %{react_promise_min_ver} +Requires: php-react-cache >= %{react_cache_min_ver} +Requires: php-react-event-loop >= %{react_event_loop_min_ver} +Requires: php-react-promise-timer >= %{react_promise_timer_min_ver} +Requires: php-react-promise >= %{react_promise_min_ver} %endif -# phpcompatinfo (computed from version 1.2.0) +# phpcompatinfo (computed from version 1.4.0) Requires: php-filter Requires: php-pcre Requires: php-reflection @@ -155,13 +158,14 @@ cp -rp src %{buildroot}%{phpdir}/React/Dns %check -%if %{with_tests} +%if %{with tests} : Create tests bootstrap -cat <<'BOOTSTRAP' | tee bootstrap.php +mkdir vendor +cat <<'BOOTSTRAP' | tee vendor/autoload.php <?php require '%{buildroot}%{phpdir}/React/Dns/autoload.php'; require '%{phpdir}/Clue/React/Block/autoload.php'; -\Fedora\Autoloader\Autoload::addPsr4('React\\Tests\\Dns\\', __DIR__.'/tests'); +\Fedora\Autoloader\Autoload::addPsr4('React\\Tests\\Dns\\', dirname(__DIR__).'/tests'); BOOTSTRAP : Skip test requiring network access and/or fail in restrictive buildroot env -- i.e. Bodhi @@ -185,10 +189,10 @@ rm -f tests/Protocol/ParserTest.php : Upstream tests RETURN_CODE=0 -PHPUNIT=$(which phpunit7) -for PHP_EXEC in "" php71 php72 php73 php74; do - if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then - $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php \ +for CMDARG in "php %{phpunit}" "php72 %{_bindir}/phpunit" php74 php80; do + if which $CMDARG; then + set $CMDARG + $1 ${2:-%{_bindir}/phpunit9} --verbose \ || RETURN_CODE=1 fi done @@ -207,6 +211,10 @@ exit $RETURN_CODE %changelog +* Wed Nov 4 2020 Remi Collet <remi@remirepo.net> - 1.4.0-1 +- update to 1.4.0 +- switch to phpunit9 + * Sat Dec 14 2019 Shawn Iwinski <shawn@iwin.ski> - 1.2.0-1 - Update to 1.2.0 (RHBZ #1597271) - Use PHPUnit 7 |