svn commit: r494509 - in head/x11/hs-xmobar: . files

Mahdi Mokhtari mmokhi at FreeBSD.org
Sun Mar 3 13:58:02 UTC 2019


Author: mmokhi
Date: Sun Mar  3 13:58:00 2019
New Revision: 494509
URL: https://svnweb.freebsd.org/changeset/ports/494509

Log:
  x11/hs-xmobar: Fix the weather plugin
  Since the source weather plugin uses switched fully to SSL
  the plugin (using HTTP) fails.
  The fix by upstream is to omit HTTP_CONDUIT flag on the plugin.
  It is backported from upstream here, until their next release.
  
  Reviewed by:	arrowd (maintainer, Haskell@)
  Approved by:	arrowd (maintainer, Haskell@)
  Sponsored by:	The FreeBSD Foundation
  Differential Revision:	https://reviews.freebsd.org/D19403

Added:
  head/x11/hs-xmobar/files/
  head/x11/hs-xmobar/files/patch-fix_bug378.diff   (contents, props changed)
Modified:
  head/x11/hs-xmobar/Makefile

Modified: head/x11/hs-xmobar/Makefile
==============================================================================
--- head/x11/hs-xmobar/Makefile	Sun Mar  3 13:40:50 2019	(r494508)
+++ head/x11/hs-xmobar/Makefile	Sun Mar  3 13:58:00 2019	(r494509)
@@ -3,7 +3,7 @@
 
 PORTNAME=	xmobar
 PORTVERSION=	0.29.4
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	x11 haskell
 
 MAINTAINER=	haskell at FreeBSD.org

Added: head/x11/hs-xmobar/files/patch-fix_bug378.diff
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/x11/hs-xmobar/files/patch-fix_bug378.diff	Sun Mar  3 13:58:00 2019	(r494509)
@@ -0,0 +1,104 @@
+Index: src/Xmobar/Plugins/Monitors/Weather.hs
+==============================================================================
+--- src/Xmobar/Plugins/Monitors/Weather.hs.orig	2018-11-21 23:52:35 UTC
++++ src/Xmobar/Plugins/Monitors/Weather.hs
+@@ -19,14 +19,10 @@ import Xmobar.Plugins.Monitors.Common
+ 
+ import qualified Control.Exception as CE
+ 
+-#ifdef HTTP_CONDUIT
+ import Network.HTTP.Conduit
+ import Network.HTTP.Types.Status
+ import Network.HTTP.Types.Method
+ import qualified Data.ByteString.Lazy.Char8 as B
+-#else
+-import Network.HTTP
+-#endif
+ 
+ import Text.ParserCombinators.Parsec
+ 
+@@ -190,7 +186,6 @@ stationUrl :: String -> String
+ stationUrl station = defUrl ++ station ++ ".TXT"
+ 
+ getData :: String -> IO String
+-#ifdef HTTP_CONDUIT
+ getData station = CE.catch (do
+     manager <- newManager tlsManagerSettings
+     request <- parseUrl $ stationUrl station
+@@ -199,13 +194,6 @@ getData station = CE.catch (do
+     ) errHandler
+     where errHandler :: CE.SomeException -> IO String
+           errHandler _ = return "<Could not retrieve data>"
+-#else
+-getData station = do
+-    let request = getRequest (stationUrl station)
+-    CE.catch (simpleHTTP request >>= getResponseBody) errHandler
+-    where errHandler :: CE.IOException -> IO String
+-          errHandler _ = return "<Could not retrieve data>"
+-#endif
+ 
+ formatWeather :: [WeatherInfo] -> Monitor String
+ formatWeather [WI st ss y m d h (WindInfo wc wa wm wk wkh wms) v sk tC tF dC dF r p] =
+@@ -221,7 +209,6 @@ runWeather str =
+        formatWeather i
+ 
+ weatherReady :: [String] -> Monitor Bool
+-#ifdef HTTP_CONDUIT
+ weatherReady str = do
+     initRequest <- parseUrl $ stationUrl $ head str
+     let request = initRequest{method = methodHead}
+@@ -235,21 +222,3 @@ weatherReady str = do
+             | statusIsServerError status = False
+             | statusIsClientError status = False
+             | otherwise = True
+-#else
+-weatherReady str = do
+-    let station = head str
+-        request = headRequest (stationUrl station)
+-    io $ CE.catch (simpleHTTP request >>= checkResult) errHandler
+-    where errHandler :: CE.IOException -> IO Bool
+-          errHandler _ = return False
+-          checkResult result =
+-            case result of
+-                Left _ -> return False
+-                Right response ->
+-                    case rspCode response of
+-                        -- Permission or network errors are failures; anything
+-                        -- else is recoverable.
+-                        (4, _, _) -> return False
+-                        (5, _, _) -> return False
+-                        (_, _, _) -> return True
+-#endif
+Index: xmobar.cabal
+==============================================================================
+--- xmobar.cabal.orig	2018-12-24 02:06:23 UTC
++++ xmobar.cabal
+@@ -87,10 +87,6 @@ flag with_weather
+   description: Enable weather plugin.
+   default: True
+ 
+-flag with_conduit
+-  description: Use http-conduits for weather data, used only if with_weather.
+-  default: False
+-
+ library
+     hs-source-dirs:  src
+ 
+@@ -251,15 +247,11 @@ library
+        cpp-options: -DXPM
+ 
+     if flag(with_weather) || flag(all_extensions)
+-       build-depends: HTTP >= 4000.2.4
+        exposed-modules: Xmobar.Plugins.Monitors.Weather
+        cpp-options: -DWEATHER
+-       if flag(with_conduit)
+-          -- use http-conduit  instead of simple-http
+-          build-depends: http-conduit, http-types
+-          cpp-options: -DHTTP_CONDUIT
++       build-depends: http-conduit, http-types
+ 
+-    if flag(with_uvmeter) && flag(with_conduit)
++    if flag(with_uvmeter)
+        exposed-modules: Xmobar.Plugins.Monitors.UVMeter
+        build-depends: http-conduit, http-types
+        cpp-options: -DUVMETER


More information about the svn-ports-all mailing list