summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-phpspec.spec63
-rw-r--r--phpspec-autoload.php8
2 files changed, 41 insertions, 30 deletions
diff --git a/php-phpspec.spec b/php-phpspec.spec
index 6f0153f..52ee67d 100644
--- a/php-phpspec.spec
+++ b/php-phpspec.spec
@@ -12,9 +12,21 @@
%global gh_project phpspec
#global prever beta3
+# Only allow a single Symfony version
+# to ensure components consistency
+%if 0%{?fedora} > 26
+%global symfony_ns Symfony3
+%global symfony_min 3.0
+%global symfony_max 4
+%else
+%global symfony_ns Symfony
+%global symfony_min 2.7
+%global symfony_max 3
+%endif
+
Name: php-phpspec
Version: 3.3.0
-Release: 2%{?dist}
+Release: 3%{?dist}
Summary: Specification-oriented BDD framework for PHP
Group: Development/Libraries
@@ -32,16 +44,16 @@ BuildRequires: php-composer(phpspec/prophecy) < 2
BuildRequires: php-composer(phpspec/prophecy) >= 1.5
BuildRequires: php-composer(phpspec/php-diff) < 2
BuildRequires: php-composer(phpspec/php-diff) >= 1.0.0
-BuildRequires: php-composer(symfony/console) < 4
-BuildRequires: php-composer(symfony/console) >= 3
-BuildRequires: php-composer(symfony/event-dispatcher) < 4
-BuildRequires: php-composer(symfony/event-dispatcher) >= 3
-BuildRequires: php-composer(symfony/finder) < 4
-BuildRequires: php-composer(symfony/finder) >= 3
-BuildRequires: php-composer(symfony/process) < 4
-BuildRequires: php-composer(symfony/process) >= 3
-BuildRequires: php-composer(symfony/yaml) < 4
-BuildRequires: php-composer(symfony/yaml) >= 3
+BuildRequires: php-composer(symfony/console) < %{symfony_max}
+BuildRequires: php-composer(symfony/console) >= %{symfony_min}
+BuildRequires: php-composer(symfony/event-dispatcher) < %{symfony_max}
+BuildRequires: php-composer(symfony/event-dispatcher) >= %{symfony_min}
+BuildRequires: php-composer(symfony/finder) < %{symfony_max}
+BuildRequires: php-composer(symfony/finder) >= %{symfony_min}
+BuildRequires: php-composer(symfony/process) < %{symfony_max}
+BuildRequires: php-composer(symfony/process) >= %{symfony_min}
+BuildRequires: php-composer(symfony/yaml) < %{symfony_max}
+BuildRequires: php-composer(symfony/yaml) >= %{symfony_min}
BuildRequires: php-composer(doctrine/instantiator) < 2
BuildRequires: php-composer(doctrine/instantiator) >= 1.0.1
# From composer.json, require-dev
@@ -49,7 +61,8 @@ BuildRequires: php-composer(doctrine/instantiator) >= 1.0.1
# "symfony/filesystem": "^3.0",
# "phpunit/phpunit": "^5.5|^6.0",
# "ciaranmcnulty/versionbasedtestskipper": "^0.2.1"
-BuildRequires: php-composer(symfony/filesystem) >= 3
+BuildRequires: php-composer(symfony/filesystem) < %{symfony_max}
+BuildRequires: php-composer(symfony/filesystem) >= %{symfony_min}
%if 0%{?fedora} >= 26
BuildRequires: php-composer(sebastian/exporter) < 4
%global phpunit %{_bindir}/phpunit6
@@ -84,16 +97,16 @@ Requires: php-composer(sebastian/exporter) < 4
%else
Requires: php-composer(sebastian/exporter) < 3
%endif
-Requires: php-composer(symfony/console) >= 2.7
-Requires: php-composer(symfony/console) < 4
-Requires: php-composer(symfony/event-dispatcher) >= 2.7
-Requires: php-composer(symfony/event-dispatcher) < 4
-Requires: php-composer(symfony/finder) >= 2.7
-Requires: php-composer(symfony/finder) < 4
-Requires: php-composer(symfony/process) >= 2.7
-Requires: php-composer(symfony/process) < 4
-Requires: php-composer(symfony/yaml) >= 2.7
-Requires: php-composer(symfony/yaml) < 4
+Requires: php-composer(symfony/console) < %{symfony_max}
+Requires: php-composer(symfony/console) >= %{symfony_min}
+Requires: php-composer(symfony/event-dispatcher) < %{symfony_max}
+Requires: php-composer(symfony/event-dispatcher) >= %{symfony_min}
+Requires: php-composer(symfony/finder) < %{symfony_max}
+Requires: php-composer(symfony/finder) >= %{symfony_min}
+Requires: php-composer(symfony/process) < %{symfony_max}
+Requires: php-composer(symfony/process) >= %{symfony_min}
+Requires: php-composer(symfony/yaml) < %{symfony_max}
+Requires: php-composer(symfony/yaml) >= %{symfony_min}
Requires: php-composer(doctrine/instantiator) >= 1.0.1
Requires: php-composer(doctrine/instantiator) < 2
Requires: php-tokenizer
@@ -128,7 +141,8 @@ refactor this code.
%patch0 -p0 -b .rpm
-cp %{SOURCE1} src/PhpSpec/autoload.php
+sed -e 's/@SYMFONY@/%{symfony_ns}/' \
+ %{SOURCE1} > src/PhpSpec/autoload.php
%build
@@ -198,6 +212,9 @@ fi
%changelog
+* Thu May 11 2017 Remi Collet <remi@remirepo.net> - 3.3.0-3
+- only allow a single Symfony version
+
* Mon May 8 2017 Remi Collet <remi@remirepo.net> - 3.3.0-2
- fix autoloader for Symfony 3
- always use symfony 3 during the build (per upstream)
diff --git a/phpspec-autoload.php b/phpspec-autoload.php
index f8fae7e..1fbcc5d 100644
--- a/phpspec-autoload.php
+++ b/phpspec-autoload.php
@@ -4,13 +4,7 @@
require_once '/usr/share/php/Fedora/Autoloader/autoload.php';
\Fedora\Autoloader\Autoload::addPsr4('PhpSpec\\', __DIR__);
-if ($f = stream_resolve_include_path('Symfony3/Component/Console/Application.php')) {
- \Fedora\Autoloader\Autoload::addPsr4('Symfony\\Component\\', dirname(dirname($f)));
-} else if ($f = stream_resolve_include_path('Symfony/Component/Console/Application.php')) {
- \Fedora\Autoloader\Autoload::addPsr4('Symfony\\Component\\', dirname(dirname($f)));
-} else {
- die("Can't find Symfony Framework\n");
-}
+\Fedora\Autoloader\Autoload::addPsr4('Symfony\\Component\\', '/usr/share/php/@SYMFONY@/Component');
/* spec tree in current dir, when exists */
if (is_dir(getcwd().'/spec')) {