[kaya/f20] Rewrite ghc76 patch in a more portable way

Jochen Schmitt s4504kr at fedoraproject.org
Wed Aug 28 12:30:59 UTC 2013


commit f53910bde6323318b6d3b51394d4d6deae191132
Author: Jochen Schmitt <Jochen at herr-schmitt.de>
Date:   Wed Aug 28 14:30:42 2013 +0200

    Rewrite ghc76 patch in a more portable way

 kaya-0.5.2-ghc76.patch |  125 ++++++++++++++++++++++++++++++++++++-----------
 kaya.spec              |    5 ++-
 2 files changed, 99 insertions(+), 31 deletions(-)
---
diff --git a/kaya-0.5.2-ghc76.patch b/kaya-0.5.2-ghc76.patch
index 0d39325..ff9bf85 100644
--- a/kaya-0.5.2-ghc76.patch
+++ b/kaya-0.5.2-ghc76.patch
@@ -1,16 +1,21 @@
 diff -up kaya-0.5.2/compiler/CodegenCPP.hs.ghc76 kaya-0.5.2/compiler/CodegenCPP.hs
---- kaya-0.5.2/compiler/CodegenCPP.hs.ghc76	2013-08-28 10:49:13.712430846 +0200
-+++ kaya-0.5.2/compiler/CodegenCPP.hs	2013-08-28 10:49:13.769427124 +0200
+--- kaya-0.5.2/compiler/CodegenCPP.hs.ghc76	2013-08-28 13:42:51.055633773 +0200
++++ kaya-0.5.2/compiler/CodegenCPP.hs	2013-08-28 13:42:51.061633374 +0200
 @@ -17,6 +17,8 @@ import Debug.Trace
  import Lib
  import Data.List
  
-+import Control.Exception
++import Control.Exception as E
 +
  data Output = RawOutput String
  	    | FNOutput (Name, Type, String, [(ArgType, Var)], String)
  	    | ExternOutput (Name, Type)
-@@ -151,7 +153,7 @@ findFile (x:xs) path
+@@ -147,11 +149,11 @@ findFile :: [FilePath] -> FilePath -> IO
+ findFile [] path
+   = fail $ "Can't find " ++ path
+ findFile (x:xs) path 
+-  = catch
++  = E.catch
           (do --putStrLn $ "Trying " ++ x ++ path
  	     f <- readFile (x++path)
  	     return f)
@@ -20,42 +25,98 @@ diff -up kaya-0.5.2/compiler/CodegenCPP.hs.ghc76 kaya-0.5.2/compiler/CodegenCPP.
  writecpp :: [CompileResult] -> [Output]
  writecpp [] = []
 diff -up kaya-0.5.2/compiler/Driver.hs.ghc76 kaya-0.5.2/compiler/Driver.hs
---- kaya-0.5.2/compiler/Driver.hs.ghc76	2013-08-28 10:49:13.719430389 +0200
-+++ kaya-0.5.2/compiler/Driver.hs	2013-08-28 11:36:40.662637353 +0200
-@@ -37,6 +37,7 @@ import System.Random
+--- kaya-0.5.2/compiler/Driver.hs.ghc76	2013-08-28 13:42:51.056633706 +0200
++++ kaya-0.5.2/compiler/Driver.hs	2013-08-28 13:55:18.446111437 +0200
+@@ -31,12 +31,13 @@ import RunTests
+ 
+ import System.Cmd
+ import System.Exit
+-import System.Directory
++import qualified System.Directory as Dir
+ import Portability
+ import System.Random
  import System.IO
  import Debug.Trace
  import Data.List
-+import Control.Exception
++import Control.Exception as E
  import Control.Monad
  
  -- Compile a file, with extra options to gcc, and main options. Returns the
-@@ -68,8 +69,8 @@ compileFile prtype modname fn extra opts
-        catch (do startup <- getStartup prtype libdirs
-                  let pt = addToPT (parse newroot libdirs (prog++startup) fn) pinput 
-                  compile newroot libdirs opts pt extra mainfile)
+@@ -65,11 +66,11 @@ compileFile prtype modname fn extra opts
+ 	  -- Parse properly, using the real module name, and startup code.
+ 	  -- (This is a bit of a hack, but at least the last parse was mostly 
+ 	  -- lazy)
+-       catch (do startup <- getStartup prtype libdirs
+-                 let pt = addToPT (parse newroot libdirs (prog++startup) fn) pinput 
+-                 compile newroot libdirs opts pt extra mainfile)
 -             (\e -> do putStrLn (show e)
 -                       return CompError)
