Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Upgrade directory package dependency to 1.2 #327

Merged
merged 1 commit into from

3 participants

Bin Jin John MacFarlane Charlie Allom
Bin Jin

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.

Bin Jin bjin 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.
2b41606
John MacFarlane jgm merged commit f3ce6fb into from
John MacFarlane
Owner

I just realized that there is a problem with requiring directory >= 1.2. This works fine with ghc 7.6, but not with 7.4, which is the version in the current Haskell Platform. (It is possible to compile against directory 1.2 even with ghc 7.4, but this causes problems when you try to use plugins.)

Is it possible to add code with CPP MIN_VERSION_directory so that gitit could work with directory versions < 1.2 as well?

John MacFarlane
Owner
jgm commented

Update: I've made the modifications myself and will soon release an update.

Charlie Allom

is this the issue i am having on debian squeeze?

15:02 wiki:~% sudo cabal install gitit
Resolving dependencies...
cabal: cannot configure zip-archive-0.1.3.4. It requires directory >=1.1
For the dependency on directory >=1.1 there are these packages:
directory-1.1.0.0, directory-1.1.0.1, directory-1.1.0.2, directory-1.2.0.0 and
directory-1.2.0.1. However none of them are available.
directory-1.1.0.0 was excluded because process-1.0.1.2 requires directory
==1.0.1.0
directory-1.1.0.0 was excluded because hpc-0.5.0.4 requires directory
==1.0.1.0
directory-1.1.0.0 was excluded because directory-1.0.1.0 was selected instead
directory-1.1.0.0 was excluded because bin-package-db-0.0.0.0 requires
directory ==1.0.1.0
directory-1.1.0.0 was excluded because Cabal-1.8.0.2 requires directory
==1.0.1.0
directory-1.1.0.0 was excluded because ghc-6.12.1 requires directory ==1.0.1.0
directory-1.1.0.1 was excluded because process-1.0.1.2 requires directory
==1.0.1.0
directory-1.1.0.1 was excluded because hpc-0.5.0.4 requires directory
==1.0.1.0
directory-1.1.0.1 was excluded because directory-1.0.1.0 was selected instead
directory-1.1.0.1 was excluded because bin-package-db-0.0.0.0 requires
directory ==1.0.1.0
directory-1.1.0.1 was excluded because Cabal-1.8.0.2 requires directory
==1.0.1.0
directory-1.1.0.1 was excluded because ghc-6.12.1 requires directory ==1.0.1.0
directory-1.1.0.2 was excluded because process-1.0.1.2 requires directory
==1.0.1.0
directory-1.1.0.2 was excluded because hpc-0.5.0.4 requires directory
==1.0.1.0
directory-1.1.0.2 was excluded because directory-1.0.1.0 was selected instead
directory-1.1.0.2 was excluded because bin-package-db-0.0.0.0 requires
directory ==1.0.1.0
directory-1.1.0.2 was excluded because Cabal-1.8.0.2 requires directory
==1.0.1.0
directory-1.1.0.2 was excluded because ghc-6.12.1 requires directory ==1.0.1.0
directory-1.2.0.0 was excluded because process-1.0.1.2 requires directory
==1.0.1.0
directory-1.2.0.0 was excluded because hpc-0.5.0.4 requires directory
==1.0.1.0
directory-1.2.0.0 was excluded because directory-1.0.1.0 was selected instead
directory-1.2.0.0 was excluded because bin-package-db-0.0.0.0 requires
directory ==1.0.1.0
directory-1.2.0.0 was excluded because Cabal-1.8.0.2 requires directory
==1.0.1.0
directory-1.2.0.0 was excluded because ghc-6.12.1 requires directory ==1.0.1.0
directory-1.2.0.1 was excluded because process-1.0.1.2 requires directory
==1.0.1.0
directory-1.2.0.1 was excluded because hpc-0.5.0.4 requires directory
==1.0.1.0
directory-1.2.0.1 was excluded because directory-1.0.1.0 was selected instead
directory-1.2.0.1 was excluded because bin-package-db-0.0.0.0 requires
directory ==1.0.1.0
directory-1.2.0.1 was excluded because Cabal-1.8.0.2 requires directory
==1.0.1.0
directory-1.2.0.1 was excluded because ghc-6.12.1 requires directory ==1.0.1.0
15:02 wiki:~%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 5, 2012
  1. Bin Jin

    Upgrade directory package dependency to 1.2

    bjin authored
    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.
This page is out of date. Refresh to see the latest.
4 Network/Gitit/Cache.hs
View
@@ -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
12 Network/Gitit/Handlers.hs
View
@@ -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
2  gitit.cabal
View
@@ -138,7 +138,7 @@ Executable gitit
pandoc-types >= 1.9.0.2 && < 1.10,
process,
filepath,
- directory,
+ directory >= 1.2,
mtl,
cgi,
old-time,
Something went wrong with that request. Please try again.