From fd9cf3570d420926315b86a1fd5226b288b8c695 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 12 Aug 2020 12:17:01 +0200 Subject: update to 1.1.2 sources from git snapshot obsolete php-channel-nrk drop dependency on pear move to /usr/share/php with autoloader link for BC --- .gitignore | 9 +++ composer.json | 44 +++++++++++++ makesrc.sh | 28 +++++++++ php-nrk-Predis-pr393.patch | 44 ------------- php-nrk-Predis.spec | 152 ++++++++++++++++++++------------------------- 5 files changed, 149 insertions(+), 128 deletions(-) create mode 100644 .gitignore create mode 100644 composer.json create mode 100755 makesrc.sh delete mode 100644 php-nrk-Predis-pr393.patch 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/composer.json b/composer.json new file mode 100644 index 0000000..48c05e5 --- /dev/null +++ b/composer.json @@ -0,0 +1,44 @@ +{ + "name": "predis/predis", + "type": "library", + "description": "Flexible and feature-complete Redis client for PHP and HHVM", + "keywords": ["nosql", "redis", "predis"], + "homepage": "http://github.com/nrk/predis", + "license": "MIT", + "support": { + "issues": "https://github.com/nrk/predis/issues" + }, + "authors": [ + { + "name": "Daniele Alessandri", + "email": "suppakilla@gmail.com", + "homepage": "http://clorophilla.net" + } + ], + "require": { + "php": ">=5.3.9", + "cweagans/composer-patches": "^1.6" + }, + "require-dev": { + "phpunit/phpunit": "~4.8" + }, + "suggest": { + "ext-phpiredis": "Allows faster serialization and deserialization of the Redis protocol", + "ext-curl": "Allows access to Webdis when paired with phpiredis" + }, + "autoload": { + "psr-4": {"Predis\\": "src/"} + }, + "extra": { + "composer-exit-on-patch-failure": true, + "patches": { + "phpunit/phpunit-mock-objects": { + "Fix PHP 7 and 8 compatibility": "./tests/phpunit_mock_objects.patch" + }, + "phpunit/phpunit": { + "Fix PHP 7 compatibility": "./tests/phpunit_php7.patch", + "Fix PHP 8 compatibility": "./tests/phpunit_php8.patch" + } + } + } +} diff --git a/makesrc.sh b/makesrc.sh new file mode 100755 index 0000000..4190c13 --- /dev/null +++ b/makesrc.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +NAME=$(basename $PWD) +OWNER=$(sed -n '/^%global gh_owner/{s/.* //;p}' $NAME.spec) +PROJECT=$(sed -n '/^%global gh_project/{s/.* //;p}' $NAME.spec) +VERSION=$(sed -n '/^Version:/{s/.* //;p}' $NAME.spec) +COMMIT=$(sed -n '/^%global gh_commit/{s/.* //;p}' $NAME.spec) +SHORT=${COMMIT:0:7} + +echo -e "\nCreate git snapshot\nName=$NAME, Owner=$OWNER, Project=$PROJECT, Version=$VERSION\n" + +echo "Cloning..." +rm -rf $PROJECT-$COMMIT +git clone https://github.com/$OWNER/$PROJECT.git $PROJECT-$COMMIT + +echo "Getting commit..." +pushd $PROJECT-$COMMIT +git checkout $COMMIT +cp composer.json ../composer.json +popd + +echo "Archiving..." +tar czf $NAME-$VERSION-$SHORT.tgz --exclude-vcs --exclude tools $PROJECT-$COMMIT + +echo "Cleaning..." +rm -rf $PROJECT-$COMMIT + +echo "Done." diff --git a/php-nrk-Predis-pr393.patch b/php-nrk-Predis-pr393.patch deleted file mode 100644 index 72b624e..0000000 --- a/php-nrk-Predis-pr393.patch +++ /dev/null @@ -1,44 +0,0 @@ -From d1290dfde07e7d33aae9017dd47e9a46d9c889f4 Mon Sep 17 00:00:00 2001 -From: Remi Collet -Date: Thu, 17 Nov 2016 15:24:54 +0100 -Subject: [PATCH 2/2] fix test for ArgumentCountError exception with PHP 7.1 - ---- - tests/Predis/Command/RawCommandTest.php | 21 ++++++++++++++++++++- - 1 file changed, 20 insertions(+), 1 deletion(-) - -diff --git a/tests/Predis/Command/RawCommandTest.php b/tests/Predis/Command/RawCommandTest.php -index 7be62c8..8d6cc14 100644 ---- a/tests/Predis/Command/RawCommandTest.php -+++ b/tests/Predis/Command/RawCommandTest.php -@@ -74,10 +74,29 @@ public function testExceptionOnMissingCommandID() - * argument is missing, PHP emits an E_WARNING. - * - * @group disconnected -- * @expectedException \PHPUnit_Framework_Error_Warning - */ - public function testPHPWarningOnMissingCommandIDWithStaticCreate() - { -+ if (version_compare(PHP_VERSION, "7.1", '>')) { -+ $this->markTestSkipped('only for PHP < 7.1'); -+ } -+ $this->setExpectedException('PHPUnit_Framework_Error_Warning'); -+ RawCommand::create(); -+ } -+ -+ /** -+ * The signature of RawCommand::create() requires one argument which is the -+ * ID of the command (other arguments are fetched dinamically). If the first -+ * argument is missing, PHP 7.1 throw an exception -+ * -+ * @group disconnected -+ */ -+ public function testPHPWarningOnMissingCommandIDWithStaticCreate71() -+ { -+ if (version_compare(PHP_VERSION, "7.1", '<')) { -+ $this->markTestSkipped('only for PHP > 7.1'); -+ } -+ $this->setExpectedException('ArgumentCountError'); - RawCommand::create(); - } - diff --git a/php-nrk-Predis.spec b/php-nrk-Predis.spec index 3882fb7..6dd4f17 100644 --- a/php-nrk-Predis.spec +++ b/php-nrk-Predis.spec @@ -1,100 +1,88 @@ # remirepo/fedora spec file for php-nrk-Predis # -# Copyright (c) 2013-2017 Remi Collet +# Copyright (c) 2013-2020 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # # Please, preserve the changelog entries # -%{!?__pear: %global __pear %{_bindir}/pear} -%global pear_name Predis -%global pear_channel pear.nrk.io -%if 0%{?fedora} >= 21 || 0%{?rhel} >= 7 -%global with_tests %{?_without_tests:0}%{!?_without_tests:1} +%if 0%{?fedora} >= 31 || 0%{?rhel} >= 8 +%bcond_without tests %else -%global with_tests %{?_with_tests:1}%{!?_with_tests:0} +%bcond_with tests %endif +%global gh_owner nrk +%global gh_project predis +%global gh_commit 82eb18c6c3860849cb6e2ff34b0c4b39d5daee46 +%global gh_short %(c=%{gh_commit}; echo ${c:0:7}) + +%global ns_project Predis + +%global pear_name Predis +%global pear_channel pear.nrk.io + Name: php-nrk-Predis -Version: 1.1.1 -Release: 2%{?dist} +Version: 1.1.2 +Release: 1%{?dist} Summary: PHP client library for Redis -Group: Development/Libraries License: MIT -URL: http://%{pear_channel} -Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz +URL: https://github.com/%{gh_owner}/%{gh_project} +Source0: %{name}-%{version}-%{gh_short}.tgz +Source1: makesrc.sh -# https://github.com/nrk/predis/pull/393 -Patch0: %{name}-pr393.patch - -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php(language) >= 5.3.9 -BuildRequires: php-pear(PEAR) -BuildRequires: php-channel(%{pear_channel}) -%if %{with_tests} +%if %{with tests} BuildRequires: php-phpunit-PHPUnit -BuildRequires: redis > 2.8 +BuildRequires: redis %endif -Requires(post): %{__pear} -Requires(postun): %{__pear} Requires: php(language) >= 5.3.9 Requires: php-reflection -Requires: php-curl Requires: php-filter Requires: php-pcre Requires: php-session Requires: php-sockets Requires: php-spl -Requires: php-pear(PEAR) -Requires: php-channel(%{pear_channel}) +%if 0%{?fedora} >= 30 || 0%{?rhel} >=8 +Recommends: php-curl +Recommends: php-phpiredis +%endif Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version} Provides: php-composer(predis/predis) = %{version} +# This pkg was the only one in this channel so the channel is no longer needed +Obsoletes: php-channel-nrk < 1.4 + %description Flexible and feature-complete PHP client library for Redis. %prep -%setup -q -c - -cd %{pear_name}-%{version} -%patch0 -p1 -sed -e '/test/s/md5sum="[^"]*"//' ../package.xml >%{name}.xml +%setup -q -n %{gh_project}-%{gh_commit} %build -cd %{pear_name}-%{version} -# Empty build section, most likely nothing required. - +: nothing %install -rm -rf %{buildroot} -cd %{pear_name}-%{version} -%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml - -# Clean up unnecessary files -rm -rf %{buildroot}%{pear_metadir}/.??* - -# Install XML package description -mkdir -p %{buildroot}%{pear_xmldir} -install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir} +mkdir -p %{buildroot}%{_datadir}/php/ +cp -pr src %{buildroot}%{_datadir}/php/%{ns_project} -# Relocate PATH so test suite can be run from install dir -sed -e 's:tests/::' \ - %{buildroot}%{pear_testdir}/%{pear_name}/phpunit.xml.dist \ - > %{buildroot}%{pear_testdir}/%{pear_name}/phpunit.xml +# for compatibility with PEAR installation +mkdir -p %{buildroot}%{_datadir}/pear/%{ns_project} +ln -s ../../php/Predis/Autoloader.php %{buildroot}%{_datadir}/pear/%{ns_project}/Autoloader.php %check -%if %{with_tests} +%if %{with tests} : Launch redis server -port=6379 +port=$(expr 6379 + %{?fedora}%{?rhel}) pidfile=$PWD/redis.pid mkdir -p data redis-server \ @@ -106,25 +94,16 @@ redis-server \ --pidfile $pidfile : Run the installed test Suite against the installed library -pushd %{buildroot}%{pear_testdir}/%{pear_name} +sed -e "s/6379/$port/" phpunit.xml.dist > phpunit.xml +sed -e "/expectedExceptionMessageRegExp/s/6379/$port/" -i tests/PHPUnit/PredisConnectionTestCase.php + +# testReturnsCommandInfoOnExistingCommand failing on recent Redis version + ret=0 -# remirepo:10 -run=0 -if which php71; then - php71 %{_bindir}/phpunit --include-path=%{buildroot}%{pear_phpdir} || ret=1 - run=1 -fi -if which php56; then - php56 %{_bindir}/phpunit --include-path=%{buildroot}%{pear_phpdir} || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/phpunit \ - --include-path=%{buildroot}%{pear_phpdir} \ +php -d memory_limit=1G %{_bindir}/phpunit \ + --include-path=%{buildroot}%{_datadir}/pear \ + --filter '^((?!(testReturnsCommandInfoOnExistingCommand)).)*$' \ --verbose || ret=1 -# remirepo:1 -fi -popd : Cleanup if [ -f $pidfile ]; then @@ -137,30 +116,35 @@ exit $ret %endif -%clean -rm -rf %{buildroot} - - -%post -%{__pear} install --nodeps --soft --force --register-only \ - %{pear_xmldir}/%{name}.xml >/dev/null || : - -%postun -if [ $1 -eq 0 ] ; then - %{__pear} uninstall --nodeps --ignore-errors --register-only \ - %{pear_channel}/%{pear_name} >/dev/null || : +%pre +if [ -x %{_bindir}/pear ]; then + %{_bindir}/pear uninstall --nodeps --ignore-errors --register-only \ + %{pear_channel}/%{pear_name} >/dev/null || : fi %files -%defattr(-,root,root,-) -%doc %{pear_docdir}/%{pear_name} -%{pear_xmldir}/%{name}.xml -%{pear_phpdir}/%{pear_name} -%{pear_testdir}/%{pear_name} - +# remirepo:1 +%{!?_licensedir:%global license %%doc} +%license LICENSE +%doc composer.json +%doc *md +%doc examples +%{_datadir}/php/%{ns_project} +%{_datadir}/pear/%{ns_project} %changelog +* Wed Aug 12 2020 Remi Collet - 1.1.2-1 +- update to 1.1.2 +- sources from git snapshot +- obsolete php-channel-nrk +- drop dependency on pear +- move to /usr/share/php with autoloader link for BC + +* Tue Feb 13 2018 Remi Collet - 1.1.1-5 +- fix FTBFS from Koschei with patch from + https://github.com/nrk/predis/pull/486 + * Thu Nov 17 2016 Remi Collet - 1.1.1-2 - fix bootstraping to redis server for test suite - add patch for PHP 7.1 -- cgit