diff options
author | Remi Collet <fedora@famillecollet.com> | 2016-03-15 15:29:56 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2016-03-15 15:29:56 +0100 |
commit | c27adbff7d45f3c991532f1c4d8414521b56015a (patch) | |
tree | eee86d7fff11891dd8231c8c192fd74d42e3cf77 | |
parent | 3a46eadef2b537d416dcff0ceb0c9d139e5978f0 (diff) |
php-Faker: sync with Fedora
-rw-r--r-- | php-Faker.spec | 96 |
1 files changed, 70 insertions, 26 deletions
diff --git a/php-Faker.spec b/php-Faker.spec index 56c62e0..abff111 100644 --- a/php-Faker.spec +++ b/php-Faker.spec @@ -1,8 +1,8 @@ # remirepo spec file for php-Faker, from Fedora: # -# RPM spec file for php-Faker +# Fedora spec file for php-Faker # -# Copyright (c) 2012-2015 Shawn Iwinski <shawn.iwinski@gmail.com> +# Copyright (c) 2012-2016 Shawn Iwinski <shawn.iwinski@gmail.com> # # License: MIT # http://opensource.org/licenses/MIT @@ -10,22 +10,25 @@ # Please preserve changelog entries # -%global github_owner fzaninotto -%global github_name Faker -%global github_version 1.5.0 -%global github_commit d0190b156bcca848d401fb80f31f504f37141c8d +%global github_owner fzaninotto +%global github_name Faker +%global github_version 1.5.0 +%global github_commit d0190b156bcca848d401fb80f31f504f37141c8d + +%global composer_vendor fzaninotto +%global composer_project faker # "php": ">=5.3.3" -%global php_min_ver 5.3.3 +%global php_min_ver 5.3.3 # Build using "--without tests" to disable tests -%global with_tests %{?_without_tests:0}%{!?_without_tests:1} +%global with_tests %{?_without_tests:0}%{!?_without_tests:1} %{!?phpdir: %global phpdir %{_datadir}/php} Name: php-%{github_name} Version: %{github_version} -Release: 1%{?dist} +Release: 5%{?dist} Summary: A PHP library that generates fake data Group: Development/Libraries @@ -35,13 +38,11 @@ Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{githu BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch -# Autoload generation -BuildRequires: %{_bindir}/phpab # Tests %if %{with_tests} ## composer.json -BuildRequires: %{_bindir}/phpunit BuildRequires: php(language) >= %{php_min_ver} +BuildRequires: php-composer(phpunit/phpunit) ## phpcompatinfo (computed from version 1.5.0) BuildRequires: php-curl BuildRequires: php-date @@ -52,13 +53,15 @@ BuildRequires: php-mbstring BuildRequires: php-pcre BuildRequires: php-reflection BuildRequires: php-spl +## Autoloader +BuildRequires: php-composer(symfony/class-loader) %endif # composer.json Requires: php(language) >= %{php_min_ver} # composer.json: optional Requires: php-intl -# phpcompatinfo (computed from version 1.4.0) +# phpcompatinfo (computed from version 1.5.0) Requires: php-curl Requires: php-date Requires: php-hash @@ -66,8 +69,17 @@ Requires: php-mbstring Requires: php-pcre Requires: php-reflection Requires: php-spl +# Autoloader +Requires: php-composer(symfony/class-loader) +# Weak dependencies +%if 0%{?fedora} >= 21 +Suggests: php-composer(doctrine/orm) +%endif -Provides: php-composer(fzaninotto/faker) = %{version} +# php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT} +Provides: php-%{composer_vendor}-%{composer_project} = %{version}-%{release} +# Composer +Provides: php-composer(%{composer_vendor}/%{composer_project}) = %{version} %description Faker is a PHP library that generates fake data for you. Whether you need @@ -77,6 +89,8 @@ service, Faker is for you. Faker is heavily inspired by Perl's Data::Faker [1], and by Ruby's Faker [2]. +Autoloader: %{phpdir}/Faker/autoload.php + Optional: * CakePHP (http://cakephp.org/) * Doctrine ORM (php-doctrine-orm) @@ -99,20 +113,33 @@ chmod a-x \ src/Faker/Provider/sl_SI/PhoneNumber.php \ test/Faker/Provider/ja_JP/PersonTest.php +: Create autoloader +cat <<'AUTOLOAD' | tee src/Faker/autoload.php +<?php +/** + * Autoloader for %{name} and its' dependencies + * (created by %{name}-%{version}-%{release}). + * + * @return \Symfony\Component\ClassLoader\ClassLoader + */ -%build -: Generate autoloader -%{_bindir}/phpab --nolower --output src/Faker/autoload.php src/Faker +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(); +} -(cat <<'AUTOLOAD' +$fedoraClassLoader->addPrefix('Faker\\', dirname(__DIR__)); -// TODO: Add optional package autoloaders from their packages when they are available -spl_autoload_register(function ($class) { - $src = str_replace('\\', '/', $class) . '.php'; - @include_once $src; -}); +return $fedoraClassLoader; AUTOLOAD -) | tee -a src/Faker/autoload.php + + +%build +# Empty build section, nothing to build %install @@ -126,8 +153,18 @@ cp -rp src/%{github_name} %{buildroot}%{phpdir}/ : Skip tests that require downloading content sed 's/function testDownloadWithDefaults/function SKIP_testDownloadWithDefaults/' \ -i test/Faker/Provider/ImageTest.php - -%{_bindir}/phpunit --bootstrap %{buildroot}%{phpdir}/Faker/autoload.php +: Skip tests with erratic results in Koschei +sed -e '/561059108101825/d' \ + -e '/601100099013942/d' \ + -i test/Faker/Calculator/LuhnTest.php + +%{_bindir}/phpunit --verbose \ + --bootstrap %{buildroot}%{phpdir}/Faker/autoload.php + +if which php70; then + php70 %{_bindir}/phpunit --verbose \ + --bootstrap %{buildroot}%{phpdir}/Faker/autoload.php +fi %else : Tests skipped %endif @@ -146,6 +183,13 @@ rm -rf %{buildroot} %changelog +* Sat Mar 12 2016 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.5.0-5 +- Add standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" provides +- Updated autoloader + +* Fri Mar 11 2016 Remi Collet <remi@fedoraproject.org> - 1.5.0-4 +- skip tests with erratic results in Koschei + * Sat May 30 2015 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.5.0-1 - Updated to 1.5.0 (BZ #1226339) - Packaged autoloader |