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

Shawn Iwinski siwinski at fedoraproject.org
Wed Oct 24 01:49:26 UTC 2012


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

    Updated to upstream version 2.1.2 + added tests

 .gitignore                                   |    1 +
 php-symfony2-Validator-tests-bootstrap.patch |   48 ++++++++++++++++++
 php-symfony2-Validator.spec                  |   70 +++++++++++++++++++++++---
 sources                                      |    1 +
 4 files changed, 113 insertions(+), 7 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index f4b4174..97551d0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,3 +1,4 @@
 /Validator-2.0.15.tgz
 /Validator-2.0.16.tgz
 /Validator-2.0.17.tgz
+/Validator-2.1.2.tgz
diff --git a/php-symfony2-Validator-tests-bootstrap.patch b/php-symfony2-Validator-tests-bootstrap.patch
new file mode 100644
index 0000000..567f679
--- /dev/null
+++ b/php-symfony2-Validator-tests-bootstrap.patch
@@ -0,0 +1,48 @@
+--- Symfony/Component/Validator/Tests/bootstrap.php	2012-09-20 03:42:20.000000000 -0400
++++ Symfony/Component/Validator/Tests/bootstrap.php	2012-10-23 21:36:52.088489051 -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\Validator')) {
+-        if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\Validator')).'.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
++            }
+         }
+     }
+ });
+@@ -23,9 +33,18 @@
+ 
+ if (class_exists($annotationRegistry = 'Doctrine\Common\Annotations\AnnotationRegistry')) {
+     $annotationRegistry::registerLoader(function($class) {
+-        if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\Validator')) {
+-            if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\Validator')).'.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 for fall-through
++                }
+             }
+         }
+ 
diff --git a/php-symfony2-Validator.spec b/php-symfony2-Validator.spec
index 0dacf19..13e664f 100644
--- a/php-symfony2-Validator.spec
+++ b/php-symfony2-Validator.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-Validator
-Version:          2.0.17
+Version:          2.1.2
 Release:          1%{?dist}
 Summary:          Symfony2 %{pear_name} Component
 
@@ -12,12 +13,32 @@ 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}/HttpFoundation) >= 2.1.0
+BuildRequires:    php-pear(%{pear_channel}/Locale) >= 2.1.0
+BuildRequires:    php-pear(%{pear_channel}/Yaml) >= 2.1.0
+# Test requires: phpci
+BuildRequires:    php-ctype
+BuildRequires:    php-date
+BuildRequires:    php-dom
+BuildRequires:    php-intl
+BuildRequires:    php-libxml
+BuildRequires:    php-mbstring
+BuildRequires:    php-pcre
+BuildRequires:    php-reflection
+BuildRequires:    php-simplexml
+BuildRequires:    php-spl
+# Test requires: phpci dist specific requires
+%{?fedora:BuildRequires: php-filter}
+
+Requires:         php-common >= 5.3.3
 Requires:         php-pear(PEAR)
 Requires:         php-channel(%{pear_channel})
 Requires(post):   %{__pear}
@@ -36,19 +57,40 @@ Requires:         php-spl
 # phpci dist specific requires
 %{?fedora:Requires: php-filter}
 # Optional requires
-Requires:         php-pear(%{pear_channel}/HttpFoundation) = %{version}
-Requires:         php-pear(%{pear_channel}/Yaml) = %{version}
+Requires:         php-pear(%{pear_channel}/HttpFoundation) >= 2.1.0
+Requires:         php-pear(%{pear_channel}/Yaml) >= 2.1.0
+# TODO: Add DoctrineCommon (>=2.1,<2.4-dev) when available
 
 Provides:         php-pear(%{pear_channel}/%{pear_name}) = %{version}
 
 %description
-%{summary}.
+This component is based on the JSR-303 Bean Validation specification and
+enables specifying validation rules for classes using XML, YAML, PHP or
+annotations, which can then be checked against instances of these classes.
 
-Optional dependency: APC
+Optional dependencies: APC, 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
 
@@ -69,6 +111,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 || :
@@ -85,9 +132,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 cc661bb..0e29501 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,4 @@
 ab5f2ac8788721db82d8107b8bfff0ec  Validator-2.0.15.tgz
 23ccf8d6b197240bfb1f05f7414c85e1  Validator-2.0.16.tgz
 70c6dd93d0bff33502aea103c31676e4  Validator-2.0.17.tgz
+0d163ca3397401f9168096997b35d5b1  Validator-2.1.2.tgz


More information about the scm-commits mailing list