Permalink
Browse files

www-apps/gitit: pull patch from upstream fixing ghc-7.6 support

Signed-off-by: Sergei Trofimovich <slyfox@gentoo.org>
  • Loading branch information...
trofi committed Dec 9, 2012
1 parent 92c1d03 commit 3e8a06065388eb4a663ed2b5e60f08985d0c7c99
Showing with 97 additions and 4 deletions.
  1. +90 −0 www-apps/gitit/files/gitit-0.10.0.2-directory-1.2.patch
  2. +7 −4 www-apps/gitit/gitit-0.10.0.2-r1.ebuild
@@ -0,0 +1,90 @@
+commit 2b41606d3b14a444f8c0adb40219a136d288f1a1
+Author: Bin Jin <bjin@ctrl-d.org>
+Date: Tue Nov 6 02:38:51 2012 +0800
+
+ Upgrade directory package dependency to 1.2
+
+ Fix compilation issue with GHC 7.6.1. In newer version of directory,
+ `getModificationTime` used `UTCTime` from time package as result
+ type. This change breaks the build of gitit.
+
+diff --git a/Network/Gitit/Cache.hs b/Network/Gitit/Cache.hs
+index 524f95d..01eb90f 100644
+--- a/Network/Gitit/Cache.hs
++++ b/Network/Gitit/Cache.hs
+@@ -27,7 +27,7 @@ where
+ import qualified Data.ByteString as B (ByteString, readFile, writeFile)
+ import System.FilePath
+ import System.Directory (doesFileExist, removeFile, createDirectoryIfMissing, getModificationTime)
+-import System.Time (ClockTime)
++import Data.Time.Clock (UTCTime)
+ import Network.Gitit.State
+ import Network.Gitit.Types
+ import Control.Monad
+@@ -53,7 +53,7 @@ expireCachedPDF file =
+ exists <- doesFileExist pdfname
+ when exists $ removeFile pdfname
+
+-lookupCache :: String -> GititServerPart (Maybe (ClockTime, B.ByteString))
++lookupCache :: String -> GititServerPart (Maybe (UTCTime, B.ByteString))
+ lookupCache file = do
+ cfg <- getConfig
+ let target = encodeString $ cacheDir cfg </> file
+diff --git a/Network/Gitit/Handlers.hs b/Network/Gitit/Handlers.hs
+index d82800d..13b66f5 100644
+--- a/Network/Gitit/Handlers.hs
++++ b/Network/Gitit/Handlers.hs
+@@ -64,7 +64,6 @@ import Network.Gitit.ContentTransformer (showRawPage, showFileAsText, showPage,
+ exportPage, showHighlightedSource, preview, applyPreCommitPlugins)
+ import Network.Gitit.Page (readCategories)
+ import Control.Exception (throwIO, catch, try)
+-import System.Time
+ import System.FilePath
+ import Prelude hiding (catch)
+ import Network.Gitit.State
+@@ -78,7 +77,7 @@ import Control.Monad.Reader
+ import qualified Data.ByteString.Lazy as B
+ import qualified Data.ByteString as S
+ import Network.HTTP (urlEncodeVars)
+-import Data.Time (getCurrentTime, addUTCTime)
++import Data.Time.Clock
+ import Data.FileStore
+ import System.Log.Logger (logM, Priority(..))
+
+@@ -117,9 +116,9 @@ randomPage = do
+ if null pages
+ then error "No pages found!"
+ else do
+- TOD _ picosecs <- liftIO getClockTime
++ secs <- liftIO (fmap utctDayTime getCurrentTime)
+ let newPage = pages !!
+- ((fromIntegral picosecs `div` 1000000) `mod` length pages)
++ (truncate (secs * 1000000) `mod` length pages)
+ seeOther (base' ++ urlForPage newPage) $ toResponse $
+ p << "Redirecting to a random page"
+
+@@ -769,9 +768,8 @@ feedHandler = do
+ let file = (path' `orIfNull` "_site") <.> "feed"
+ let mbPath = if null path' then Nothing else Just path'
+ -- first, check for a cached version that is recent enough
+- now <- liftIO $ getClockTime
+- let isRecentEnough t = normalizeTimeDiff (diffClockTimes now t) <
+- normalizeTimeDiff (noTimeDiff{tdMin = fromIntegral $ feedRefreshTime cfg})
++ now <- liftIO $ getCurrentTime
++ let isRecentEnough t = truncate (diffUTCTime now t) < 60 * feedRefreshTime cfg
+ mbCached <- lookupCache file
+ case mbCached of
+ Just (modtime, contents) | isRecentEnough modtime -> do
+diff --git a/gitit.cabal b/gitit.cabal
+index 0bbc86e..a07df5d 100644
+--- a/gitit.cabal
++++ b/gitit.cabal
+@@ -138,7 +138,7 @@ Executable gitit
+ pandoc-types >= 1.9.0.2 && < 1.10,
+ process,
+ filepath,
+- directory,
++ directory >= 1.2,
+ mtl,
+ cgi,
+ old-time,
@@ -62,14 +62,17 @@ RDEPEND=">=app-text/pandoc-1.9.0.5:=[profile?]
>=dev-haskell/xml-1.3.5:=[profile?]
=dev-haskell/xss-sanitize-0.3*:=[profile?]
=dev-haskell/zlib-0.5*:=[profile?]
- >=dev-lang/ghc-6.10.4:="
+ >=dev-lang/ghc-7.6.1:="
+# can be restored with time-compat
+# >=dev-lang/ghc-6.10.4:="
DEPEND="${RDEPEND}
>=dev-haskell/cabal-1.6"
src_prepare() {
- SHA > 1 && < 1.6
- sed -e 's@SHA > 1 && < 1.6@SHA > 1 \&\& < 1.7@' \
- -i "${S}/${PN}.cabal" || die "Could not loosen dependencies"
+ epatch "${FILESDIR}"/${P}-directory-1.2.patch
+
+ cabal_chdeps \
+ 'SHA > 1 && < 1.6' 'SHA > 1 && < 1.7'
}
src_configure() {

0 comments on commit 3e8a060

Please sign in to comment.