diff options
| -rw-r--r-- | .gitignore | 8 | ||||
| -rw-r--r-- | php-guzzle-Guzzle.spec | 170 | 
2 files changed, 96 insertions, 82 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc9aa8c --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +clog +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/php-guzzle-Guzzle.spec b/php-guzzle-Guzzle.spec index 4129015..f3cf3a0 100644 --- a/php-guzzle-Guzzle.spec +++ b/php-guzzle-Guzzle.spec @@ -2,7 +2,7 @@  #  # Fedora spec file for php-guzzle-Guzzle  # -# Copyright (c) 2012-2016 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2012-2017 Shawn Iwinski <shawn.iwinski@gmail.com>  #  # License: MIT  # http://opensource.org/licenses/MIT @@ -32,32 +32,28 @@  %global monolog_max_ver 2.0  # "psr/log": "~1.0"  #     NOTE: Min version not 1.0 because autoloader required -%global psr_log_min_ver 1.0.0-8 +%global psr_log_min_ver 1.0.1  %global psr_log_max_ver 2.0  # "symfony/class-loader": "~2.1"  # "symfony/event-dispatcher": "~2.1" -%global symfony_min_ver 2.7.1 +#     NOTE: Min version not 2.1 because autoloader required +%global symfony_min_ver %{?el6:2.3.31}%{!?el6:2.7.1}  %global symfony_max_ver 3.0  # "zendframework/zend-cache": "2.*,<2.3",  # "zendframework/zend-log": "2.*,<2.3"  #     NOTE: Min version not 2.0 because autoloader required  #     NOTE: Max version 3 instead of 2.3 because tests pass -%global zend_min_ver 2.4.7 +%global zend_min_ver %{?el6:2.0}%{!?el6:2.4.7}  %global zend_max_ver 3 -%if 0%{?fedora} < 18 && 0%{?rhel} < 6 -# Missing nodejs -%global with_tests 0 -%else  # Build using "--without tests" to disable tests  %global with_tests 0%{!?_without_tests:1} -%endif  %{!?phpdir:  %global phpdir  %{_datadir}/php}  Name:          php-guzzle-%{pear_name}  Version:       %{github_version} -Release:       9%{?dist}.1 +Release:       13%{?dist}  Summary:       PHP HTTP client library and framework for building RESTful web service clients  Group:         Development/Libraries @@ -69,7 +65,6 @@ Source0:       %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{githu  # https://github.com/guzzle/guzzle3/pull/77  Patch0:        %{name}-doctrine-cache-gte-1-6-0.patch -BuildRoot:     %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)  BuildArch:     noarch  # Tests  %if %{with_tests} @@ -77,14 +72,20 @@ BuildRequires: nodejs  ## composer.json  BuildRequires: php(language)                          >= %{php_min_ver}  BuildRequires: php-composer(doctrine/cache)           >= %{doctrine_cache_min_ver} +BuildRequires: php-composer(doctrine/cache)           <  %{doctrine_cache_max_ver}  BuildRequires: php-composer(monolog/monolog)          >= %{monolog_min_ver} +BuildRequires: php-composer(monolog/monolog)          <  %{monolog_max_ver}  BuildRequires: php-composer(phpunit/phpunit) -#BuildRequires: php-composer(psr/log)                  >= %%{psr_log_min_ver} -BuildRequires: php-PsrLog                             >= %{psr_log_min_ver} +BuildRequires: php-composer(psr/log)                  >= %{psr_log_min_ver} +BuildRequires: php-composer(psr/log)                  <  %{psr_log_max_ver}  BuildRequires: php-composer(symfony/class-loader)     >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/class-loader)     <  %{symfony_max_ver}  BuildRequires: php-composer(symfony/event-dispatcher) >= %{symfony_min_ver} +BuildRequires: php-composer(symfony/event-dispatcher) <  %{symfony_max_ver}  BuildRequires: php-composer(zendframework/zend-cache) >= %{zend_min_ver} +BuildRequires: php-composer(zendframework/zend-cache) <  %{zend_max_ver}  BuildRequires: php-composer(zendframework/zend-log)   >= %{zend_min_ver} +BuildRequires: php-composer(zendframework/zend-log)   <  %{zend_max_ver}  BuildRequires: php-curl  ## phpcompatinfo (computed from version 3.9.3)  BuildRequires: php-ctype @@ -101,8 +102,9 @@ BuildRequires: php-spl  BuildRequires: php-xmlwriter  BuildRequires: php-zlib  ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader)  %endif +# Need investigation  # composer.json  Requires:      php(language)                          >= %{php_min_ver} @@ -121,10 +123,10 @@ Requires:      php-reflection  Requires:      php-simplexml  Requires:      php-spl  Requires:      php-xmlwriter -# use path as ca-certificates doesn't exists on EL-5 -Requires:      /etc/pki/tls/cert.pem +# Unbundled CA certificate +Requires:      ca-certificates  # Autoloader -Requires:      php-composer(symfony/class-loader) +Requires:      php-composer(fedora/autoloader)  # Standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" naming  Provides:      php-%{composer_vendor}-%{composer_project}             = %{version}-%{release} @@ -167,14 +169,6 @@ Suggests:      php-composer(monolog/monolog)  Suggests:      php-composer(zendframework/zend-cache)  Suggests:      php-composer(zendframework/zend-log)  %endif -Conflicts:     php-composer(doctrine/cache)           <  %{doctrine_cache_min_ver} -Conflicts:     php-composer(doctrine/cache)           >= %{doctrine_cache_max_ver} -Conflicts:     php-composer(monolog/monolog)          <  %{monolog_min_ver} -Conflicts:     php-composer(monolog/monolog)          >= %{monolog_max_ver} -Conflicts:     php-composer(zendframework/zend-cache) <  %{zend_min_ver} -Conflicts:     php-composer(zendframework/zend-cache) >= %{zend_max_ver} -Conflicts:     php-composer(zendframework/zend-log)   <  %{zend_min_ver} -Conflicts:     php-composer(zendframework/zend-log)   >= %{zend_max_ver}  %description  Guzzle takes the pain out of sending HTTP requests and the redundancy out @@ -199,6 +193,8 @@ Optional dependencies:  * Zend Framework 2 Cache (%{zend_min_ver} <= php-ZendFramework2-Cache < %{zend_max_ver})  * Zend Framework 2 Log (%{zend_min_ver} <= php-ZendFramework2-Log < %{zend_max_ver}) +Autoloader: %{phpdir}/Guzzle/autoload.php +  ***** EOL NOTICE *****  This package is for Guzzle 3.x. Guzzle 5.x+, the new versions of Guzzle, has @@ -229,34 +225,23 @@ cat <<'AUTOLOAD' | tee src/Guzzle/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'; + +\Fedora\Autoloader\Autoload::addPsr4('Guzzle\\', __DIR__); +%if 0%{?el6} +\Fedora\Autoloader\Autoload::addPsr4('Zend\\', '%{phpdir}/Zend'); +%endif -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('Guzzle\\', dirname(__DIR__)); - -// Dependencies (autoloader => required) -foreach(array( -    '%{phpdir}/Doctrine/Common/Cache/autoload.php'             => false, -    '%{phpdir}/Monolog/autoload.php'                           => false, -    '%{phpdir}/Symfony/Component/EventDispatcher/autoload.php' => true, -    '%{phpdir}/Zend/autoload.php'                              => false, -) as $dependencyAutoloader => $required) { -    if ($required || file_exists($dependencyAutoloader)) { -        require_once $dependencyAutoloader; -    } -} - -return $fedoraClassLoader; +\Fedora\Autoloader\Dependencies::required(array( +    '%{phpdir}/Symfony/Component/EventDispatcher/autoload.php', +)); + +\Fedora\Autoloader\Dependencies::optional(array( +    '%{phpdir}/Doctrine/Common/Cache/autoload.php', +    '%{phpdir}/Monolog/autoload.php', +    '%{phpdir}/Zend/autoload.php', +));  AUTOLOAD @@ -265,36 +250,47 @@ AUTOLOAD  %install -rm -rf %{buildroot} -  mkdir -p %{buildroot}%{phpdir} -cp -rp src/* %{buildroot}%{phpdir}/ +cp -rp src/Guzzle %{buildroot}%{phpdir}/  %check  %if %{with_tests} -: Create tests autoloader -cat <<'AUTOLOAD' | tee tests/autoload.php +: Mock Composer autoloader +mkdir vendor +cat <<'AUTOLOAD' | tee vendor/autoload.php  <?php +require_once '%{buildroot}%{phpdir}/Guzzle/autoload.php'; -$fedoraClassLoader = -    require_once '%{buildroot}%{phpdir}/Guzzle/autoload.php'; - -$fedoraClassLoader->addPrefix('Guzzle\\Tests', __DIR__); +\Fedora\Autoloader\Autoload::addPsr4('Guzzle\\Tests\\', dirname(__DIR__).'/tests/Guzzle/Tests'); -require_once '%{phpdir}/Symfony/Component/ClassLoader/autoload.php'; +\Fedora\Autoloader\Dependencies::required(array( +    '%{phpdir}/Symfony/Component/ClassLoader/autoload.php', +));  AUTOLOAD -: Modify tests bootstrap -sed "s#require.*autoload.*#require __DIR__ . '/autoload.php';#" \ -    -i tests/bootstrap.php -  : Skip tests known to fail -#sed 's/function testPurgeRemovesAllMethodCaches/function SKIP_testPurgeRemovesAllMethodCaches/' \ -#    -i tests/Guzzle/Tests/Plugin/Cache/DefaultCacheStorageTest.php  sed 's/function testAddsBody/function SKIP_testAddsBody/' \      -i tests/Guzzle/Tests/Stream/PhpStreamRequestFactoryTest.php -%if 0%{?rhel} == 6 || 0%{?rhel} == 5 +%if 0%{?fedora} +sed \ +    -e 's/function testCalculatesAge/function SKIP_testCalculatesAge/' \ +    -e 's/function testThrowsExceptionWhenFailsToParseJsonResponse/function SKIP_testThrowsExceptionWhenFailsToParseJsonResponse/' \ +    -i tests/Guzzle/Tests/Http/Message/ResponseTest.php +sed 's/function testParsesJsonResponses/function SKIP_testParsesJsonResponses/' \ +    -i tests/Guzzle/Tests/Http/Message/ResponseTest.php +sed 's/function testVisitsLocations/function SKIP_testVisitsLocations/' \ +    -i tests/Guzzle/Tests/Service/Command/OperationResponseParserTest.php +sed 's/function testOpensValidStreamByCreatingContext/function SKIP_testOpensValidStreamByCreatingContext/' \ +    -i tests/Guzzle/Tests/Stream/PhpStreamRequestFactoryTest.php +sed 's/function testAddsPostFields/function SKIP_testAddsPostFields/' \ +    -i tests/Guzzle/Tests/Stream/PhpStreamRequestFactoryTest.php +sed \ +    -e 's/function testWrapsErrorsAndInfo/function SKIP_testWrapsErrorsAndInfo/' \ +    -e 's/function testDeterminesIfResourceIsAvailable/function SKIP_testDeterminesIfResourceIsAvailable/' \ +    -i tests/Guzzle/Tests/Http/Curl/CurlHandleTest.php +%endif +%if 0%{?el6}  rm -f tests/Guzzle/Tests/Http/RedirectPluginTest.php  sed 's/function testCanCreateStreamsUsingDefaultFactory/function SKIP_testCanCreateStreamsUsingDefaultFactory/' \      -i tests/Guzzle/Tests/Http/StaticClientTest.php @@ -315,23 +311,22 @@ sed 's/function testMustReturnRequest/function SKIP_testMustReturnRequest/' \      -i tests/Guzzle/Tests/Service/Command/ClosureCommandTest.php  %endif -%{_bindir}/phpunit --verbose - -if which php70; then -   %{_bindir}/phpunit --verbose -fi +: Upstream tests +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71; 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 -# Ensure bundled CA cert is not referenced -grep -r "'/Resources/cacert.pem'" \ -    %{buildroot}%{_datadir}/php/Guzzle \ -    && exit 1 - - -%clean -rm -rf %{buildroot} +# Ensure unbundled CA cert is referenced +grep '%{_sysconfdir}/pki/tls/cert.pem' --quiet \ +    %{buildroot}%{_datadir}/php/Guzzle/Http/Client.php  %post @@ -343,7 +338,6 @@ fi  %files -%defattr(-,root,root,-)  %{!?_licensedir:%global license %%doc}  %license LICENSE  %doc *.md @@ -352,7 +346,19 @@ fi  %exclude %{phpdir}/Guzzle/*/composer.json  %exclude %{phpdir}/Guzzle/*/*/composer.json +  %changelog +* Thu Sep 21 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 3.9.3-13 +- Add max versions to BuildRequires +- Modify tests + +* Sat Feb 25 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 3.9.3-11 +- Fix FTBFS in rawhide (RHBZ #1350619, #1424063) +- Use php-composer(fedora/autoloader) +- Removed conflicts from weak dependencies +- Skip additional tests known to fail +- Test with SCLs if available +  * Fri Apr 15 2016 Remi Collet <remi@remirepo.net> - 3.9.3-9  - fix dep. on EL-5  | 
