[hedgewars] Work around Text.Show.ByteString not being available

Bruno Wolff III bruno at fedoraproject.org
Sun Jan 1 21:47:05 UTC 2012


commit 862ceed5f4be6b441bb5333c1f4e344827badb50
Author: Bruno Wolff III <bruno at wolff.to>
Date:   Sun Jan 1 14:30:56 2012 -0600

    Work around Text.Show.ByteString not being available
    
    We don't have the library which provides Text.Show.ByteString
    packaged in Fedora. Debian had already done a similar work around
    and we are using a trimmed down version of their patch to do
    the same work around.

 hedgewars-no-bytestring.patch |   61 +++++++++++++++++++++++++++++++++++++++++
 hedgewars.spec                |    9 ++++++
 2 files changed, 70 insertions(+), 0 deletions(-)
---
diff --git a/hedgewars-no-bytestring.patch b/hedgewars-no-bytestring.patch
new file mode 100644
index 0000000..e341595
--- /dev/null
+++ b/hedgewars-no-bytestring.patch
@@ -0,0 +1,61 @@
+--- hedgewars-0.9.17.orig/gameServer/Actions.hs	2011-11-22 17:57:10.482642522 -0800
++++ hedgewars-0.9.17/gameServer/Actions.hs	2011-11-22 17:57:11.838642515 -0800
+@@ -1,4 +1,4 @@
+-{-# LANGUAGE CPP, OverloadedStrings #-}
++{-# LANGUAGE CPP, OverloadedStrings, RankNTypes #-}
+ module Actions where
+ 
+ import Control.Concurrent
+@@ -85,6 +85,11 @@
+     ri <- clientRoomA
+     liftM (map sendChan . filter (/= cl)) $ roomClientsS ri
+ 
++exceptionMask:: ((forall a. IO a -> IO a) -> IO b) -> IO b
++exceptionMask io = do
++    b <- blocked
++    if b then io id else block (io unblock)
++
+ processAction :: Action -> StateT ServerState IO ()
+ 
+ 
+@@ -429,7 +434,7 @@
+     si <- gets serverInfo
+     newClId <- io $ do
+         ci <- addClient rnc cl
+-        _ <- Exception.mask (forkIO . clientRecvLoop (clientSocket cl) (coreChan si) (sendChan cl) ci)
++        _ <- exceptionMask (forkIO . clientRecvLoop (clientSocket cl) (coreChan si) (sendChan cl) ci)
+ 
+         infoM "Clients" (show ci ++ ": New client. Time: " ++ show (connectTime cl))
+ 
+--- hedgewars-0.9.17.orig/gameServer/ClientIO.hs	2011-11-22 17:57:10.502642524 -0800
++++ hedgewars-0.9.17/gameServer/ClientIO.hs	2011-11-22 17:57:11.838642515 -0800
+@@ -22,7 +22,7 @@
+ takePacks :: State B.ByteString [[B.ByteString]]
+ takePacks
+   = do modify (until (not . B.isPrefixOf pDelim) (B.drop 2))
+-       packet <- state $ B.breakSubstring pDelim
++       packet <- State $ B.breakSubstring pDelim
+        buf <- get
+        if B.null buf then put packet >> return [] else
+         if B.null packet then  return [] else
+--- hedgewars-0.9.17.orig/gameServer/Utils.hs	2011-11-22 17:57:10.530642521 -0800
++++ hedgewars-0.9.17/gameServer/Utils.hs	2011-11-22 17:57:11.842642515 -0800
+@@ -13,7 +13,6 @@
+ import Control.Monad
+ import qualified Codec.Binary.Base64 as Base64
+ import qualified Data.ByteString.Lazy as BL
+-import qualified Text.Show.ByteString as BS
+ import qualified Data.ByteString.Char8 as B
+ import qualified Data.ByteString.UTF8 as UTF8
+ import qualified Data.ByteString as BW
+@@ -105,8 +104,8 @@
+         Right (a, new_b) -> let (a', b') = unfoldrE f new_b in (a : a', b')
+         Left new_b       -> ([], new_b)
+ 
+-showB :: (BS.Show a) => a -> B.ByteString
+-showB = B.concat . BL.toChunks . BS.show
++showB :: (Show a) => a -> B.ByteString
++showB = B.pack . show
+ 
+ readInt_ :: (Num a) => B.ByteString -> a
+ readInt_ str =
diff --git a/hedgewars.spec b/hedgewars.spec
index 8b14fbe..0ca3480 100644
--- a/hedgewars.spec
+++ b/hedgewars.spec
@@ -9,6 +9,13 @@ Source0:        http://hedgewars.org/download/hedgewars-src-%{version}.tar.bz2
 Source1:        %{name}.desktop
 Source2:        %{name}.png
 Patch0:         hedgewars-compiler-opts.patch
+# Text.Show.ByteString currently isn't available in Fedora and for the
+# the time being we need to use a patch to have hedgewars-server not
+# use that function.
+# The patch below is a trimmed version of the patch Debian is using
+# avoid the same issue. The original patch is available from:
+# https://launchpadlibrarian.net/85736468/hedgewars_0.9.17-1~maverick0.1.debdiff
+Patch1:         hedgewars-no-bytestring.patch
 BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
 BuildRequires:  fpc qt4-devel SDL_mixer-devel SDL_net-devel SDL_image-devel
 BuildRequires:  SDL_ttf-devel openssl-devel cmake desktop-file-utils
@@ -46,6 +53,7 @@ A standalone server that can be used for LAN play or a private internet server.
 %prep
 %setup -q -n %{name}-src-%{version}
 %patch0
+%patch1 -p1
 
 %build
 %cmake -DWITH_SERVER=1 .
@@ -111,6 +119,7 @@ fi
 - Changelog at http://code.google.com/p/hedgewars/source/browse/ChangeLog.txt
 - 0.9.16 release announcement: http://www.hedgewars.org/node/3291
 - 0.9.17 release announcement: http://www.hedgewars.org/node/3405
+- Use modified Debian patch to work around Text.Show.ByteString not being available
 
 * Fri Oct 21 2011 Marcela Mašláňová <mmaslano at redhat.com> - 0.9.15-10.2
 - rebuild with new gmp without compat lib


More information about the scm-commits mailing list