diff options
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | php-kdyby-events-autoload.php | 25 | ||||
-rw-r--r-- | php-kdyby-events.spec | 55 |
3 files changed, 45 insertions, 42 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-kdyby-events-autoload.php b/php-kdyby-events-autoload.php index 7f9fc3a..a83a6de 100644 --- a/php-kdyby-events-autoload.php +++ b/php-kdyby-events-autoload.php @@ -1,18 +1,11 @@ <?php -$vendor = '/usr/share/php'; +/* Autoloader for kdyby/events and its dependencies */ +require_once '/usr/share/php/Fedora/Autoloader/autoload.php'; -if (!isset($fedoraClassLoader) || !($fedoraClassLoader instanceof \Symfony\Component\ClassLoader\ClassLoader)) { - if (!class_exists('Symfony\\Component\\ClassLoader\\ClassLoader', false)) { - require_once $vendor . '/Symfony/Component/ClassLoader/ClassLoader.php'; - } - - $fedoraClassLoader = new \Symfony\Component\ClassLoader\ClassLoader(); - $fedoraClassLoader->register(); -} -$fedoraClassLoader->addPrefix('Kdyby\\Events\\', dirname(dirname(__DIR__))); -require_once __DIR__ . '/exceptions.php'; - -// Dependencies -require_once $vendor . '/Doctrine/Common/autoload.php'; -require_once $vendor . '/Nette/DI/autoload.php'; -require_once $vendor . '/Nette/Utils/autoload.php'; +\Fedora\Autoloader\Autoload::addPsr4('Kdyby\\Events\\', __DIR__); +\Fedora\Autoloader\Dependencies::required(array( + __DIR__ . '/exceptions.php', + '/usr/share/php/Doctrine/Common/autoload.php', + '/usr/share/php/Nette/DI/autoload.php', + '/usr/share/php/Nette/Utils/autoload.php', +)); diff --git a/php-kdyby-events.spec b/php-kdyby-events.spec index 76fd06e..c9836a3 100644 --- a/php-kdyby-events.spec +++ b/php-kdyby-events.spec @@ -18,7 +18,7 @@ Name: php-%{gh_owner}-%{gh_project} Version: 3.0.2 -%global specrel 1 +%global specrel 2 Release: %{?gh_date:0.%{specrel}.%{?prever}%{!?prever:%{gh_date}git%{gh_short}}}%{!?gh_date:%{specrel}}%{?dist} Summary: Events for Nette Framework @@ -35,15 +35,17 @@ Source2: %{name}-autoload.php # fix for nette/tester > 2 Patch0: %{name}-tester2.patch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch %if %{with_tests} BuildRequires: php-pcre BuildRequires: php-spl +BuildRequires: php-composer(nette/di) < 3 BuildRequires: php-composer(nette/di) >= 2.3 +BuildRequires: php-composer(nette/utils) < 3 BuildRequires: php-composer(nette/utils) >= 2.3 +BuildRequires: php-composer(doctrine/common) < 3 BuildRequires: php-composer(doctrine/common) >= 2.5.0 -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) # From composer.json, "require-dev": { # "nette/application": "~2.3@dev", # "nette/bootstrap": "~2.3@dev", @@ -69,10 +71,14 @@ BuildRequires: php-composer(symfony/class-loader) # "symfony/event-dispatcher": "~2.3|~3.0", # "nette/tester": "~1.4@", # The framework is enough as it requires everything +BuildRequires: php-composer(nette/nette) < 3 BuildRequires: php-composer(nette/nette) >= 2.3 BuildRequires: php-composer(nette/tester) >= 1.4 +BuildRequires: php-composer(symfony/event-dispatcher) < 4 BuildRequires: php-composer(symfony/event-dispatcher) >= 2.3 %endif +# Temporary workaround for doctrine +BuildRequires: php-symfony-class-loader # from composer.json, "require": { # "nette/di": "~2.3@dev", @@ -84,8 +90,9 @@ Requires: php-composer(nette/utils) < 3 # To avoid having to provide the compatibility layer # version 2.5.0 for autoloader Requires: php-composer(doctrine/common) >= 2.5.0 +Requires: php-composer(doctrine/common) < 3 # For autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # from phpcompatinfo report for version 2.4.0 Requires: php-pcre Requires: php-spl @@ -112,7 +119,6 @@ cp %{SOURCE2} src/%{ns_vendor}/%{ns_project}/autoload.php %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{php_home} cp -pr src/%{ns_vendor} %{buildroot}%{php_home}/%{ns_vendor} @@ -125,41 +131,35 @@ export LANG=fr_FR.utf8 mkdir vendor cat << 'EOF' | tee vendor/autoload.php <?php -require_once '%{php_home}/Tester/autoload.php'; -require_once '%{php_home}/Nette/autoload.php'; require_once '%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php'; +\Fedora\Autoloader\Dependencies::required(array( + '%{php_home}/Tester/autoload.php', + '%{php_home}/Nette/autoload.php', + array( + '%{php_home}/Symfony3/Component/EventDispatcher/autoload.php', + '%{php_home}/Symfony/Component/EventDispatcher/autoload.php', + ), +)); EOF php -r 'require "%{buildroot}%{php_home}/%{ns_vendor}/%{ns_project}/autoload.php";' +php -r 'require "vendor/autoload.php";' : Run test suite in sources tree -# remirepo:11 ret=0 -run=0 -if which php56; then - php56 %{_bindir}/nette-tester --colors 0 -p php56 -C tests/KdybyTests -s || ret=1 - run=1 -fi -if which php71; then - php71 %{_bindir}/nette-tester --colors 0 -p php71 -C tests/KdybyTests -s || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/nette-tester --colors 0 -p php -C tests/KdybyTests -s -# remirepo:2 -fi +# PHP 7.2, 2 failures +for cmd in php php56 php70 php71; do + if which $cmd; then + $cmd %{_bindir}/nette-tester --colors 0 -p $cmd -C tests/KdybyTests -s || ret=1 + fi +done exit $ret %else : Test suite disabled %endif -%clean -rm -rf %{buildroot} - - %files -%defattr(-,root,root,-) %{!?_licensedir:%global license %%doc} %license license.md %doc README.md @@ -168,6 +168,9 @@ rm -rf %{buildroot} %changelog +* Tue May 9 2017 Remi Collet <remi@fedoraproject.org> - 3.0.2-2 +- switch to fedora/autoloader + * Thu Aug 4 2016 Remi Collet <remi@fedoraproject.org> - 3.0.2-1 - update to 3.0.2 (for nette 2.4) |