-+             (\ (e :: SomeException) -> do putStrLn (show e)
-+                                           return CompError)
++       E.catch (do startup <- getStartup prtype libdirs
++                   let pt = addToPT (parse newroot libdirs (prog++startup) fn) pinput 
++                   compile newroot libdirs opts pt extra mainfile)
++               (\ (e :: SomeException) -> do putStrLn (show e)
++                                             return CompError)
  
  outputfile Module mod = showuser mod ++ ".o"
  -- TMP HACK: This should probably be a %extension "cgi" directive in the .ks
+@@ -187,7 +188,7 @@ comp' t root libdirs opts ctxt okin extr
+              -- If we want a shared lib, make one in addition
+              res <- makeSO t (libflags libdirs ++ showlist ofiles ++ showlist linkopts) (outputfile t mod) ctxt infdata
+ 	     copyc (keepc opts) tmpn root
+-	     removeFile tmpn
++	     Dir.removeFile tmpn
+ 	     if (exit /= ExitSuccess) 
+ 		then return CompError -- exitWith exit
+ 	        else if (t==Module) then do
+@@ -283,8 +284,8 @@ execTests root ok pri opts = do
+                          fpath ["-o", fout] 
+                          (tfilter (NoChase:opts)) True 
+       runthem <- system fout
+-      removeFile fpath
+-      removeFile fout
++      Dir.removeFile fpath
++      Dir.removeFile fout
+       if (runthem /= ExitSuccess)
+           then return CompError
+           else return res
 diff -up kaya-0.5.2/compiler/Module.hs.ghc76 kaya-0.5.2/compiler/Module.hs
---- kaya-0.5.2/compiler/Module.hs.ghc76	2013-08-28 10:49:13.738429149 +0200
-+++ kaya-0.5.2/compiler/Module.hs	2013-08-28 10:49:13.774426798 +0200
+--- kaya-0.5.2/compiler/Module.hs.ghc76	2013-08-28 13:42:51.057633640 +0200
++++ kaya-0.5.2/compiler/Module.hs	2013-08-28 13:42:51.061633374 +0200
 @@ -14,8 +14,9 @@ module Module(importVersion, findFile, f
                getAllLibDirs, linkFiles, getObjs) where
  
  import Language
-+import Control.Exception
++import Control.Exception as E
  import Debug.Trace
 -import System.Directory
-+import System.Directory hiding (findFile)
++import qualified System.Directory as Dir
  import Data.List
  import Lib
  import Options
-@@ -252,7 +253,7 @@ findFile (x:xs) path
+@@ -223,7 +224,7 @@ getObjs p fp dls = do (fp,libs) <- go' p
+ 	      = fail $ "No such module " ++ path
+ 	  findFile (x:xs) path 
+ 	      = do --putStrLn $ "Looking in " ++ (x++path)
+-		   exist <- doesFileExist (x++path)
++		   exist <- Dir.doesFileExist (x++path)
+ 		   if exist 
+ 		      then return (x++path)
+ 		      else findFile xs path
+@@ -237,7 +238,7 @@ findLib :: [FilePath] -> FilePath -> IO
+ findLib [] path
+   = return Nothing -- fail $ "Can't find " ++ path
+ findLib (x:xs) path 
+-  = do ex <- doesFileExist (x++path)
++  = do ex <- Dir.doesFileExist (x++path)
+        if ex then return $ Just (x++path)
+ 	  else findLib xs path
+ 
+@@ -248,11 +249,11 @@ findFile :: [FilePath] -> FilePath -> IO
+ findFile [] path
+   = return Nothing
+ findFile (x:xs) path 
+-  = catch
++  = E.catch
           (do --putStrLn $ "Trying " ++ x ++ path
  	     f <- readFile (x++path)
  	     return (Just f))
