From c27adbff7d45f3c991532f1c4d8414521b56015a Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 15 Mar 2016 15:29:56 +0100 Subject: php-Faker: sync with Fedora --- php-Faker.spec | 96 ++++++++++++++++++++++++++++++++++++++++++---------------- 1 file 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 +# Copyright (c) 2012-2016 Shawn Iwinski # # 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 +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 - 1.5.0-5 +- Add standard "php-{COMPOSER_VENDOR}-{COMPOSER_PROJECT}" provides +- Updated autoloader + +* Fri Mar 11 2016 Remi Collet - 1.5.0-4 +- skip tests with erratic results in Koschei + * Sat May 30 2015 Shawn Iwinski - 1.5.0-1 - Updated to 1.5.0 (BZ #1226339) - Packaged autoloader -- cgit