Description: Update to use "catch" from Control.Exception
 Fixes FTBFS error due to removal of "catch" from Prelude. Includes fixes that
 are necessary now that catch takes any Exception, backported from latest
 version of Ganeti.
Author: Ben Lipton <ben.lipton@gmail.com>
Bug-Debian: http://bugs.debian.org/713754

Index: ganeti-2.5.2/htools/Ganeti/HTools/ExtLoader.hs
===================================================================
--- ganeti-2.5.2.orig/htools/Ganeti/HTools/ExtLoader.hs	2013-06-22 18:34:26.362454953 -0400
+++ ganeti-2.5.2/htools/Ganeti/HTools/ExtLoader.hs	2013-06-22 18:34:26.330454954 -0400
@@ -33,6 +33,7 @@
     , maybeSaveData
     ) where
 
+import Control.Exception
 import Control.Monad
 import Data.Maybe (isJust, fromJust)
 import System.FilePath
@@ -53,7 +54,7 @@
 
 -- | Error beautifier.
 wrapIO :: IO (Result a) -> IO (Result a)
-wrapIO = flip catch (return . Bad . show)
+wrapIO = handle (\e -> return . Bad . show $ (e :: IOException))
 
 -- | Parses a user-supplied utilisation string.
 parseUtilisation :: String -> Result (String, DynUtil)
Index: ganeti-2.5.2/htools/htools.hs
===================================================================
--- ganeti-2.5.2.orig/htools/htools.hs	2013-06-22 18:34:26.362454953 -0400
+++ ganeti-2.5.2/htools/htools.hs	2013-06-22 18:38:24.522451195 -0400
@@ -25,10 +25,13 @@
 
 module Main (main) where
 
+import Control.Exception
+import Control.Monad (guard)
 import Data.Char (toLower)
 import System.Environment
 import System.Exit
 import System.IO
+import System.IO.Error (isDoesNotExistError)
 
 import Ganeti.HTools.Utils
 import qualified Ganeti.HTools.Program.Hail as Hail
@@ -57,7 +60,8 @@
 
 main :: IO ()
 main = do
-  binary <- getEnv "HTOOLS" `catch` (\_ -> getProgName)
+  binary <- catchJust (guard . isDoesNotExistError)
+            (getEnv "HTOOLS") (const getProgName)
   let name = map toLower binary
       boolnames = map (\(x, y) -> (x == name, y)) personalities
   select (usage name) boolnames
