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

Shawn Iwinski siwinski at fedoraproject.org
Sat Oct 20 19:52:01 UTC 2012


commit 15d7e1ba71930004d70c6b244f4c18557db94fc7
Author: Shawn Iwinski <shawn.iwinski at gmail.com>
Date:   Sun Sep 23 17:56:30 2012 -0400

    Updated to upstream version 2.1.2 + added tests

 .gitignore                                |    1 +
 php-symfony2-Locale-tests-bootstrap.patch |   55 +++++++++++++++++++
 php-symfony2-Locale.spec                  |   84 ++++++++++++++++++++++------
 sources                                   |    1 +
 4 files changed, 123 insertions(+), 18 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index 8d42cfe..a6627e8 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@
 /Locale-2.0.15.tgz
 /Locale-2.0.16.tgz
 /Locale-2.0.17.tgz
+/Locale-2.1.2.tgz
diff --git a/php-symfony2-Locale-tests-bootstrap.patch b/php-symfony2-Locale-tests-bootstrap.patch
new file mode 100644
index 0000000..09e23ed
--- /dev/null
+++ b/php-symfony2-Locale-tests-bootstrap.patch
@@ -0,0 +1,55 @@
+--- Symfony/Component/Locale/Tests/bootstrap.php	2012-09-20 03:42:14.000000000 -0400
++++ Symfony/Component/Locale/Tests/bootstrap.php	2012-10-20 15:25:42.739326649 -0400
+@@ -10,17 +10,47 @@
+  */
+ 
+ if (!function_exists('intl_get_error_code')) {
+-    require_once __DIR__.'/../Resources/stubs/functions.php';
++    $file = 'Resources/stubs/functions.php';
++    if (file_exists(__DIR__.'/../'.$file)) {
++        require_once __DIR__.'/../'.$file;
++    } else {
++    	try {
++    	    // Try loading from include path
++	    require_once 'Symfony/Component/Locale/'.$file;
++    	} catch (Exception $e) {
++    	    // Fail silently so class not found fatal error still raised
++    	}
++    }
+ }
+ 
+ spl_autoload_register(function ($class) {
+     if (in_array(ltrim($class, '/'), array('Collator', 'IntlDateFormatter', 'Locale', 'NumberFormatter'))) {
+-        require_once __DIR__.'/../Resources/stubs/'.ltrim($class, '/').'.php';
++    	$file = 'Resources/stubs/'.ltrim($class, '/').'.php';
++    	if (file_exists(__DIR__.'/../'.$file)) {
++    	    // Load from source tree
++    	    require_once __DIR__.'/../'.$file;
++    	} else {
++	    try {
++	        // Try loading from include path
++	        require_once 'Symfony/Component/Locale/'.$file;
++	    } catch (Exception $e) {
++	        // Fail silently so class not found fatal error still raised
++	    }
++    	}
+     }
+ 
+-    if (0 === strpos(ltrim($class, '/'), 'Symfony\Component\Locale')) {
+-        if (file_exists($file = __DIR__.'/../'.substr(str_replace('\\', '/', $class), strlen('Symfony\Component\Locale')).'.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-Locale.spec b/php-symfony2-Locale.spec
index 2d69838..74b54ed 100644
--- a/php-symfony2-Locale.spec
+++ b/php-symfony2-Locale.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
+# Lot of failures, need investigation
+%global with_tests   %{?_with_tests:1}%{!?_with_tests:0}
 
 Name:             php-symfony2-Locale
-Version:          2.0.17
+Version:          2.1.2
 Release:          1%{?dist}
 Summary:          Symfony2 %{pear_name} Component
 
@@ -12,12 +15,24 @@ Group:            Development/Libraries
 License:          MIT
 URL:              http://symfony.com/doc/current/components/locale.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)
+# Test requires: phpci
+BuildRequires:    php-ctype
+BuildRequires:    php-date
+BuildRequires:    php-intl
+BuildRequires:    php-pcre
+BuildRequires:    php-reflection
+BuildRequires:    php-simplexml
+BuildRequires:    php-spl
+
+Requires:         php-common >= %{php_min_ver}
 Requires:         php-pear(PEAR)
 Requires:         php-channel(%{pear_channel})
 Requires(post):   %{__pear}
@@ -27,6 +42,8 @@ Requires:         php-ctype
 Requires:         php-date
 Requires:         php-intl
 Requires:         php-pcre
+Requires:         php-reflection
+Requires:         php-simplexml
 Requires:         php-spl
 
 Provides:         php-pear(%{pear_channel}/%{pear_name}) = %{version}
@@ -51,17 +68,27 @@ Stub implementation only supports the en locale.
 
 %prep
 %setup -q -c
+
+# Patches
+cd %{pear_name}-%{version}
+%patch0 -p0
+cd ..
+
+# Modify PEAR package.xml file:
+# - Change role from "php" to "doc" for UPDATE.txt 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 '/UPDATE.txt/s/role="php"/role="doc"/' \
+    -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
 
-# Fix package.xml for "Symfony/Component/Locale/Resources/data/UPDATE.txt" file
-# incorrectly being identified with role="php" instead of role="doc"
-# *** NOTE: This needs to be fixed upstream (was fine in 2.0.15, but changed
-#           in 2.0.16)
-sed -i \
-    's#<file *md5sum="\([^"]*\)" *name="\(Symfony/Component/Locale/Resources/data/UPDATE.txt\)" *role="php" */>#<file md5sum="\1" name="\2" role="doc" />#' \
-    %{pear_name}-%{version}/%{name}.xml
-
 
 %build
 # Empty build section, nothing required
@@ -76,7 +103,7 @@ rm -rf $RPM_BUILD_ROOT%{pear_phpdir}/.??*
 
 # Lang files
 for res_file in \
-    $RPM_BUILD_ROOT%{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/*/*.res
+    $RPM_BUILD_ROOT%{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/49/*/*.res
 do
     res_file_lang=$(basename $res_file | sed 's#\(_.*\)*\.res##')
     echo "%lang($res_file_lang) $res_file"
@@ -88,6 +115,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 || :
@@ -110,17 +146,29 @@ fi
      %{pear_phpdir}/Symfony/Component/%{pear_name}/Locale.php
 %dir %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources
 %dir %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data
-%dir %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/lang
-%dir %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/locales
-%dir %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/names
-%dir %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/region
-     %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/stub
-     %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/update-data.php
+%dir %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/49
+%dir %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/49/lang
+%dir %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/49/locales
+%dir %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/49/names
+%dir %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/49/region
+     %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/49/stub
+     %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/49/*.*
+     %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/*.*
      %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/stubs
      %{pear_phpdir}/Symfony/Component/%{pear_name}/Stub
+%{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
+- PHP minimum version 5.3.3 instead of 5.3.2
+- Added php-reflection and php-simplexml requires
+- 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-spl require
diff --git a/sources b/sources
index ebb4bc4..280864b 100644
--- a/sources
+++ b/sources
@@ -1,3 +1,4 @@
 7e5b67ff42f65deef3135e7d266c6c52  Locale-2.0.15.tgz
 52ad24da208a81567aea7c537d52e062  Locale-2.0.16.tgz
 08e69aa7f0f4c9158c7e5b84b056bb65  Locale-2.0.17.tgz
+acf36c3ae8594f7d9567671af4428c0d  Locale-2.1.2.tgz


More information about the scm-commits mailing list