diff options
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | php-symfony-security-acl.spec | 107 |
2 files changed, 59 insertions, 56 deletions
diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc9aa8c --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +clog +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/php-symfony-security-acl.spec b/php-symfony-security-acl.spec index 7a0c1b1..6e5f86f 100644 --- a/php-symfony-security-acl.spec +++ b/php-symfony-security-acl.spec @@ -22,7 +22,8 @@ %global php_min_ver 5.3.9 # "symfony/phpunit-bridge": "~2.7|~3.0.0" # "symfony/security-core": "~2.4|~3.0.0" -%global symfony_min_ver 2.7 +# NOTE: Min version not 2.7 because autoloader required +%global symfony_min_ver 2.7.1 %global symfony_max_ver 4.0 # "doctrine/common": "~2.2" # NOTE: Min version not 2.2 because autoloader required @@ -34,7 +35,7 @@ %global doctrine_dbal_max_ver 3.0 # "psr/log": "~1.0" # NOTE: Min version not 1.0 because autoloader required -%global psr_log_min_ver 1.0.0-8 +%global psr_log_min_ver 1.0.1 %global psr_log_max_ver 2.0 %global bootstrap 0 @@ -50,7 +51,7 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 4%{?github_release}%{?dist} Summary: Symfony Security Component - ACL (Access Control List) Group: Development/Libraries @@ -59,23 +60,25 @@ URL: https://github.com/%{github_owner}/%{github_name} Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz BuildArch: noarch -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) # Tests %if %{with_tests} ## composer.json BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(doctrine/common) < %{doctrine_common_max_ver} BuildRequires: php-composer(doctrine/common) >= %{doctrine_common_min_ver} +BuildRequires: php-composer(doctrine/dbal) < %{doctrine_dbal_max_ver} BuildRequires: php-composer(doctrine/dbal) >= %{doctrine_dbal_min_ver} BuildRequires: php-composer(phpunit/phpunit) -#BuildRequires: php-composer(psr/log) >= %%{psr_log_min_ver} -BuildRequires: php-PsrLog >= %{psr_log_min_ver} +BuildRequires: php-composer(psr/log) < %{psr_log_max_ver} +BuildRequires: php-composer(psr/log) >= %{psr_log_min_ver} +BuildRequires: php-composer(symfony/security-core) < %{symfony_max_ver} BuildRequires: php-composer(symfony/security-core) >= %{symfony_min_ver} ## phpcompatinfo (computed from version 2.8.0) BuildRequires: php-pcre BuildRequires: php-reflection BuildRequires: php-spl ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json @@ -87,19 +90,13 @@ Requires: php-pcre Requires: php-reflection Requires: php-spl # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # Weak dependencies %if 0%{?fedora} >= 21 Suggests: php-composer(doctrine/dbal) -%endif -Conflicts: php-doctrine-dbal < %{doctrine_dbal_min_ver} -Conflicts: php-doctrine-dbal >= %{doctrine_dbal_max_ver} -%if 0%{?fedora} >= 21 Suggests: php-composer(symfony/finder) %endif -Conflicts: php-symfony-finder < %{symfony_min_ver} -Conflicts: php-symfony-finder >= %{symfony_max_ver} # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -116,47 +113,38 @@ Autoloader: %{phpdir}/Symfony/Component/Security/Acl/autoload.php %prep %setup -qn %{github_name}-%{github_commit} + +%build : Create autoloader cat <<'AUTOLOAD' | tee autoload.php <?php /** * Autoloader for %{name} and its' dependencies * (created by %{name}-%{version}-%{release}). - * - * @return \Symfony\Component\ClassLoader\ClassLoader */ - -if (!isset($fedoraPsr4ClassLoader) || !($fedoraPsr4ClassLoader instanceof \Symfony\Component\ClassLoader\Psr4ClassLoader)) { - if (!class_exists('Symfony\\Component\\ClassLoader\\Psr4ClassLoader', false)) { - require_once '%{phpdir}/Symfony/Component/ClassLoader/Psr4ClassLoader.php'; - } - - $fedoraPsr4ClassLoader = new \Symfony\Component\ClassLoader\Psr4ClassLoader(); - $fedoraPsr4ClassLoader->register(true); -} - -$fedoraPsr4ClassLoader->addPrefix('Symfony\\Component\\Security\\Acl\\', __DIR__); - -// Dependencies (autoloader => required) -foreach(array( - '%{phpdir}/Doctrine/DBAL/autoload.php' => false, - '%{phpdir}/Symfony/Component/Finder/autoload.php' => false, - '%{phpdir}/Symfony/Component/Security/autoload.php' => true, -) as $dependencyAutoloader => $required) { - if ($required || file_exists($dependencyAutoloader)) { - require_once $dependencyAutoloader; - } -} +require_once '%{phpdir}/Fedora/Autoloader/autoload.php'; + +\Fedora\Autoloader\Autoload::addPsr4('Symfony\\Component\\Security\\Acl\\', __DIR__); + +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Doctrine/DBAL/autoload.php', + array( + '%{phpdir}/Symfony3/Component/Security/autoload.php', + '%{phpdir}/Symfony/Component/Security/autoload.php', + ), +)); + +\Fedora\Autoloader\Dependencies::optional(array( + '%{phpdir}/Doctrine/DBAL/autoload.php', + array( + '%{phpdir}/Symfony3/Component/Finder/autoload.php', + '%{phpdir}/Symfony/Component/Finder/autoload.php', + ), +)); AUTOLOAD -%build -# Empty build section, nothing to build - - %install -rm -rf %{buildroot} - mkdir -p %{buildroot}%{phpdir}/Symfony/Component/Security/Acl cp -rp * %{buildroot}%{phpdir}/Symfony/Component/Security/Acl/ @@ -168,26 +156,27 @@ cat <<'BOOTSTRAP' | tee bootstrap.php <?php require_once '%{buildroot}%{phpdir}/Symfony/Component/Security/Acl/autoload.php'; -require_once '%{phpdir}/Doctrine/Common/autoload.php'; -require_once '%{phpdir}/Psr/Log/autoload.php'; +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Doctrine/Common/autoload.php', + '%{phpdir}/Psr/Log/autoload.php', +)); BOOTSTRAP -%{_bindir}/phpunit --verbose --bootstrap bootstrap.php - -if which php70; then - php70 %{_bindir}/phpunit --verbose --bootstrap bootstrap.php -fi +: 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 @@ -201,6 +190,12 @@ rm -rf %{buildroot} %changelog +* Thu Sep 21 2017 Shawn Iwinski <shawn@iwin.ski> - 2.8.0-4 +- Add max versions to BuildRequires +- Switch autoloader to fedora/autoloader +- Remove Conflicts for Suggests +- Test with SCLs if available + * Tue May 31 2016 Remi Collet <remi@remirepo.net> - 2.8.0-1 - add backport stuff for remi repository |