diff options
Diffstat (limited to 'php-guzzlehttp-guzzle.spec')
-rw-r--r-- | php-guzzlehttp-guzzle.spec | 91 |
1 files changed, 32 insertions, 59 deletions
diff --git a/php-guzzlehttp-guzzle.spec b/php-guzzlehttp-guzzle.spec index 0ad23d8..ce4997e 100644 --- a/php-guzzlehttp-guzzle.spec +++ b/php-guzzlehttp-guzzle.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-guzzlehttp-guzzle # -# Copyright (c) 2014-2016 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2014-2017 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -22,26 +22,21 @@ %global php_min_ver 5.4.0 # "guzzlehttp/ringphp": "^1.1" # Note: Min version not "1.1" because autoloader required -%global ring_min_ver 1.1.0-6 +%global ring_min_ver 1.1.0-9 %global ring_max_ver 2.0 # "psr/log": "^1.0" %global psr_log_min_ver 1.0 %global psr_log_max_ver 2.0 -%if 0%{?rhel} == 5 -# no nodejs available in RHEL-5 -%global with_tests %{?_with_tests:1}%{!?_with_tests:0} -%else # Build using "--without tests" to disable tests %global with_tests 0%{!?_without_tests:1} -%endif %{!?phpdir: %global phpdir %{_datadir}/php} %{!?testsdir: %global testsdir %{_datadir}/tests} Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 3%{?github_release}%{?dist} Summary: PHP HTTP client and webservice framework Group: Development/Libraries @@ -53,15 +48,15 @@ URL: http://guzzlephp.org Source0: %{name}-%{github_version}-%{github_commit}.tar.gz Source1: %{name}-get-source.sh -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # Tests %if %{with_tests} BuildRequires: nodejs -BuildRequires: %{_bindir}/phpunit +BuildRequires: php-composer(phpunit/phpunit) BuildRequires: php-guzzlehttp-ringphp-tests ## composer.json -BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(guzzlehttp/ringphp) < %{ring_max_ver} #BuildRequires: php-composer(guzzlehttp/ringphp) >= %%{ring_min_ver} BuildRequires: php-guzzlehttp-ringphp >= %{ring_min_ver} ## phpcompatinfo (computed from version 5.3.1) @@ -75,11 +70,10 @@ BuildRequires: php-reflection BuildRequires: php-simplexml BuildRequires: php-spl ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif -# use path as ca-certificates doesn't exists on EL-5 -Requires: /etc/pki/tls/certs/ca-bundle.crt +Requires: ca-certificates # composer.json Requires: php(language) >= %{php_min_ver} #Requires: php-composer(guzzlehttp/ringphp) >= %%{ring_min_ver} @@ -95,7 +89,7 @@ Requires: php-pcre Requires: php-simplexml Requires: php-spl # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -114,6 +108,8 @@ the pain out of consuming web services. * Streaming multipart file uploads * Connection timeouts +Autoloader: %{phpdir}/GuzzleHttp/autoload.php + %prep %setup -qn %{github_name}-%{github_commit} @@ -126,30 +122,18 @@ cat <<'AUTOLOAD' | tee src/autoload.php /** * Autoloader for %{name} and its' dependencies * (created by %{name}-%{version}-%{release}). - * - * @return \Symfony\Component\ClassLoader\ClassLoader */ +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; -if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) { - if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) { - require_once '%{phpdir}/Symfony/Component/ClassLoader/ClassLoader.php'; - } - - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} - -$fedoraClassLoader->addPrefix('GuzzleHttp\\', dirname(__DIR__)); - -// Required dependency -require_once '%{phpdir}/GuzzleHttp/Ring/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr4('GuzzleHttp\\', __DIR__); -return $fedoraClassLoader; +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/GuzzleHttp/Ring/autoload.php', +)); AUTOLOAD %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{phpdir}/GuzzleHttp cp -pr src/* %{buildroot}%{phpdir}/GuzzleHttp/ @@ -159,9 +143,8 @@ cp -pr src/* %{buildroot}%{phpdir}/GuzzleHttp/ : Create tests autoloader cat <<'AUTOLOAD' | tee tests/autoload.php <?php - -$fedoraClassLoader = require '%{buildroot}%{phpdir}/GuzzleHttp/autoload.php'; -$fedoraClassLoader->addPrefix('GuzzleHttp\\Tests', __DIR__); +require '%{buildroot}%{phpdir}/GuzzleHttp/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr4('GuzzleHttp\\Tests', __DIR__); AUTOLOAD : Modify tests bootstrap @@ -169,17 +152,6 @@ sed -e "s#.*require.*autoload.*#require __DIR__ . '/autoload.php';#" \ -e "s#.*require.*Server.php.*#require '%{testsdir}/php-guzzlehttp-ringphp/autoload.php';#" \ -i tests/bootstrap.php -: Mock tests PSR-0 -mkdir tests/GuzzleHttp -ln -s .. tests/GuzzleHttp/Tests - -run=0 -ret=0 -if which php56; then - php56 %{_bindir}/phpunit - run=1 -fi - %if 1 : Skip allowed failures : https://github.com/guzzle/guzzle/blob/5.3.1/.travis.yml @@ -197,25 +169,21 @@ sed 's/function testEnsuresResponseIsPresentAfterSending/function SKIP_testEnsur -i tests/ClientTest.php %endif -if which php71; then - php71 %{_bindir}/phpunit || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/phpunit --verbose || ret=1 -fi -exit $ret +: Upstream tests +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in "" %{?rhel:php55} php56 php70 php71 php72; do + if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then + $PHP_EXEC $PHPUNIT --verbose || RETURN_CODE=1 + fi +done +exit $RETURN_CODE %else : Tests skipped %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc *.md @@ -224,6 +192,11 @@ rm -rf %{buildroot} %changelog +* Sun May 14 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 5.3.1-3 +- Switch autoloader to php-composer(fedora/autoloader) +- Add max versions to build dependencies +- Test with SCLs if available + * Tue Jul 19 2016 Remi Collet <remi@remirepo.net> - 5.3.1-1 - update to 5.3.1 (bacported from Fedora) - run test suite with both PHP 5 and 7 when available |