diff options
author | Remi Collet <remi@remirepo.net> | 2017-05-14 17:53:46 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-05-14 17:53:46 +0200 |
commit | b4b249fdce9f54520d9cecf6da32330622d367a0 (patch) | |
tree | 81ec6de8fe3e6de9c424a6556d4763ee2c91531b | |
parent | 35f197b70efb1e8901730dc2ad04c37cd93c722a (diff) |
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | php-dnoegel-php-xdg-base-dir.spec | 62 |
2 files changed, 28 insertions, 41 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1ab5c4f --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/php-dnoegel-php-xdg-base-dir.spec b/php-dnoegel-php-xdg-base-dir.spec index 4357ed6..c9eb83c 100644 --- a/php-dnoegel-php-xdg-base-dir.spec +++ b/php-dnoegel-php-xdg-base-dir.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-dnoegel-php-xdg-base-dir # -# Copyright (c) 2016 Shawn Iwinski <shawn@iwin.ski> +# Copyright (c) 2016-2017 Shawn Iwinski <shawn@iwin.ski> # # License: MIT # http://opensource.org/licenses/MIT @@ -28,7 +28,7 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 3%{?github_release}%{?dist} Summary: Implementation of the XDG Base Directory Specification for PHP Group: Development/Libraries @@ -36,7 +36,6 @@ License: MIT 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} @@ -46,7 +45,7 @@ BuildRequires: php-composer(phpunit/phpunit) ## phpcompatinfo (computed from version 0.1) 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 0.1) Requires: php-spl # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -76,28 +75,14 @@ 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('XdgBaseDir\\', dirname(__DIR__)); - -return $fedoraClassLoader; +\Fedora\Autoloader\Autoload::addPsr4('XdgBaseDir\\', __DIR__); AUTOLOAD %install -rm -rf %{buildroot} - mkdir -p %{buildroot}%{phpdir}/XdgBaseDir cp -rp src/* %{buildroot}%{phpdir}/XdgBaseDir/ @@ -111,32 +96,23 @@ sed 's#rmdir\($runtimeDir\);#rmdir($runtimeDir); echo PHP_EOL,">>>>> runtimeDir= sed 's/function testGetRuntimeShouldDeleteDirsWithWrongPermission/function SKIP_testGetRuntimeShouldDeleteDirsWithWrongPermission/' \ -i tests/XdgTest.php -run=0 -ret=0 -if which php56; then - php56 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/XdgBaseDir/autoload.php || ret=1 - run=1 -fi -if which php71; then - php71 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/XdgBaseDir/autoload.php || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then - %{_bindir}/phpunit --verbose \ - --bootstrap %{buildroot}%{phpdir}/XdgBaseDir/autoload.php -fi -exit $ret +: 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}/XdgBaseDir/autoload.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 @@ -145,6 +121,10 @@ rm -rf %{buildroot} %changelog +* Fri May 12 2017 Shawn Iwinski <shawn@iwin.ski> - 0.1-3 +- Switch autoloader to php-composer(fedora/autoloader) +- Test with SCLs if available + * Thu Jul 21 2016 Remi Collet <remi@fedoraproject.org> - 0.1-1 - backport for remi repository |