diff options
author | Remi Collet <remi@remirepo.net> | 2017-05-15 15:24:41 +0200 |
---|---|---|
committer | Remi Collet <remi@remirepo.net> | 2017-05-15 15:24:41 +0200 |
commit | dfc869e23a4e53b8684d31dc70a3a3e5031a6b9b (patch) | |
tree | 456d681455b6222db052b34d0ce3ca01dc938579 | |
parent | 532c8182f1a4ab704994a8836f1ff7782daae419 (diff) |
sync with Fedora
-rw-r--r-- | .gitignore | 7 | ||||
-rw-r--r-- | php-egulias-email-validator.spec | 80 |
2 files changed, 37 insertions, 50 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-egulias-email-validator.spec b/php-egulias-email-validator.spec index ad68aac..b65c679 100644 --- a/php-egulias-email-validator.spec +++ b/php-egulias-email-validator.spec @@ -2,7 +2,7 @@ # # Fedora spec file for php-egulias-email-validator # -# Copyright (c) 2014-2016 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2014-2017 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -32,7 +32,7 @@ Name: php-%{composer_vendor}-%{composer_project} Version: %{github_version} -Release: 1%{?github_release}%{?dist} +Release: 3%{?github_release}%{?dist} Summary: A library for validating emails Group: Development/Libraries @@ -40,27 +40,26 @@ 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 BuildArch: noarch # Tests %if %{with_tests} BuildRequires: php-composer(phpunit/phpunit) ## composer.json -BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(doctrine/lexer) < %{doctrine_lexer_max_ver} #BuildRequires: php-composer(doctrine/lexer) >= %%{doctrine_lexer_min_ver} BuildRequires: php-doctrine-lexer >= %{doctrine_lexer_min_ver} -BuildRequires: php-composer(doctrine/lexer) < %{doctrine_lexer_max_ver} ## phpcompatinfo (computed from version 1.2.13) BuildRequires: php-filter BuildRequires: php-pcre BuildRequires: php-reflection BuildRequires: php-spl ## Autoloader -BuildRequires: php-composer(symfony/class-loader) +BuildRequires: php-composer(fedora/autoloader) %endif # composer.json -Requires: php(language) >= %{php_min_ver} +Requires: php(language) >= %{php_min_ver} #Requires: php-composer(doctrine/lexer) >= %%{doctrine_lexer_min_ver} Requires: php-doctrine-lexer >= %{doctrine_lexer_min_ver} Requires: php-composer(doctrine/lexer) < %{doctrine_lexer_max_ver} @@ -69,7 +68,7 @@ Requires: php-pcre Requires: php-reflection Requires: php-spl # Autoloader -Requires: php-composer(symfony/class-loader) +Requires: php-composer(fedora/autoloader) # Composer Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} @@ -83,40 +82,27 @@ Autoloader: %{phpdir}/Egulias/EmailValidator/autoload.php %prep %setup -qn %{github_name}-%{github_commit} + +%build + : Create autoloader cat <<'AUTOLOAD' | tee src/Egulias/EmailValidator/autoload.php <?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('Egulias\\EmailValidator\\', dirname(dirname(__DIR__))); +\Fedora\Autoloader\Autoload::addPsr4('Egulias\\EmailValidator\\', __DIR__); -// Required dependency -require_once '%{phpdir}/Doctrine/Common/Lexer/autoload.php'; - -return $fedoraClassLoader; +\Fedora\Autoloader\Dependencies::required(array( + '%{phpdir}/Doctrine/Common/Lexer/autoload.php', +)); AUTOLOAD -%build -# Empty build section, nothing required - - %install -rm -rf %{buildroot} mkdir -p %{buildroot}%{phpdir} cp -rp src/* %{buildroot}%{phpdir}/ @@ -130,33 +116,23 @@ sed -e 's/function testValidEmailsWithWarningsCheck/function SKIP_testValidEmail -e 's/function testInvalidEmailsWithDnsCheckAndStrictMode/function SKIP_testInvalidEmailsWithDnsCheckAndStrictMode/' \ -i tests/egulias/Tests/EmailValidator/EmailValidatorTest.php -: Run tests -ret=0 -run=0 -if which php71; then - php71 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/Egulias/EmailValidator/autoload.php || ret=1 - run=1 -fi -if which php56; then - php56 %{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/Egulias/EmailValidator/autoload.php || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then - %{_bindir}/phpunit --verbose \ - --bootstrap %{buildroot}%{phpdir}/Egulias/EmailValidator/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}/Egulias/EmailValidator/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 README.md @@ -166,6 +142,10 @@ rm -rf %{buildroot} %changelog +* Sun May 14 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.13-3 +- Switch autoloader to php-composer(fedora/autoloader) +- Test with SCLs if available + * Mon Aug 08 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.2.13-1 - Updated to 1.2.13 (RHBZ #1336594) |