summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2012-10-30 20:14:06 +0100
committerRemi Collet <fedora@famillecollet.com>2012-10-30 20:14:06 +0100
commit318a6670076ef24521a0d410cfa9c847340c52a2 (patch)
treea6ba7fdf9bd2d96a36635ffaeba6694575e4d078
parenteecb2eb0fd1202777dcf49d6c563fd276f334cb4 (diff)
php-symfony2-Routing: sync with rawhide, update to 2.1.3
-rw-r--r--bootstrap.php24
-rw-r--r--php-symfony2-Routing-tests-bootstrap.patch24
-rw-r--r--php-symfony2-Routing.spec86
3 files changed, 90 insertions, 44 deletions
diff --git a/bootstrap.php b/bootstrap.php
deleted file mode 100644
index 329fef2..0000000
--- a/bootstrap.php
+++ /dev/null
@@ -1,24 +0,0 @@
-<?php
-
-/*
- * This file is part of the Symfony package.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *
- * For the full copyright and license information, please view the LICENSE
- * file that was distributed with this source code.
- */
-
-date_default_timezone_set('UTC');
-spl_autoload_register(function ($class) {
- if (0 === strpos(ltrim($class, '/'), 'Symfony\Component')) {
- $file = substr(str_replace('\\', '/', $class), strlen('Symfony\Component')).'.php';
- if (file_exists(__DIR__.'/../..'.$file)) {
- # Run from source tree
- require_once __DIR__.'/../..'.$file;
- } else {
- # Run from install dir
- require_once 'Symfony/Component'.$file;
- }
- }
-});
diff --git a/php-symfony2-Routing-tests-bootstrap.patch b/php-symfony2-Routing-tests-bootstrap.patch
new file mode 100644
index 0000000..d828fed
--- /dev/null
+++ b/php-symfony2-Routing-tests-bootstrap.patch
@@ -0,0 +1,24 @@
+--- Symfony/Component/Routing/Tests/bootstrap.php 2012-09-20 03:42:17.000000000 -0400
++++ Symfony/Component/Routing/Tests/bootstrap.php 2012-10-23 20:45:45.429166397 -0400
+@@ -10,9 +10,18 @@
+ */
+
+ spl_autoload_register(function ($class) {
+- if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\Routing')) {
+- if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\Routing')).'.php')) {
+- require_once $file;
++ if (0 === strpos(ltrim($class, '/'), 'Symfony\Component')) {
++ $file = substr(str_replace('\\', '/', $class), strlen('Symfony\Component')).'.php';
++ if (file_exists(__DIR__.'/../..'.$file)) {
++ // Load from source tree
++ require_once __DIR__.'/../..'.$file;
++ } else {
++ try {
++ // Try loading from incude path
++ require_once 'Symfony/Component'.$file;
++ } catch (Exception $e) {
++ // Fail silently so class not found fatal error still raised
++ }
+ }
+ }
+ });
diff --git a/php-symfony2-Routing.spec b/php-symfony2-Routing.spec
index fe3618c..41b4109 100644
--- a/php-symfony2-Routing.spec
+++ b/php-symfony2-Routing.spec
@@ -1,11 +1,14 @@
-%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
+%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
%global pear_channel pear.symfony.com
%global pear_name %(echo %{name} | sed -e 's/^php-symfony2-//' -e 's/-/_/g')
+%global php_min_ver 5.3.3
+# Requires HttpKernel to run tests, but this package's build order is before
+%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
Name: php-symfony2-Routing
-Version: 2.1.2
+Version: 2.1.3
Release: 1%{?dist}
Summary: Symfony2 %{pear_name} Component
@@ -13,18 +16,30 @@ Group: Development/Libraries
License: MIT
URL: http://symfony.com/doc/current/components/routing.html
Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz
-Source1: bootstrap.php
+Patch0: %{name}-tests-bootstrap.patch
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
+
BuildRequires: php-pear(PEAR)
BuildRequires: php-channel(%{pear_channel})
-# For tests
+%if %{with_tests}
+# Test requires
+BuildRequires: php(language) >= %{php_min_ver}
BuildRequires: php-pear(pear.phpunit.de/PHPUnit)
-BuildRequires: php-pear(%{pear_channel}/Config)
-BuildRequires: php-pear(%{pear_channel}/HttpKernel)
-
-Requires: php-common >= 5.3.2
+BuildRequires: php-pear(%{pear_channel}/Config) >= 2.1.0
+BuildRequires: php-pear(%{pear_channel}/HttpKernel) >= 2.1.0
+BuildRequires: php-pear(%{pear_channel}/Yaml) >= 2.1.0
+# Test requires: phpci
+BuildRequires: php-dom
+BuildRequires: php-libxml
+BuildRequires: php-pcre
+BuildRequires: php-reflection
+BuildRequires: php-spl
+BuildRequires: php-tokenizer
+%endif
+
+Requires: php(language) >= %{php_min_ver}
Requires: php-pear(PEAR)
Requires: php-channel(%{pear_channel})
Requires(post): %{__pear}
@@ -37,23 +52,36 @@ Requires: php-reflection
Requires: php-spl
Requires: php-tokenizer
# Optional requires
-Requires: php-pear(%{pear_channel}/Config) = %{version}
-Requires: php-pear(%{pear_channel}/Yaml) = %{version}
+Requires: php-pear(%{pear_channel}/Config) >= 2.1.0
+Requires: php-pear(%{pear_channel}/Yaml) >= 2.1.0
+# TODO: Add DoctrineCommon (>=2.2,<2.4-dev) when available
Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version}
%description
The Routing Component maps an HTTP request to a set of configuration variables.
+Optional dependency: DoctrineCommon
+
%prep
%setup -q -c
-# Hum...
-sed -e '/CHANGELOG.md/s/role="php"/role="doc"/' \
+# Patches
+cd %{pear_name}-%{version}
+%patch0 -p0
+cd ..
+
+# Modify PEAR package.xml file:
+# - Remove .gitignore file
+# - Change role from "php" to "doc" for CHANGELOG.md file
+# - Change role from "php" to "test" for all test files
+# - Remove md5sum from bootsrap.php file since it was patched
+sed -e '/.git/d' \
+ -e '/CHANGELOG.md/s/role="php"/role="doc"/' \
-e '/phpunit.xml.dist/s/role="php"/role="test"/' \
-e '/Tests/s/role="php"/role="test"/' \
- -e '/.gitignore/d' \
+ -e '/bootstrap.php/s/md5sum="[^"]*"\s*//' \
-i package.xml
# package.xml is version 2.0
@@ -66,20 +94,23 @@ mv package.xml %{pear_name}-%{version}/%{name}.xml
%install
cd %{pear_name}-%{version}
-%{__pear} install --nodeps --packagingroot $RPM_BUILD_ROOT %{name}.xml
+%{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml
# Clean up unnecessary files
-rm -rf $RPM_BUILD_ROOT%{pear_metadir}/.??*
+rm -rf %{buildroot}%{pear_metadir}/.??*
# Install XML package description
-mkdir -p $RPM_BUILD_ROOT%{pear_xmldir}
-install -pm 644 %{name}.xml $RPM_BUILD_ROOT%{pear_xmldir}
+mkdir -p %{buildroot}%{pear_xmldir}
+install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir}
%check
-cd %{pear_name}-%{version}/Symfony/Component/%{pear_name}/Tests
-cp %{SOURCE1} bootstrap.php
-phpunit --bootstrap bootstrap.php --verbose .
+%if %{with_tests}
+ cd %{pear_name}-%{version}/Symfony/Component/%{pear_name}
+ %{_bindir}/phpunit
+%else
+: Tests skipped, missing '--with tests' option
+%endif
%post
@@ -103,6 +134,21 @@ fi
%changelog
+* Tue Oct 30 2012 Remi Collet <RPMS@FamilleCollet.com> 2.1.3-1
+- sync with rawhide, update to 2.1.3
+
+* Mon Oct 29 2012 Shawn Iwinski <shawn.iwinski@gmail.com> 2.1.2-2
+- Added "%%global pear_metadir" and usage in %%install
+- Changed RPM_BUILD_ROOT to %%{buildroot}
+
+* Tue Oct 23 2012 Shawn Iwinski <shawn.iwinski@gmail.com> 2.1.2-1
+- Updated to upstream version 2.1.2
+- PHP minimum version 5.3.3 instead of 5.3.2
+- Require other components ">= 2.1.0" instead of "= %%{version}"
+- Added PEAR package.xml modifications
+- Added patch for tests' bootstrap.php
+- Added tests (%%check)
+
* Sat Oct 6 2012 Remi Collet <RPMS@FamilleCollet.com> 2.1.2-1
- update to 2.1.2