Open wavewave opened 11 years ago
I made a patch for this. This build error was caused because the output type of System.Directory.getModificationTime is changed from ClockTime to UTCTime (which is in time package) It is necessary to make a conversion function from UTCTime to ClockTime. I copied some code from convertible-text
package. But using ClockTime from System.Time must be deprecated as I understand, so probably changing to Data.Time.Clock.UTCTime is better, I think.
diff -Naur buildwrapper-0.7.0/src/Language/Haskell/BuildWrapper/GHC.hs buildwrapper-0.7.0-new/src/Language/Haskell/BuildWrapper/GHC.hs
--- buildwrapper-0.7.0/src/Language/Haskell/BuildWrapper/GHC.hs 2013-02-26 16:51:53.663119702 -0500
+++ buildwrapper-0.7.0-new/src/Language/Haskell/BuildWrapper/GHC.hs 2013-02-26 17:09:52.498912226 -0500
@@ -67,9 +67,18 @@
import System.IO (hFlush, stdout)
import System.Directory (getModificationTime)
import System.Time (ClockTime(TOD))
+--
+import Data.Time.Clock.POSIX
type GHCApplyFunction a=FilePath -> TypecheckedModule -> Ghc a
+convertPOSIXTimeToClockTime :: POSIXTime -> ClockTime
+convertPOSIXTimeToClockTime x = TOD rsecs rpico
+ where rsecs = floor x
+ rpico = truncate $ abs $ 1000000000000 * (x - (fromIntegral rsecs))
+
+
+
-- | get the GHC typechecked AST
getAST :: FilePath -- ^ the source file
-> FilePath -- ^ the base directory
@@ -345,7 +354,7 @@
where
go :: ClockTime -> Ghc ()
go t1 = do
- t2<- GMU.liftIO $ getModificationTime fp
+ t2<- fmap (convertPOSIXTimeToClockTime . utcTimeToPOSIXSeconds) (GMU.liftIO $ getModificationTime fp)
let hasLoaded=case t1 of
TOD 0 _ -> False
_ -> True
@@ -1233,4 +1242,4 @@
formatInfo=foldr getFormatInfo (0,0,0,0,0) fivs
in map (formatImport formatInfo) fivs
-
\ No newline at end of file
+
Yes, but it still needs to work with previous version of GHC, where getModificationTime returns a ClockTime. I've committed a change and uploaded 0.7.1, let me know if that solves the issue.
Hi, I've checked that the new version 0.7.1 compiles well on my computer! Thanks.
buildwrapper-0.7.0 has the following build error. On the other hand, I successfully installed buildwrapper-0.6.4 on my system. (ghc-7.6.1, linux x86-64) I think the same error message happens in hackage build log, too.