[commit: packages/Cabal] ghc-head: Similar absolute url fix for cabal-install (d65f199)

git at git.haskell.org git at git.haskell.org
Thu Jan 16 16:04:04 UTC 2014


Repository : ssh://git@git.haskell.org/Cabal

On branch  : ghc-head
Link       : http://git.haskell.org/packages/Cabal.git/commitdiff/d65f1994589a06f561ced66b5d198e08d3f62aba

>---------------------------------------------------------------

commit d65f1994589a06f561ced66b5d198e08d3f62aba
Author: Duncan Coutts <duncan at community.haskell.org>
Date:   Mon Dec 2 17:33:59 2013 +0000

    Similar absolute url fix for cabal-install
    
    In this case with index generation it's more benign, but still better
    to handle things consistently.


>---------------------------------------------------------------

d65f1994589a06f561ced66b5d198e08d3f62aba
 cabal-install/Distribution/Client/Haddock.hs |   17 ++++++++++-------
 1 file changed, 10 insertions(+), 7 deletions(-)

diff --git a/cabal-install/Distribution/Client/Haddock.hs b/cabal-install/Distribution/Client/Haddock.hs
index 802d533..ec47056 100644
--- a/cabal-install/Distribution/Client/Haddock.hs
+++ b/cabal-install/Distribution/Client/Haddock.hs
@@ -57,7 +57,7 @@ regenerateHaddockIndex verbosity pkgs conf index = do
                     , "--gen-index"
                     , "--odir=" ++ tempDir
                     , "--title=Haskell modules on this system" ]
-                 ++ [ "--read-interface=" ++ mkUrl html ++ "," ++ interface
+                 ++ [ "--read-interface=" ++ html ++ "," ++ interface
                     | (interface, html) <- paths ]
         rawSystemProgram verbosity confHaddock flags
         renameFile (tempDir </> "index.html") (tempDir </> destFile)
@@ -69,11 +69,6 @@ regenerateHaddockIndex verbosity pkgs conf index = do
             | (_pname, pkgvers) <- allPackagesByName pkgs
             , let pkgvers' = filter exposed pkgvers
             , not (null pkgvers') ]
-    -- See https://github.com/haskell/cabal/issues/1064
-    mkUrl f =
-      if isAbsolute f
-        then "file://" ++ f
-        else f
 
 haddockPackagePaths :: [InstalledPackageInfo]
                        -> IO ([(FilePath, FilePath)], Maybe String)
@@ -101,6 +96,14 @@ haddockPackagePaths pkgs = do
   where
     interfaceAndHtmlPath pkg = do
       interface <- listToMaybe (InstalledPackageInfo.haddockInterfaces pkg)
-      html <- listToMaybe (InstalledPackageInfo.haddockHTMLs pkg)
+      html <- fmap fixFileUrl
+                   (listToMaybe (InstalledPackageInfo.haddockHTMLs pkg))
       guard (not . null $ html)
       return (interface, html)
+    
+    -- the 'haddock-html' field in the hc-pkg output is often set as a
+    -- native path, but we need it as a URL.
+    -- See https://github.com/haskell/cabal/issues/1064
+    fixFileUrl f | isAbsolute f = "file://" ++ f
+                 | otherwise    = f
+



More information about the ghc-commits mailing list