From 7a8b3bb9bee8789605345311fcd7e7c9d3e46e27 Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Tue, 30 Oct 2012 19:03:52 +0100 Subject: php-symfony2-Locale: sync with rawhide, update to 2.1.3 --- bootstrap.php | 24 ---------- php-symfony2-Locale-tests-bootstrap.patch | 55 +++++++++++++++++++++ php-symfony2-Locale.spec | 80 +++++++++++++++++++++++-------- 3 files changed, 114 insertions(+), 45 deletions(-) delete mode 100644 bootstrap.php create mode 100644 php-symfony2-Locale-tests-bootstrap.patch diff --git a/bootstrap.php b/bootstrap.php deleted file mode 100644 index 3feb5f9..0000000 --- a/bootstrap.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * 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')) { - $file = substr(str_replace('\\', '/', $class), strlen('Symfony\Component')).'.php'; - if (file_exists(__DIR__.'/../..'.$file)) { - # Run from source tree - require_once __DIR__.'/../..'.$file; - } else { - # Run from install dir - require_once 'Symfony/Component'.$file; - } - } -}); 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 745663f..d52b50f 100644 --- a/php-symfony2-Locale.spec +++ b/php-symfony2-Locale.spec @@ -1,13 +1,14 @@ -%{!?pear_metadir: %global pear_metadir %{pear_phpdir}} %{!?__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 # Lot of failures, need investigation %global with_tests %{?_with_tests:1}%{!?_with_tests:0} Name: php-symfony2-Locale -Version: 2.1.2 +Version: 2.1.3 Release: 1%{?dist} Summary: Symfony2 %{pear_name} Component @@ -15,17 +16,27 @@ Group: Development/Libraries License: MIT URL: http://symfony.com/doc/current/components/locale.html Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz -Source1: bootstrap.php +Patch0: %{name}-tests-bootstrap.patch BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildArch: noarch BuildRequires: php-pear(PEAR) BuildRequires: php-channel(%{pear_channel}) %if %{with_tests} +# Test requires +BuildRequires: php(language) >= %{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 %endif -Requires: php-common >= 5.3.2 +Requires: php(language) >= %{php_min_ver} Requires: php-pear(PEAR) Requires: php-channel(%{pear_channel}) Requires(post): %{__pear} @@ -35,6 +46,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} @@ -60,10 +73,22 @@ Stub implementation only supports the en locale. %prep %setup -q -c -# Hum... -sed -e '/CHANGELOG.md/s/role="php"/role="doc"/' \ +# 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*//' \ + -e '/.git/d' \ -i package.xml # package.xml is version 2.0 @@ -76,32 +101,31 @@ 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_metadir}/.??* +rm -rf %{buildroot}%{pear_metadir}/.??* # Lang files for res_file in \ - $RPM_BUILD_ROOT%{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/49/*/*.res + %{buildroot}%{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" done > ../%{name}.lang -sed -i "s#) $RPM_BUILD_ROOT#) #" ../%{name}.lang +sed -i "s#) %{buildroot}#) #" ../%{name}.lang # 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 %if %{with_tests} -cd %{pear_name}-%{version}/Symfony/Component/%{pear_name}/Tests -cp %{SOURCE1} bootstrap.php -phpunit --bootstrap bootstrap.php --verbose . + cd %{pear_name}-%{version}/Symfony/Component/%{pear_name} + %{_bindir}/phpunit %else -: Tests skipped, missing --with tests option +: Tests skipped, missing '--with tests' option %endif @@ -134,16 +158,30 @@ fi %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/svn-info.txt - %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/build-data.php - %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/icu.ini - %{pear_phpdir}/Symfony/Component/%{pear_name}/Resources/data/UPDATE.txt + %{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} +%{pear_testdir}/%{pear_name} %changelog +* Tue Oct 30 2012 Remi Collet 2.1.3-1 +- sync with rawhide, update to 2.1.3 + +* Mon Oct 29 2012 Shawn Iwinski 2.1.2-2 +- Added "%%global pear_metadir" and usage in %%install +- Changed RPM_BUILD_ROOT to %%{buildroot} +- Added %%{with_tests} for build requires + +* Sat Oct 20 2012 Shawn Iwinski 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 Remi Collet 2.0.17-1 - Update to 2.0.17, backport for remi repository -- cgit