summaryrefslogtreecommitdiffstats
path: root/php-stack-builder.spec
diff options
context:
space:
mode:
Diffstat (limited to 'php-stack-builder.spec')
-rw-r--r--php-stack-builder.spec113
1 files changed, 71 insertions, 42 deletions
diff --git a/php-stack-builder.spec b/php-stack-builder.spec
index 418379b..c569f78 100644
--- a/php-stack-builder.spec
+++ b/php-stack-builder.spec
@@ -2,7 +2,7 @@
#
# Fedora spec file for php-stack-builder
#
-# Copyright (c) 2015-2017 Shawn Iwinski <shawn.iwinski@gmail.com>
+# Copyright (c) 2015-2020 Shawn Iwinski <shawn.iwinski@gmail.com>
#
# License: MIT
# http://opensource.org/licenses/MIT
@@ -12,25 +12,21 @@
%global github_owner stackphp
%global github_name builder
-%global github_version 1.0.5
-%global github_commit fb3d136d04c6be41120ebf8c0cc71fe9507d750a
+%global github_version 1.0.6
+%global github_commit a4faaa6f532c6086bc66c29e1bc6c29593e1ca7c
%global composer_vendor stack
%global composer_project builder
-# "php": ">=5.3.0"
-%global php_min_ver 5.3.0
-# "silex/silex": "~1.0"
-%global silex_min_ver 1.0
-%global silex_max_ver 2.0
-# "symfony/http-foundation": ~2.1|~3.0|~4.0
-# "symfony/http-kernel": ~2.1|~3.0|~4.0
-# NOTE: Min version not 2.1 because autoloader required
-%if 0%{?fedora} >= 26
-%global symfony_max_ver 5.0
-%else
-%global symfony_max_ver 4
-%endif
+# "php": ">=7.2.0"
+%global php_min_ver 7.2.0
+# "symfony/http-foundation": "~2.1|~3.0|~4.0|~5.0"
+# "symfony/http-kernel": "~2.1|~3.0|~4.0|~5.0"
+# "symfony/routing": "^5.0"
+# NOTE: Forcing v3+ (i.e. dropping Symfony 2 interoperability)
+# NOTE: Loosening "symfony/routing" version (only a dev dependency and tests pass)
+%global symfony_min_ver 3.0
+%global symfony_max_ver 6.0
# Build using "--without tests" to disable tests
%global with_tests %{?_without_tests:0}%{!?_without_tests:1}
@@ -40,26 +36,32 @@
Name: php-%{composer_vendor}-%{composer_project}
Version: %{github_version}
Release: 1%{?github_release}%{?dist}
-Summary: Builder for stack middlewares based on HttpKernelInterface
+Summary: Builder for stack middleware based on HttpKernelInterface
-Group: Development/Libraries
License: MIT
URL: https://github.com/%{github_owner}/%{github_name}
Source0: %{url}/archive/%{github_commit}/%{name}-%{github_version}-%{github_commit}.tar.gz
+Patch0: %{name}-fix-tests-bootstrap-for-symfony-lt-5.patch
+
BuildArch: noarch
# Autoloader
BuildRequires: php-composer(theseer/autoload)
# Tests
%if %{with_tests}
-BuildRequires: php-composer(phpunit/phpunit)
+BuildRequires: phpunit8
## composer.json
BuildRequires: php(language) >= %{php_min_ver}
-BuildRequires: php-composer(silex/silex) < %{silex_max_ver}
-BuildRequires: php-composer(silex/silex) >= %{silex_min_ver}
-BuildRequires: php-composer(symfony/http-foundation) < %{symfony_max_ver}
-BuildRequires: php-composer(symfony/http-kernel) < %{symfony_max_ver}
-## phpcompatinfo (computed from version 1.0.5)
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+BuildRequires: (php-composer(symfony/routing) >= %{symfony_min_ver} with php-composer(symfony/routing) < %{symfony_max_ver})
+BuildRequires: (php-composer(symfony/http-foundation) >= %{symfony_min_ver} with php-composer(symfony/http-foundation) < %{symfony_max_ver})
+BuildRequires: (php-composer(symfony/http-kernel) >= %{symfony_min_ver} with php-composer(symfony/http-kernel) < %{symfony_max_ver})
+%else
+BuildRequires: php-symfony3-routing
+BuildRequires: php-symfony3-http-foundation
+BuildRequires: php-symfony3-http-kernel
+%endif
+## phpcompatinfo (computed from version 1.0.6)
BuildRequires: php-reflection
BuildRequires: php-spl
## Autoloader
@@ -68,9 +70,14 @@ BuildRequires: php-composer(fedora/autoloader)
# composer.json
Requires: php(language) >= %{php_min_ver}
-Requires: php-composer(symfony/http-foundation) < %{symfony_max_ver}
-Requires: php-composer(symfony/http-kernel) < %{symfony_max_ver}
-# phpcompatinfo (computed from version 1.0.5)
+%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8
+Requires: (php-composer(symfony/http-foundation) >= %{symfony_min_ver} with php-composer(symfony/http-foundation) < %{symfony_max_ver})
+Requires: (php-composer(symfony/http-kernel) >= %{symfony_min_ver} with php-composer(symfony/http-kernel) < %{symfony_max_ver})
+%else
+Requires: php-symfony3-http-foundation
+Requires: php-symfony3-http-kernel
+%endif
+# phpcompatinfo (computed from version 1.0.6)
Requires: php-reflection
Requires: php-spl
# Autoloader
@@ -91,6 +98,9 @@ Autoloader: %{phpdir}/Stack/autoload-builder.php
%prep
%setup -qn %{github_name}-%{github_commit}
+cp tests/bootstrap.php tests/bootstrap.symfony5.php
+%patch0 -p1
+
%build
: Generate autoloader
@@ -100,41 +110,53 @@ cat <<'AUTOLOAD' | tee -a src/Stack/autoload-builder.php
require_once '%{phpdir}/Fedora/Autoloader/autoload.php';
-\Fedora\Autoloader\Dependencies::required(array(
- array(
+\Fedora\Autoloader\Dependencies::required([
+ [
+ '%{phpdir}/Symfony5/Component/HttpFoundation/autoload.php',
'%{phpdir}/Symfony4/Component/HttpFoundation/autoload.php',
'%{phpdir}/Symfony3/Component/HttpFoundation/autoload.php',
- '%{phpdir}/Symfony/Component/HttpFoundation/autoload.php',
- ),
- array(
+ ],
+ [
+ '%{phpdir}/Symfony5/Component/HttpKernel/autoload.php',
'%{phpdir}/Symfony4/Component/HttpKernel/autoload.php',
'%{phpdir}/Symfony3/Component/HttpKernel/autoload.php',
- '%{phpdir}/Symfony/Component/HttpKernel/autoload.php',
- ),
-));
+ ],
+]);
AUTOLOAD
%install
mkdir -p %{buildroot}%{phpdir}
-cp -rp src/* %{buildroot}%{phpdir}/
+cp -rp src/Stack %{buildroot}%{phpdir}/
%check
%if %{with_tests}
-: Create tests bootstrap
-cat <<'BOOTSTRAP' | tee bootstrap.php
+: Create mock Composer autoloader
+mkdir vendor
+cat <<'BOOTSTRAP' | tee vendor/autoload.php
<?php
require_once '%{buildroot}%{phpdir}/Stack/autoload-builder.php';
-require_once '%{phpdir}/Silex/autoload.php';
+
+\Fedora\Autoloader\Dependencies::required([
+ [
+ '%{phpdir}/Symfony5/Component/Routing/autoload.php',
+ '%{phpdir}/Symfony4/Component/Routing/autoload.php',
+ '%{phpdir}/Symfony3/Component/Routing/autoload.php',
+ ],
+]);
BOOTSTRAP
+: If Symfony 5 then use unpatched bootstrap
+[ -e "%{phpdir}/Symfony5/Component/HttpKernel/autoload.php" ] \
+ && mv tests/bootstrap.symfony5.php tests/bootstrap.php
+
: Upstream tests
RETURN_CODE=0
-PHPUNIT=$(which phpunit)
-for PHP_EXEC in "" %{?rhel:php54 php55} php56 php70 php71 php72; do
+PHPUNIT=$(which phpunit8)
+for PHP_EXEC in "" php72 php73 php74; do
if [ -z "$PHP_EXEC" ] || which $PHP_EXEC; then
- $PHP_EXEC $PHPUNIT --verbose --bootstrap bootstrap.php || RETURN_CODE=1
+ $PHP_EXEC $PHPUNIT --testsuite unit --verbose || RETURN_CODE=1
fi
done
exit $RETURN_CODE
@@ -155,6 +177,13 @@ exit $RETURN_CODE
%changelog
+* Wed Feb 26 2020 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.0.6-1
+- Update to 1.0.6 (RHBZ #1796631)
+- Drop Symfony 2 interoperability
+- Patch tests boostrap to run with Symfony >=5 and <5
+- Use range dependencies
+- Use PHPUnit 8
+
* Wed Dec 13 2017 Shawn Iwinski <shawn.iwinski@gmail.com> - 1.0.5-1
- Update to 1.0.5 (RHBZ #1514861)
- Fix autoloader for multiple versions of Symfony