[php-symfony2-Routing] Updated to upstream version 2.1.2 + added tests

Shawn Iwinski siwinski at fedoraproject.org
Wed Oct 24 00:58:34 UTC 2012


commit 00de1a73b04ca40409b4b9a9ed158cd08cd4e2f9
Author: Shawn Iwinski <shawn.iwinski at gmail.com>
Date:   Sun Sep 23 17:59:57 2012 -0400

    Updated to upstream version 2.1.2 + added tests

 .gitignore                                 |    1 +
 php-symfony2-Routing-tests-bootstrap.patch |   24 ++++++++++
 php-symfony2-Routing.spec                  |   69 ++++++++++++++++++++++++++--
 sources                                    |    1 +
 4 files changed, 90 insertions(+), 5 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 7f7af48..24bfb81 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 /Routing-2.0.15.tgz
 /Routing-2.0.16.tgz
 /Routing-2.0.17.tgz
+/Routing-2.1.2.tgz
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 42b5bad..35747d5 100644
--- a/php-symfony2-Routing.spec
+++ b/php-symfony2-Routing.spec
@@ -2,9 +2,12 @@
 
 %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.0.17
+Version:          2.1.2
 Release:          1%{?dist}
 Summary:          Symfony2 %{pear_name} Component
 
@@ -12,12 +15,29 @@ Group:            Development/Libraries
 License:          MIT
 URL:              http://symfony.com/doc/current/components/routing.html
 Source0:          http://%{pear_channel}/get/%{pear_name}-%{version}.tgz
+Patch0:           %{name}-tests-bootstrap.patch
 
 BuildArch:        noarch
+
 BuildRequires:    php-pear(PEAR)
 BuildRequires:    php-channel(%{pear_channel})
-
-Requires:         php-common >= 5.3.2
+%if %{with_tests}
+# Test requires
+BuildRequires:    php-common >= %{php_min_ver}
+BuildRequires:    php-pear(pear.phpunit.de/PHPUnit)
+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-common >= 5.3.3
 Requires:         php-pear(PEAR)
 Requires:         php-channel(%{pear_channel})
 Requires(post):   %{__pear}
@@ -30,17 +50,38 @@ 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
+
+# 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 '/.gitignore/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 '/bootstrap.php/s/md5sum="[^"]*"\s*//' \
+    -i package.xml
+
 # package.xml is version 2.0
 mv package.xml %{pear_name}-%{version}/%{name}.xml
 
@@ -61,6 +102,15 @@ mkdir -p $RPM_BUILD_ROOT%{pear_xmldir}
 install -pm 644 %{name}.xml $RPM_BUILD_ROOT%{pear_xmldir}
 
 
+%check
+%if %{with_tests}
+    cd %{pear_name}-%{version}/Symfony/Component/%{pear_name}
+    %{_bindir}/phpunit
+%else
+: Tests skipped, missing '--with tests' option
+%endif
+
+
 %post
 %{__pear} install --nodeps --soft --force --register-only \
     %{pear_xmldir}/%{name}.xml >/dev/null || :
@@ -77,9 +127,18 @@ fi
 %doc %{pear_docdir}/%{pear_name}
 %{pear_xmldir}/%{name}.xml
 %{pear_phpdir}/Symfony/Component/%{pear_name}
+%{pear_testdir}/%{pear_name}
 
 
 %changelog
+* Tue Oct 23 2012 Shawn Iwinski <shawn.iwinski at 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 Sep 15 2012 Shawn Iwinski <shawn.iwinski at gmail.com> 2.0.17-1
 - Updated to upstream version 2.0.17
 - Added php-dom and php-reflection requires
diff --git a/sources b/sources
index 267912d..64e1bf5 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,4 @@
 e9c61d7843480c3240357fb97172d667  Routing-2.0.15.tgz
 7cacbe1267c4d24ed493765c4ba8cd8b  Routing-2.0.16.tgz
 59c5e3b303feea9e9e2015f56a5a8f9d  Routing-2.0.17.tgz
+e205e807f8110d952e1803b4331d4d29  Routing-2.1.2.tgz


More information about the scm-commits mailing list