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

Shawn Iwinski siwinski at fedoraproject.org
Sun Oct 28 00:32:00 UTC 2012


commit 5f5bf74906f65667fffb317e9bf256215516f29b
Author: Shawn Iwinski <shawn.iwinski at gmail.com>
Date:   Sun Sep 23 20:23:33 2012 -0400

    Updated to upstream version 2.1.2 + added tests

 .gitignore                                  |    1 +
 php-symfony2-Security-tests-bootstrap.patch |   26 ++++++++
 php-symfony2-Security.spec                  |   88 ++++++++++++++++++++++----
 sources                                     |    1 +
 4 files changed, 102 insertions(+), 14 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index cac0e71..5aee04a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 /Security-2.0.15.tgz
 /Security-2.0.16.tgz
 /Security-2.0.17.tgz
+/Security-2.1.2.tgz
diff --git a/php-symfony2-Security-tests-bootstrap.patch b/php-symfony2-Security-tests-bootstrap.patch
new file mode 100644
index 0000000..7ba0e28
--- /dev/null
+++ b/php-symfony2-Security-tests-bootstrap.patch
@@ -0,0 +1,26 @@
+--- Symfony/Component/Security/Tests/bootstrap.php	2012-09-20 03:42:18.000000000 -0400
++++ Symfony/Component/Security/Tests/bootstrap.php	2012-10-27 20:18:54.650105324 -0400
+@@ -9,10 +9,20 @@
+  * 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\Security')) {
+-        if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\Security')).'.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-Security.spec b/php-symfony2-Security.spec
index 94b9f3f..2a5241f 100644
--- a/php-symfony2-Security.spec
+++ b/php-symfony2-Security.spec
@@ -1,10 +1,12 @@
 %{!?__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
 
 Name:             php-symfony2-Security
-Version:          2.0.17
+Version:          2.1.2
 Release:          1%{?dist}
 Summary:          Symfony2 %{pear_name} Component
 
@@ -12,17 +14,38 @@ Group:            Development/Libraries
 License:          MIT
 URL:              http://symfony.com/components
 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}/EventDispatcher) >= 2.1.0
+BuildRequires:    php-pear(%{pear_channel}/HttpFoundation) >= 2.1.0
+BuildRequires:    php-pear(%{pear_channel}/HttpKernel) >= 2.1.0
+BuildRequires:    php-pear(%{pear_channel}/Form) >= 2.1.0
+BuildRequires:    php-pear(%{pear_channel}/Routing) >= 2.1.0
+BuildRequires:    php-pear(%{pear_channel}/Validator) >= 2.1.0
+# TODO: Add DoctrineCommon and DoctrineDBAL (>=2.2,<2.4-dev) when available
+# Test requires: phpci
+BuildRequires:    php-date
+BuildRequires:    php-hash
+BuildRequires:    php-json
+BuildRequires:    php-openssl
+BuildRequires:    php-pcre
+BuildRequires:    php-pdo
+BuildRequires:    php-reflection
+BuildRequires:    php-spl
+
+Requires:         php-common >= %{php_min_ver}
 Requires:         php-pear(PEAR)
 Requires:         php-channel(%{pear_channel})
-Requires:         php-pear(%{pear_channel}/HttpKernel) = %{version}
-Requires:         php-pear(%{pear_channel}/HttpFoundation) = %{version}
-Requires:         php-pear(%{pear_channel}/EventDispatcher) = %{version}
+Requires:         php-pear(%{pear_channel}/EventDispatcher) >= 2.1.0
+Requires:         php-pear(%{pear_channel}/HttpFoundation) >= 2.1.0
+Requires:         php-pear(%{pear_channel}/HttpKernel) >= 2.1.0
 Requires(post):   %{__pear}
 Requires(postun): %{__pear}
 # phpci requires
@@ -35,10 +58,12 @@ Requires:         php-pdo
 Requires:         php-reflection
 Requires:         php-spl
 # Optional requires
-Requires:         php-pear(%{pear_channel}/ClassLoader) = %{version}
-Requires:         php-pear(%{pear_channel}/Finder) = %{version}
-Requires:         php-pear(%{pear_channel}/Form) = %{version}
-Requires:         php-pear(%{pear_channel}/Routing) = %{version}
+Requires:         php-pear(%{pear_channel}/ClassLoader) >= 2.1.0
+Requires:         php-pear(%{pear_channel}/Finder) >= 2.1.0
+Requires:         php-pear(%{pear_channel}/Form) >= 2.1.0
+Requires:         php-pear(%{pear_channel}/Routing) >= 2.1.0
+Requires:         php-pear(%{pear_channel}/Validator) >= 2.1.0
+# TODO: Add DoctrineDBAL (>=2.2,<2.4-dev) when available
 
 Provides:         php-pear(%{pear_channel}/%{pear_name}) = %{version}
 
@@ -53,6 +78,24 @@ Optional dependencies: DoctrineCommon and DoctrineDBAL
 
 %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
 
@@ -63,14 +106,19 @@ 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_phpdir}/.??*
+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}
+%{_bindir}/phpunit
 
 
 %post
@@ -89,9 +137,21 @@ fi
 %doc %{pear_docdir}/%{pear_name}
 %{pear_xmldir}/%{name}.xml
 %{pear_phpdir}/Symfony/Component/%{pear_name}
+%{pear_testdir}/%{pear_name}
 
 
 %changelog
+* Sat Oct 27 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 Validator require
+- Added PEAR package.xml modifications
+- Added patch for tests' bootstrap.php
+- Added tests (%%check)
+- Changed RPM_BUILD_ROOT to %%{buildroot}
+- Added %%global pear_metadir
+
 * Sat Sep 15 2012 Shawn Iwinski <shawn.iwinski at gmail.com> 2.0.17-1
 - Updated to upstream version 2.0.17
 
diff --git a/sources b/sources
index 5ac9a58..71eaf2c 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,4 @@
 4e66aac7ad61570e2113b6e2ddc4aeb2  Security-2.0.15.tgz
 6aac60fb7cac65765178d28dbb4c09f4  Security-2.0.16.tgz
 06c1e487dea77e184177356c4d46b82e  Security-2.0.17.tgz
+f4907a7756b9c18d8f722bfcf8f57b85  Security-2.1.2.tgz


More information about the scm-commits mailing list