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

Shawn Iwinski siwinski at fedoraproject.org
Sun Oct 21 02:15:34 UTC 2012


commit c9c1253933879672c986efdfd0fe5aec9476a4be
Author: Shawn Iwinski <shawn.iwinski at gmail.com>
Date:   Sat Sep 22 00:30:57 2012 -0400

    Updated to upstream version 2.1.2 + added tests

 .gitignore                                     |    1 +
 php-symfony2-ClassLoader-tests-bootstrap.patch |   24 ++++++++++
 php-symfony2-ClassLoader.spec                  |   55 ++++++++++++++++++++++--
 sources                                        |    1 +
 4 files changed, 77 insertions(+), 4 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index bf573f1..729cb8b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,3 +3,4 @@
 /ClassLoader-2.0.15.tgz
 /ClassLoader-2.0.16.tgz
 /ClassLoader-2.0.17.tgz
+/ClassLoader-2.1.2.tgz
diff --git a/php-symfony2-ClassLoader-tests-bootstrap.patch b/php-symfony2-ClassLoader-tests-bootstrap.patch
new file mode 100644
index 0000000..cf7f67c
--- /dev/null
+++ b/php-symfony2-ClassLoader-tests-bootstrap.patch
@@ -0,0 +1,24 @@
+--- Symfony/Component/ClassLoader/Tests/bootstrap.php	2012-09-20 03:42:06.000000000 -0400
++++ Symfony/Component/ClassLoader/Tests/bootstrap.php	2012-10-20 21:56:18.505220891 -0400
+@@ -10,9 +10,18 @@
+  */
+ 
+ spl_autoload_register(function ($class) {
+-    if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\ClassLoader')) {
+-        if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\ClassLoader')).'.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-ClassLoader.spec b/php-symfony2-ClassLoader.spec
index 17f0b89..ea697e7 100644
--- a/php-symfony2-ClassLoader.spec
+++ b/php-symfony2-ClassLoader.spec
@@ -2,9 +2,10 @@
 
 %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
 
 Name:             php-symfony2-ClassLoader
-Version:          2.0.17
+Version:          2.1.2
 Release:          1%{?dist}
 Summary:          Symfony2 %{pear_name} Component
 
@@ -12,17 +13,30 @@ Group:            Development/Libraries
 License:          MIT
 URL:              http://symfony.com/doc/current/components/class_loader.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
+# Test requires
+BuildRequires:    php-common >= %{php_min_ver}
+BuildRequires:    php-pear(pear.phpunit.de/PHPUnit)
+BuildRequires:    php-pear(%{pear_channel}/Finder) >= 2.1.0
+# Test requires: phpci
+BuildRequires:    php-date
+BuildRequires:    php-pcre
+BuildRequires:    php-spl
+BuildRequires:    php-reflection
+BuildRequires:    php-tokenizer
+
+Requires:         php-common >= %{php_min_ver}
 Requires:         php-pear(PEAR)
 Requires:         php-channel(%{pear_channel})
 Requires(post):   %{__pear}
 Requires(postun): %{__pear}
 # phpci requires
+Requires:         php-date
 Requires:         php-pcre
 Requires:         php-spl
 Requires:         php-reflection
@@ -49,11 +63,29 @@ If your classes and the third-party libraries you use for your project follow
 these standards, the Symfony2 auto-loader is the only auto-loader you will
 ever need.
 
-Optional dependency: APC
+Optional dependencies: APC, XCache
 
 
 %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
 
@@ -74,6 +106,11 @@ mkdir -p $RPM_BUILD_ROOT%{pear_xmldir}
 install -pm 644 %{name}.xml $RPM_BUILD_ROOT%{pear_xmldir}
 
 
+%check
+cd %{pear_name}-%{version}/Symfony/Component/%{pear_name}
+%{_bindir}/phpunit
+
+
 %post
 %{__pear} install --nodeps --soft --force --register-only \
     %{pear_xmldir}/%{name}.xml >/dev/null || :
@@ -92,9 +129,19 @@ fi
 %dir %{pear_phpdir}/Symfony
 %dir %{pear_phpdir}/Symfony/Component
      %{pear_phpdir}/Symfony/Component/%{pear_name}
+%{pear_testdir}/%{pear_name}
 
 
 %changelog
+* Sat Oct 20 2012 Shawn Iwinski <shawn.iwinski at gmail.com> 2.1.2-1
+- Updated to upstream version 2.1.2
+- Updated description
+- PHP minimum version 5.3.3 instead of 5.3.2
+- Added php-date require
+- 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-reflection require
diff --git a/sources b/sources
index 5ce69d3..08a1ca7 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,4 @@
 da49abfd69e2ec7ef477d455bbde3476  ClassLoader-2.0.15.tgz
 446e7008ef2476438f8529b1445a3065  ClassLoader-2.0.16.tgz
 387ebd843dc4963d311623769fcad0bb  ClassLoader-2.0.17.tgz
+e999b48893f139c0e07a1b845c70be25  ClassLoader-2.1.2.tgz


More information about the scm-commits mailing list