diff options
author | Remi Collet <remi@remirepo.net> | 2017-05-15 15:20:56 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-05-15 15:20:56 +0200 |
commit | fb1ff96e512a2eaa15ec07760565c8bc14e201de (patch) | |
tree | e7131dddb2d0039ee83d8bbc5923f90580668252 /php-gliph.spec | |
parent | 47beb6c3a9727f354666be67b5df7767401a9719 (diff) |
Diffstat (limited to 'php-gliph.spec')
-rw-r--r-- | php-gliph.spec | 70 |
1 files changed, 30 insertions, 40 deletions
diff --git a/php-gliph.spec b/php-gliph.spec index b03eebe..8918302 100644 --- a/php-gliph.spec +++ b/php-gliph.spec @@ -1,8 +1,8 @@ # remirepo spec file for php-gliph, from Fedora: # -# RPM spec file for php-gliph +# Fedora spec file for php-gliph # -# Copyright (c) 2013-2014 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-%{composer_project} Version: %{github_version} -Release: 4%{?github_release}%{?dist} +Release: 7%{?github_release}%{?dist} Summary: A graph library for PHP Group: Development/Libraries @@ -39,18 +39,17 @@ URL: https://github.com/%{github_owner}/%{github_name} Source0: %{name}-%{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: %{_bindir}/phpunit +BuildRequires: php-composer(phpunit/phpunit) ## composer.json BuildRequires: php(language) >= %{php_min_ver} ## phpcompatinfo (computed from version 0.1.8) BuildRequires: php-reflection BuildRequires: php-spl ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json @@ -58,7 +57,7 @@ Requires: php(language) >= %{php_min_ver} # phpcompatinfo (computed from version 0.1.8) 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} @@ -71,42 +70,29 @@ data structures for use by other PHP applications. It is (currently) designed for use with in-memory graphs, not for interaction with a graph database like Neo4J (http://neo4j.org/). +Autoloader: %{phpdir}/Gliph/autoload.php + %prep %setup -qn %{github_name}-%{github_commit} + +%build + : Create autoloader cat <<'AUTOLOAD' | tee src/Gliph/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 'Symfony/Component/ClassLoader/ClassLoader.php'; - } - - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} - -$fedoraClassLoader->addPrefix('Gliph\\', dirname(__DIR__)); - -return $fedoraClassLoader; +\Fedora\Autoloader\Autoload::addPsr4('Gliph\\', __DIR__); AUTOLOAD -%build -# Empty build section, nothing to build - - %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{phpdir} cp -rp src/* %{buildroot}%{phpdir}/ @@ -116,26 +102,26 @@ cp -rp src/* %{buildroot}%{phpdir}/ : Create tests bootstrap cat <<'BOOTSTRAP' | tee bootstrap.php <?php - -$fedoraClassLoader = - require_once '%{buildroot}%{phpdir}/Gliph/autoload.php'; - -$fedoraClassLoader->addPrefix(null, __DIR__ . '/tests'); +require_once '%{buildroot}%{phpdir}/Gliph/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr0('Gliph', __DIR__.'/tests'); BOOTSTRAP -: Run tests -%{_bindir}/phpunit --verbose --bootstrap ./bootstrap.php . +: 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 bootstrap.php . \ + || 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 @@ -144,6 +130,10 @@ rm -rf %{buildroot} %changelog +* Sun May 14 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.1.8-7 +- Switch autoloader to php-composer(fedora/autoloader) +- Test with SCLs if available + * Sat Jul 11 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 0.1.8-4 - Added missing autoloader require |