From c73bf93a6ca507733856ff3c9ac851ad7b4fea55 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Wed, 19 Oct 2016 08:18:51 +0200 Subject: php-ocramius-proxy-manager: 1.0.2 (synced with Fedora) --- php-ocramius-proxy-manager.spec | 94 +++++++++++++++++++++++------------------ 1 file changed, 52 insertions(+), 42 deletions(-) diff --git a/php-ocramius-proxy-manager.spec b/php-ocramius-proxy-manager.spec index f9ed347..4e9bfdd 100644 --- a/php-ocramius-proxy-manager.spec +++ b/php-ocramius-proxy-manager.spec @@ -1,8 +1,8 @@ # remirepo spec file for php-ocramius-proxy-manager from Fedora: # -# RPM spec file for php-ocramius-proxy-manager +# Fedora spec file for php-ocramius-proxy-manager # -# Copyright (c) 2015 Shawn Iwinski +# Copyright (c) 2015-2016 Shawn Iwinski # # License: MIT # http://opensource.org/licenses/MIT @@ -24,20 +24,13 @@ %global zf_min_ver 2.2.5 %global zf_max_ver 3.0 -# Skip tests for EPEL 6 b/c PHPUnit < 4 -# TODO: Get tests running on EPEL 6! -%if 0%{?el6} -%global with_tests 0 -%else -# Build using "--without tests" to disable tests -%global with_tests %{?_without_tests:0}%{!?_without_tests:1} -%endif +%global with_tests 0%{!?_without_tests:1} %{!?phpdir: %global phpdir %{_datadir}/php} Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 2%{?github_release}%{?dist} Summary: OOP proxy wrappers utilities Group: Development/Libraries @@ -47,30 +40,43 @@ Source0: https://github.com/%{github_owner}/%{github_name}/archive/%{githu BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root BuildArch: noarch -# Autoload generation +# Autoloader BuildRequires: %{_bindir}/phpab %if %{with_tests} # Tests ## composer.json BuildRequires: %{_bindir}/phpunit -BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php(language) >= %{php_min_ver} BuildRequires: php-composer(zendframework/zend-code) >= %{zf_min_ver} BuildRequires: php-composer(zendframework/zend-code) < %{zf_max_ver} -## phpcompatinfo (computed from version 1.0.0) +BuildRequires: php-composer(ocramius/generated-hydrator) >= 1.2.0 +## phpcompatinfo (computed from version 1.0.2) BuildRequires: php-pcre BuildRequires: php-reflection BuildRequires: php-spl %endif # composer.json -Requires: php(language) >= %{php_min_ver} +Requires: php(language) >= %{php_min_ver} Requires: php-composer(zendframework/zend-code) >= %{zf_min_ver} Requires: php-composer(zendframework/zend-code) < %{zf_max_ver} -# phpcompatinfo (computed from version 1.0.0) +# phpcompatinfo (computed from version 1.0.2) Requires: php-pcre Requires: php-reflection Requires: php-spl +# Weak dependencies +%if 0%{?fedora} >= 21 +Suggests: php-composer(ocramius/generated-hydrator) +Suggests: php-composer(zendframework/zend-json) +Suggests: php-composer(zendframework/zend-soap) +Suggests: php-composer(zendframework/zend-stdlib) +Suggests: php-composer(zendframework/zend-xmlrpc) +%endif +# For autoloader +Conflicts: php-ocramius-generated-hydrator < 1.2.0 + + # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -78,17 +84,7 @@ Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} A library providing utilities to generate, instantiate and generally operate with Object Proxies. -Optional: -* php-ZendFramework2-Json - To have the JsonRpc adapter (Remote Object feature) -* php-ZendFramework2-Soap - To have the Soap adapter (Remote Object feature) -* php-ZendFramework2-Stdlib - To use the hydrator proxy -* php-ZendFramework2-XmlRpc - To have the XmlRpc adapter (Remote Object feature) -* php-ocramius-generated-hydrator - To have very fast object to array to object conversion for ghost objects +Autoloader: %{phpdir}/ProxyManager/autoload.php %prep @@ -97,17 +93,22 @@ Optional: %build : Generate autoloader -%{_bindir}/phpab --nolower --output src/ProxyManager/autoload.php src/ProxyManager - -(cat <<'AUTOLOAD' - -// TODO: Add Zend/ZendXml/Ocramius autoloaders from their packages when they are available -spl_autoload_register(function ($class) { - $src = str_replace('\\', '/', $class) . '.php'; - @include_once $src; -}); +%{_bindir}/phpab --output src/ProxyManager/autoload.php src/ProxyManager + +cat <<'AUTOLOAD' | tee -a src/ProxyManager/autoload.php + +// Dependencies (autoloader => required) +foreach (array( + // Required + '%{phpdir}/Zend/autoload.php' => true, + // Optional + '%{phpdir}/GeneratedHydrator/autoload.php' => false, +) as $dependencyAutoloader => $required) { + if ($required || file_exists($dependencyAutoloader)) { + require_once $dependencyAutoloader; + } +} AUTOLOAD -) | tee -a src/ProxyManager/autoload.php %install @@ -119,19 +120,22 @@ cp -rp src/* %{buildroot}%{phpdir}/ %check %if %{with_tests} : Create tests autoload -%{_bindir}/phpab --nolower --output tests/autoload.php tests %{phpdir}/PHPUnit +%{_bindir}/phpab --output tests/autoload.php tests %{phpdir}/PHPUnit : Create mock Composer "vendor/autoload.php" mkdir vendor -(cat <<'AUTOLOAD' +cat <<'AUTOLOAD' | tee vendor/autoload.php - 1.0.2-2 +- Update to 1.0.2 (RHBZ #1251784) +- Add weak dependencies +- Use dependencies' autoloaders +- Temporarily skip tests on Fedora 25+ (RHBZ #1350615) + * Mon Aug 10 2015 Remi Collet - 1.0.2-1 - update to 1.0.2 -- cgit