diff options
author | Remi Collet <remi@remirepo.net> | 2017-06-07 09:25:37 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-06-07 09:25:37 +0200 |
commit | ab11475328215f1a051201a67966dec11144de35 (patch) | |
tree | 4dcaba8699d1b6fc7d116eedd47641eebba9a4ac /php-PhpOption.spec | |
parent | 23925880616bb572dc95a4749152c9f5d06b3e9b (diff) |
sync with Fedora
Diffstat (limited to 'php-PhpOption.spec')
-rw-r--r-- | php-PhpOption.spec | 71 |
1 files changed, 35 insertions, 36 deletions
diff --git a/php-PhpOption.spec b/php-PhpOption.spec index 63a8ed4..88a9889 100644 --- a/php-PhpOption.spec +++ b/php-PhpOption.spec @@ -1,8 +1,8 @@ # remirepo spec file for php-PhpOption, from Fedora: # -# RPM spec file for php-PhpOption +# Fedora spec file for php-PhpOption # -# Copyright (c) 2013-2015 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2013-2017 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -28,7 +28,7 @@ Name: php-PhpOption Version: %{github_version} -Release: 1%{?dist} +Release: 2%{?dist} Summary: Option type for PHP Group: Development/Libraries @@ -36,17 +36,16 @@ License: ASL 2.0 URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch # Tests %if %{with_tests} -BuildRequires: php-composer(phpunit/phpunit) >= 4.7 +BuildRequires: php-composer(phpunit/phpunit) ## composer.json BuildRequires: php(language) >= %{php_min_ver} ## phpcompatinfo (computed from version 1.5.0) BuildRequires: php-spl ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json @@ -54,7 +53,7 @@ Requires: php(language) >= %{php_min_ver} # phpcompatinfo (computed from version 1.5.0) Requires: php-spl # 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} @@ -83,56 +82,51 @@ make your code more robust. On the other hand, the Option type also allows the API developer to provide more concise API methods, and empowers the API user in how he consumes these methods. +Autoloader: %{phpdir}/PhpOption/autoload.php + %prep %setup -qn %{github_name}-%{github_commit} + +%build : Create autoloader cat <<'AUTOLOAD' | tee src/PhpOption/autoload.php <?php /** * Autoloader for %{name} and its' dependencies - * - * Created by %{name}-%{version}-%{release} - * - * @return \Symfony\Component\ClassLoader\ClassLoader + * (created by %{name}-%{version}-%{release}). */ +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('PhpOption\\', dirname(__DIR__)); - -return $fedoraClassLoader; +\Fedora\Autoloader\Autoload::addPsr4('PhpOption\\', __DIR__); AUTOLOAD -%build -# Empty build section, nothing to build - - %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{phpdir} -cp -rp src/* %{buildroot}%{phpdir}/ +cp -rp src/PhpOption %{buildroot}%{phpdir}/ %check -%{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/PhpOption/autoload.php - - -%clean -rm -rf %{buildroot} +%if %{with_tests} +: Upstream tests +RETURN_CODE=0 +PHPUNIT=$(which phpunit) +for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do + if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then + $PHP_EXEC $PHPUNIT --verbose \ + --bootstrap %{buildroot}%{phpdir}/PhpOption/autoload.php \ + || RETURN_CODE=1 + fi +done +exit $RETURN_CODE +%else +: Tests skipped +%endif %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license LICENSE %doc *.md @@ -141,7 +135,12 @@ rm -rf %{buildroot} %changelog -* Tue Sep 22 2015 Remi Collet <remi@remirepo.net> 1.4.0-1 +* Sun Jun 04 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.5.0-1 +- Updated to 1.5.0 +- Switched autoloader to php-composer(fedora/autoloader) +- Test with SCLs if available + +* Tue Sep 22 2015 Remi Collet <remi@remirepo.net> 1.5.0-1 - update to 1.5.0 * Sat Jul 11 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.4.0-4 |