summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--php-horde-Horde-Image.spec54
1 files changed, 47 insertions, 7 deletions
diff --git a/php-horde-Horde-Image.spec b/php-horde-Horde-Image.spec
index f8a9408..afd46e8 100644
--- a/php-horde-Horde-Image.spec
+++ b/php-horde-Horde-Image.spec
@@ -4,9 +4,10 @@
%global pear_channel pear.horde.org
# No test: all are skipped.
+%global with_tests %{?_with_tests:1}%{!?_with_tests:0}
Name: php-horde-Horde-Image
-Version: 2.0.1
+Version: 2.0.2
Release: 1%{?dist}
Summary: Horde Image API
@@ -17,8 +18,13 @@ Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch: noarch
+BuildRequires: gettext
BuildRequires: php-pear(PEAR) >= 1.7.0
BuildRequires: php-channel(%{pear_channel})
+%if %{with_tests}
+# To run unit tests
+BuildRequires: php-pear(%{pear_channel}/Horde_Test) >= 2.1.0
+%endif
Requires(post): %{__pear}
Requires(postun): %{__pear}
@@ -59,16 +65,25 @@ Optional dependency: php-pecl-imagick
%prep
-%setup -q -c -T
-tar xif %{SOURCE0}
+%setup -q -c
cd %{pear_name}-%{version}
-mv ../package.xml %{name}.xml
+
+# Don't install .po and .pot files
+# Remove checksum for .mo, as we regenerate them
+sed -e '/%{pear_name}.po/d' \
+ -e '/%{pear_name}.mo/s/md5sum=.*name=/name=/' \
+ ../package.xml >%{name}.xml
%build
cd %{pear_name}-%{version}
-# Empty build section, most likely nothing required.
+
+# Regenerate the locales
+for po in $(find locale -name \*.po)
+do
+ msgfmt $po -o $(dirname $po)/$(basename $po .po).mo
+done
%install
@@ -82,6 +97,25 @@ rm -rf %{buildroot}%{pear_metadir}/.??*
mkdir -p %{buildroot}%{pear_xmldir}
install -pm 644 %{name}.xml %{buildroot}%{pear_xmldir}
+for loc in locale/{??,??_??}
+do
+ lang=$(basename $loc)
+ test -d %{buildroot}%{pear_datadir}/%{pear_name}/$loc \
+ && echo "%%lang(${lang%_*}) %{pear_datadir}/%{pear_name}/$loc"
+done | tee ../%{pear_name}.lang
+
+
+%check
+%if %{with_tests}
+cd %{pear_name}-%{version}/test/$(echo %{pear_name} | sed -e s:_:/:g)
+phpunit\
+ -d include_path=%{buildroot}%{pear_phpdir}:.:%{pear_phpdir} \
+ -d date.timezone=UTC \
+ .
+%else
+: Test disabled, missing '--with tests' option.
+%endif
+
%post
%{__pear} install --nodeps --soft --force --register-only \
@@ -94,17 +128,23 @@ if [ $1 -eq 0 ] ; then
fi
-%files
+%files -f %{pear_name}.lang
%defattr(-,root,root,-)
%doc %{pear_docdir}/%{pear_name}
%{pear_xmldir}/%{name}.xml
%{pear_phpdir}/Horde/Image
%{pear_phpdir}/Horde/Image.php
-%{pear_datadir}/Horde_Image
+%dir %{pear_datadir}/%{pear_name}
+%dir %{pear_datadir}/%{pear_name}/locale
%{pear_testdir}/Horde_Image
%changelog
+* Wed Jan 9 2013 Remi Collet <RPMS@FamilleCollet.com> - 2.0.2-1
+- Update to 2.0.2 for remi repo
+- manage locales
+- new test layout (requires Horde_Test 2.1.0)
+
* Mon Nov 19 2012 Remi Collet <RPMS@FamilleCollet.com> - 2.0.1-1
- Update to 2.0.1 for remi repo