summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRemi Collet <fedora@famillecollet.com>2013-04-06 12:21:42 +0200
committerRemi Collet <fedora@famillecollet.com>2013-04-06 12:21:42 +0200
commit246afea703d4b339b07da706b66ebf4ab0ae3160 (patch)
treede26c26e0202106bbe8a61525cff65a00e3d434c
parent25658b467b9ace7bdb24782989445cd746cff665 (diff)
php-horde-Horde-Service-Weather: cleanups
-rw-r--r--php-horde-Horde-Service-Weather.spec134
1 files changed, 82 insertions, 52 deletions
diff --git a/php-horde-Horde-Service-Weather.spec b/php-horde-Horde-Service-Weather.spec
index 9dec078..4847ca6 100644
--- a/php-horde-Horde-Service-Weather.spec
+++ b/php-horde-Horde-Service-Weather.spec
@@ -1,6 +1,7 @@
%{!?pear_metadir: %global pear_metadir %{pear_phpdir}}
%{!?__pear: %{expand: %%global __pear %{_bindir}/pear}}
-%global pear_name Horde_Service_Weather
+%global pear_name Horde_Service_Weather
+%global pear_channel pear.horde.org
Name: php-horde-Horde-Service-Weather
Version: 2.0.4
@@ -8,63 +9,109 @@ Release: 1%{?dist}
Summary: Horde Weather Provider
Group: Development/Libraries
-License: BSD-2-Clause
-URL: http://pear.horde.org/package/Horde_Service_Weather
-Source0: http://pear.horde.org/get/%{pear_name}-%{version}.tgz
+License: BSD
+URL: http://%{pear_channel}
+Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildArch: noarch
+BuildRequires: gettext
+BuildRequires: php(language) >= 5.3.0
BuildRequires: php-pear(PEAR)
+BuildRequires: php-channel(%{pear_channel})
+BuildRequires: php-pear(%{pear_channel}/Horde_Role) >= 1.0.0
+# To run unit tests
+BuildRequires: php-pear(%{pear_channel}/Horde_Date) >= 2.0.0
+BuildRequires: php-pear(%{pear_channel}/Horde_Http) >= 2.0.0
+BuildRequires: php-pear(%{pear_channel}/Horde_Serialize) >= 2.0.0
+BuildRequires: php-pear(%{pear_channel}/Horde_Test) >= 2.1.0
+BuildRequires: php-pear(%{pear_channel}/Horde_Url) >= 2.0.0
Requires(post): %{__pear}
Requires(postun): %{__pear}
-Requires: php-pear(PEAR)
-Requires: php-pear(pear.horde.org/Horde_Date) >= 2.0.0
-Requires: php-pear(pear.horde.org/Horde_Date) < 3.0.0alpha1
-Requires: php-pear(pear.horde.org/Horde_Exception) >= 2.0.0
-Requires: php-pear(pear.horde.org/Horde_Exception) < 3.0.0alpha1
-Requires: php-pear(pear.horde.org/Horde_Http) >= 2.0.0
-Requires: php-pear(pear.horde.org/Horde_Http) < 3.0.0alpha1
-Requires: php-pear(pear.horde.org/Horde_Url) >= 2.0.0
-Requires: php-pear(pear.horde.org/Horde_Url) < 3.0.0alpha1
+Requires: php(language) >= 5.3.0
+Requires: php-date
+Requires: php-gettext
+Requires: php-spl
Requires: php-pear(PEAR) >= 1.7.0
-Provides: php-pear(pear.horde.org/Horde_Service_Weather) = %{version}
-BuildRequires: php-channel(pear.horde.org)
-Requires: php-channel(pear.horde.org)
+Requires: php-channel(%{pear_channel})
+Requires: php-pear(%{pear_channel}/Horde_Role) >= 1.0.0
+Requires: php-pear(%{pear_channel}/Horde_Date) >= 2.0.0
+Requires: php-pear(%{pear_channel}/Horde_Date) >= 3.0.0
+Requires: php-pear(%{pear_channel}/Horde_Exception) >= 2.0.0
+Requires: php-pear(%{pear_channel}/Horde_Exception) >= 3.0.0
+Requires: php-pear(%{pear_channel}/Horde_Http) >= 2.0.0
+Requires: php-pear(%{pear_channel}/Horde_Http) >= 3.0.0
+Requires: php-pear(%{pear_channel}/Horde_Url) >= 2.0.0
+Requires: php-pear(%{pear_channel}/Horde_Url) >= 3.0.0
+# Not documented, detected by phpci
+Requires: php-pear(%{pear_channel}/Horde_Serialize) >= 2.0.0
+Requires: php-pear(%{pear_channel}/Horde_Serialize) >= 3.0.0
+
+Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version}
+
%description
Set of classes that provide an abstraction to various online weather
service providers. Includes drivers for WeatherUnderground,
WorldWeatherOnline, and Google Weather.
+
%prep
%setup -q -c
-[ -f package2.xml ] || mv package.xml package2.xml
-mv package2.xml %{pear_name}-%{version}/%{name}.xml
cd %{pear_name}-%{version}
+# Don't install .po and .pot files
+# Remove checksum for .mo, as we regenerate them
+sed -e '/%{pear_name}.po/d' \
+ -e '/Horde_Other.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
+rm -rf %{buildroot}
cd %{pear_name}-%{version}
-rm -rf $RPM_BUILD_ROOT
-%{__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}/.??*
# 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}
+
+# Locales
+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
+src=$(pwd)/%{pear_name}-%{version}
+cd %{pear_name}-%{version}/test/$(echo %{pear_name} | sed -e s:_:/:g)
+phpunit \
+ -d include_path=$src/lib:.:%{pear_phpdir} \
+ -d date.timezone=UTC \
+ .
%clean
-rm -rf $RPM_BUILD_ROOT
+rm -rf %{buildroot}
%post
@@ -74,39 +121,22 @@ rm -rf $RPM_BUILD_ROOT
%postun
if [ $1 -eq 0 ] ; then
%{__pear} uninstall --nodeps --ignore-errors --register-only \
- pear.horde.org/%{pear_name} >/dev/null || :
+ %{pear_channel}/%{pear_name} >/dev/null || :
fi
-%files
+%files -f %{pear_name}.lang
%defattr(-,root,root,-)
%doc %{pear_docdir}/%{pear_name}
-
-
%{pear_xmldir}/%{name}.xml
-# Expand this as needed to avoid owning dirs owned by our dependencies
-# and to avoid unowned dirs
-%{pear_phpdir}/Horde/Service/Weather/Current/Base.php
-%{pear_phpdir}/Horde/Service/Weather/Current/WeatherUnderground.php
-%{pear_phpdir}/Horde/Service/Weather/Current/Wwo.php
-%{pear_phpdir}/Horde/Service/Weather/Exception/InvalidProperty.php
-%{pear_phpdir}/Horde/Service/Weather/Forecast/Base.php
-%{pear_phpdir}/Horde/Service/Weather/Forecast/WeatherUnderground.php
-%{pear_phpdir}/Horde/Service/Weather/Forecast/Wwo.php
-%{pear_phpdir}/Horde/Service/Weather/Period/Base.php
-%{pear_phpdir}/Horde/Service/Weather/Period/WeatherUnderground.php
-%{pear_phpdir}/Horde/Service/Weather/Period/Wwo.php
-%{pear_phpdir}/Horde/Service/Weather/Base.php
-%{pear_phpdir}/Horde/Service/Weather/Exception.php
-%{pear_phpdir}/Horde/Service/Weather/Station.php
-%{pear_phpdir}/Horde/Service/Weather/Translation.php
-%{pear_phpdir}/Horde/Service/Weather/WeatherUnderground.php
-%{pear_phpdir}/Horde/Service/Weather/WeatherUnderground_Strings.php
-%{pear_phpdir}/Horde/Service/Weather/Wwo.php
-%{pear_phpdir}/Horde/Service/Weather/Wwo_Strings.php
+%dir %{pear_phpdir}/Horde/Service
+%{pear_phpdir}/Horde/Service/Weather
%{pear_phpdir}/Horde/Service/Weather.php
-%{pear_datadir}/Horde_Service_Weather
-%{pear_testdir}/Horde_Service_Weather
-
+%dir %{pear_datadir}/%{pear_name}
+%dir %{pear_datadir}/%{pear_name}/locale
+%{pear_testdir}/%{pear_name}
+%{pear_hordedir}/themes
%changelog
+* Sat Apr 6 2013 Remi Collet <remi@fedoraproject.org> - 2.0.4-1
+- initial package