From 3f4303fac179113cbb2e01993c43aceba4a6a4ce Mon Sep 17 00:00:00 2001 From: Remi Collet Date: Mon, 18 Nov 2019 14:39:41 +0100 Subject: - Fix FTBFS from Koschei, add patch for PHP 7.4 from https://github.com/horde/Service_Weather/pull/1 - use range dependencies --- .gitignore | 8 +++++ 1.patch | 57 +++++++++++++++++++++++++++++++++ php-horde-Horde-Service-Weather.spec | 62 +++++++++++++++++++++--------------- 3 files changed, 102 insertions(+), 25 deletions(-) create mode 100644 .gitignore create mode 100644 1.patch diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..fc9aa8c --- /dev/null +++ b/.gitignore @@ -0,0 +1,8 @@ +clog +package-*.xml +*.tgz +*.tar.gz +*.tar.xz +*.tar.xz.asc +*.src.rpm +*/*rpm diff --git a/1.patch b/1.patch new file mode 100644 index 0000000..dd4d677 --- /dev/null +++ b/1.patch @@ -0,0 +1,57 @@ +From 9b64ea49884ccc67eb00803ea8a8d20bdd71d696 Mon Sep 17 00:00:00 2001 +From: Remi Collet +Date: Mon, 18 Nov 2019 14:26:48 +0100 +Subject: [PATCH] fix phplint warnings + +--- + lib/Horde/Service/Weather.php | 6 +++--- + lib/Horde/Service/Weather/Parser/Metar.php | 8 ++++---- + 2 files changed, 7 insertions(+), 7 deletions(-) + +diff --git a/lib/Horde/Service/Weather.php b/lib/Horde/Service/Weather.php +index 0a9d44f..2a7c423 100644 +--- a/lib/Horde/Service/Weather.php ++++ b/lib/Horde/Service/Weather.php +@@ -351,8 +351,8 @@ public static function convertTemperature($temperature, $from, $to) + return $temperature; + } + +- $from = strtolower($from{0}); +- $to = strtolower($to{0}); ++ $from = strtolower($from[0]); ++ $to = strtolower($to[0]); + + $result = array( + 'f' => array( +@@ -368,4 +368,4 @@ public static function convertTemperature($temperature, $from, $to) + return $result[$from][$to]; + } + +-} +\ No newline at end of file ++} +diff --git a/lib/Horde/Service/Weather/Parser/Metar.php b/lib/Horde/Service/Weather/Parser/Metar.php +index 570f6c2..61bf73d 100644 +--- a/lib/Horde/Service/Weather/Parser/Metar.php ++++ b/lib/Horde/Service/Weather/Parser/Metar.php +@@ -545,10 +545,10 @@ protected function _parse(array $data) + 'presschng' => Horde_Service_Weather::convertPressure($result[2] / 10, 'hpa', $this->_unitMap[self::UNIT_KEY_PRESSURE]), + 'description' => ($result[1] >= 0 && $result[1] <=3) + ? Horde_Service_Weather_Translation::t('Rising') +- : ($result[1] == 4) ++ : (($result[1] == 4) + ? Horde_Service_Weather_Translation::t('Steady') +- : ($result[1] > 4) +- ? Horde_Service_Weather_Translation::t('Falling') : '' ++ : (($result[1] > 4) ++ ? Horde_Service_Weather_Translation::t('Falling') : '')) + ); + unset($metarCode['3hpresstend']); + break; +@@ -637,4 +637,4 @@ protected function _getRemarks() + ); + } + +-} +\ No newline at end of file ++} diff --git a/php-horde-Horde-Service-Weather.spec b/php-horde-Horde-Service-Weather.spec index a294c2d..23fb5d1 100644 --- a/php-horde-Horde-Service-Weather.spec +++ b/php-horde-Horde-Service-Weather.spec @@ -1,6 +1,6 @@ # remirepo/fedora spec file for php-horde-Horde-Service-Weather # -# Copyright (c) 2012-2017 Remi Collet +# Copyright (c) 2012-2019 Remi Collet # License: CC-BY-SA # http://creativecommons.org/licenses/by-sa/4.0/ # @@ -12,15 +12,15 @@ Name: php-horde-Horde-Service-Weather Version: 2.5.4 -Release: 1%{?dist} +Release: 7%{?dist} Summary: Horde Weather Provider -Group: Development/Libraries License: BSD URL: http://%{pear_channel} Source0: http://%{pear_channel}/get/%{pear_name}-%{version}.tgz -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +Patch0: https://patch-diff.githubusercontent.com/raw/horde/Service_Weather/pull/1.patch + BuildArch: noarch BuildRequires: gettext BuildRequires: php(language) >= 5.3.0 @@ -28,11 +28,21 @@ BuildRequires: php-pear(PEAR) BuildRequires: php-channel(%{pear_channel}) BuildRequires: php-pear(%{pear_channel}/Horde_Role) >= 1.0.0 # To run unit tests +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +BuildRequires: (php-pear(%{pear_channel}/Horde_Date) >= 2.0.0 with php-pear(%{pear_channel}/Horde_Date) < 3) +BuildRequires: (php-pear(%{pear_channel}/Horde_Exception) >= 2.0.0 with php-pear(%{pear_channel}/Horde_Exception) < 3) +BuildRequires: (php-pear(%{pear_channel}/Horde_Http) >= 2.0.0 with php-pear(%{pear_channel}/Horde_Http) < 3) +BuildRequires: (php-pear(%{pear_channel}/Horde_Translation) >= 2.2.0 with php-pear(%{pear_channel}/Horde_Translation) < 3) +BuildRequires: (php-pear(%{pear_channel}/Horde_Url) >= 2.0.0 with php-pear(%{pear_channel}/Horde_Url) < 3) +BuildRequires: (php-pear(%{pear_channel}/Horde_Serialize) >= 2.0.0 with php-pear(%{pear_channel}/Horde_Serialize) < 3) +BuildRequires: (php-pear(%{pear_channel}/Horde_Test) >= 2.1.0 with php-pear(%{pear_channel}/Horde_Test) < 3) +%else 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 +%endif Requires(post): %{__pear} Requires(postun): %{__pear} @@ -44,6 +54,15 @@ Requires: php-spl Requires: php-pear(PEAR) >= 1.7.0 Requires: php-channel(%{pear_channel}) Requires: php-pear(%{pear_channel}/Horde_Role) >= 1.0.0 +%if 0%{?fedora} >= 27 || 0%{?rhel} >= 8 +Requires: (php-pear(%{pear_channel}/Horde_Date) >= 2.0.0 with php-pear(%{pear_channel}/Horde_Date) < 3) +Requires: (php-pear(%{pear_channel}/Horde_Exception) >= 2.0.0 with php-pear(%{pear_channel}/Horde_Exception) < 3) +Requires: (php-pear(%{pear_channel}/Horde_Http) >= 2.0.0 with php-pear(%{pear_channel}/Horde_Http) < 3) +Requires: (php-pear(%{pear_channel}/Horde_Translation) >= 2.2.0 with php-pear(%{pear_channel}/Horde_Translation) < 3) +Requires: (php-pear(%{pear_channel}/Horde_Url) >= 2.0.0 with php-pear(%{pear_channel}/Horde_Url) < 3) +# Not documented, detected by phpci +Requires: (php-pear(%{pear_channel}/Horde_Serialize) >= 2.0.0 with php-pear(%{pear_channel}/Horde_Serialize) < 3) +%else 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 @@ -57,6 +76,7 @@ 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 +%endif Provides: php-pear(%{pear_channel}/%{pear_name}) = %{version} Provides: php-composer(horde/horde-service-weather) = %{version} @@ -72,12 +92,14 @@ WorldWeatherOnline, and Google Weather. %setup -q -c cd %{pear_name}-%{version} +%patch0 -p1 -b .pr1 # 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="[^"]*"//' \ + -e '/.php/s/md5sum="[^"]*"//' \ ../package.xml >%{name}.xml touch -r ../package.xml %{name}.xml @@ -93,7 +115,6 @@ done %install -rm -rf %{buildroot} cd %{pear_name}-%{version} %{__pear} install --nodeps --packagingroot %{buildroot} %{name}.xml @@ -116,28 +137,15 @@ done | tee ../%{pear_name}.lang %check cd %{pear_name}-%{version}/test/$(echo %{pear_name} | sed -e s:_:/:g) -# remirepo:11 -run=0 ret=0 -if which php56; then - php56 %{_bindir}/phpunit . || ret=1 - run=1 -fi -if which php71; then - php71 %{_bindir}/phpunit . || ret=1 - run=1 -fi -if [ $run -eq 0 ]; then -%{_bindir}/phpunit --verbose . -# remirepo:2 -fi +for cmd in php php71 php72 php73 php74; do + if which $cmd; then + $cmd %{_bindir}/phpunit --bootstrap bootstrap.php --verbose . || ret=1 + fi +done exit $ret -%clean -rm -rf %{buildroot} - - %post %{__pear} install --nodeps --soft --force --register-only \ %{pear_xmldir}/%{name}.xml >/dev/null || : @@ -150,7 +158,6 @@ fi %files -f %{pear_name}.lang -%defattr(-,root,root,-) %doc %{pear_docdir}/%{pear_name} %{pear_xmldir}/%{name}.xml %dir %{pear_phpdir}/Horde/Service @@ -159,12 +166,17 @@ fi %dir %{pear_datadir}/%{pear_name} %dir %{pear_datadir}/%{pear_name}/locale %{pear_datadir}/%{pear_name}/migration -%{pear_testdir}/%{pear_name} +%doc %{pear_testdir}/%{pear_name} %{pear_hordedir}/themes %{_bindir}/horde-service-weather-metar-database %changelog +* Mon Nov 18 2019 Remi Collet - 2.5.4-7 +- Fix FTBFS from Koschei, add patch for PHP 7.4 from + https://github.com/horde/Service_Weather/pull/1 +- use range dependencies + * Mon Feb 27 2017 Remi Collet - 2.5.4-1 - Update to 2.5.4 -- cgit