@@ -66,41 +127,45 @@ diff -up kaya-0.5.2/compiler/Module.hs.ghc76 kaya-0.5.2/compiler/Module.hs
  -- KAYA_LIBRARY_PATH environment variable.
 diff -up kaya-0.5.2/compiler/Portability64.hs.ghc76 kaya-0.5.2/compiler/Portability64.hs
 --- kaya-0.5.2/compiler/Portability64.hs.ghc76	2009-04-12 12:02:24.000000000 +0200
-+++ kaya-0.5.2/compiler/Portability64.hs	2013-08-28 10:49:13.777426602 +0200
++++ kaya-0.5.2/compiler/Portability64.hs	2013-08-28 13:42:51.061633374 +0200
 @@ -5,12 +5,14 @@ import System.IO
  import System.Environment
  import qualified Data.Map as Map
  
-+import Control.Exception
++import Control.Exception as E
 +
  -- GHC 6.4 and above library incompatibilities.
  
  environment :: String -> IO (Maybe String)
- environment x = catch (do e <- getEnv x
- 		          return (Just e))
+-environment x = catch (do e <- getEnv x
+-		          return (Just e))
 -		      (\_ -> return Nothing)
-+		      ( \ ( _ :: SomeException) -> return Nothing)
++environment x = E.catch (do e <- getEnv x
++		            return (Just e))
++		        ( \ ( _ :: SomeException) -> return Nothing)
  
  tempfile :: IO (FilePath, Handle)
  tempfile = do env <- environment "TMPDIR"
 diff -up kaya-0.5.2/compiler/REPL.hs.in.ghc76 kaya-0.5.2/compiler/REPL.hs.in
---- kaya-0.5.2/compiler/REPL.hs.in.ghc76	2013-08-28 10:49:13.750428365 +0200
-+++ kaya-0.5.2/compiler/REPL.hs.in	2013-08-28 10:49:13.780426406 +0200
+--- kaya-0.5.2/compiler/REPL.hs.in.ghc76	2013-08-28 13:42:51.058633573 +0200
++++ kaya-0.5.2/compiler/REPL.hs.in	2013-08-28 13:42:51.062633308 +0200
 @@ -35,6 +35,8 @@ import System.IO
  import @readlinemodule@
  import System.Directory
  
-+import Control.Exception
++import Control.Exception as E
 +
  foreign import ccall "repl_load.h" interp_load :: Ptr CChar -> IO ()
  foreign import ccall "repl_load.h" interp_close :: IO ()
  foreign import ccall "repl_load.h" interp_clear :: IO ()
-@@ -160,7 +162,7 @@ runREPL so mod libdirs ctxt ectxt gctxt
+@@ -159,8 +161,8 @@ runREPL so mod libdirs ctxt ectxt gctxt
+                      phi <- mkSubst xeq
                       xfn <- substTerm mod ctxt phi xrv
                       let xinft = subst phi ity
-                      catch (runProg xfn xinft)
+-                     catch (runProg xfn xinft)
 -                           (\e -> putStrLn(show e))
-+                           (\ (e :: SomeException)  -> putStrLn(show e))
++                     E.catch (runProg xfn xinft)
++                             (\ (e :: SomeException)  -> putStrLn(show e))
                    Failure err file line -> do reportError err
      processREPL (Failure err file line)
          = do reportError err
diff --git a/kaya.spec b/kaya.spec
index d1b07fd..9008a0b 100644
--- a/kaya.spec
+++ b/kaya.spec
@@ -4,7 +4,7 @@
 
 Name:		kaya
 Version:	0.5.2
-Release:	19%{?dist}
+Release:	20%{?dist}
 Summary:	A Statically typed, imperative programming-language
 
 Group:		Development/Languages
@@ -126,6 +126,9 @@ make test ||:
 %doc examples/ docs/
 
 %changelog
+* Wed Aug 28 2013 Jochen Schmitt <Jochen herr-schmitt de> - 0.5.2-20
+- Rewrite ghc76 patch in a more portable way
+
 * Sat Aug 03 2013 Fedora Release Engineering <rel-eng at lists.fedoraproject.org> - 0.5.2-19
 - Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild
 - Remove -fstack-protector-stong, Fix BZ #995626


More information about the scm-commits mailing list