[Pkg-haskell-commits] darcs: haskell-devscripts: Put txt files on /usr/lib/ghc-doc/hoogle dir.
kiwamu at debian.or.jp
kiwamu at debian.or.jp
Thu Oct 4 13:13:48 UTC 2012
Thu Oct 4 13:10:40 UTC 2012 kiwamu at debian.or.jp
* Put txt files on /usr/lib/ghc-doc/hoogle dir.
Ignore-this: 8ee9dcff79d364c7f9c4412db1601d0
./haddock-collect.hs -> ./haddock-collect
M ./debian/install +1
M ./hlibrary.mk +7
Thu Oct 4 13:10:40 UTC 2012 kiwamu at debian.or.jp
* Put txt files on /usr/lib/ghc-doc/hoogle dir.
Ignore-this: 8ee9dcff79d364c7f9c4412db1601d0
diff -rN -u old-haskell-devscripts//debian/install new-haskell-devscripts//debian/install
--- old-haskell-devscripts//debian/install 2012-10-04 13:13:48.319926440 +0000
+++ new-haskell-devscripts//debian/install 2012-10-04 13:13:48.327943459 +0000
@@ -2,5 +2,6 @@
dh_haskell_depends usr/bin/
dh_haskell_shlibdeps usr/bin/
dh_haskell_extra_depends usr/bin/
+haddock-collect usr/bin/
Dh_Haskell.sh usr/share/haskell-devscripts/
hlibrary.mk usr/share/cdbs/1/class
diff -rN -u old-haskell-devscripts//haddock-collect new-haskell-devscripts//haddock-collect
--- old-haskell-devscripts//haddock-collect 1970-01-01 00:00:00.000000000 +0000
+++ new-haskell-devscripts//haddock-collect 2012-10-04 13:13:48.335184657 +0000
@@ -0,0 +1,55 @@
+#!/usr/bin/runhaskell
+{-# OPTIONS -Wall #-}
+
+import Data.List
+import Data.Char
+import Data.Maybe
+import System.Environment
+import System.FilePath
+--import qualified Data.ByteString.Lazy as BL
+--import qualified Data.ByteString.Lazy.Char8 as BL8
+--import Codec.Compression.GZip
+
+type URL = String
+
+-- copy from hoogle/src/Recipe/Hackage.hs
+haddockHacks :: [String] -> [String]
+haddockHacks = map (unwords . map f . words) . filter (not . isPrefixOf "@version ")
+ where
+ f "::" = "::"
+ f (':':xs) = "(:" ++ xs ++ ")"
+ f ('!':'!':x:xs) | isAlpha x = xs
+ f ('!':x:xs) | isAlpha x || x `elem` "[(" = x:xs
+ f x | x `elem` ["[overlap","ok]","[incoherent]"] = ""
+ f x = x
+
+haddockPackageUrl :: URL -> [String] -> [String]
+haddockPackageUrl x = concatMap f
+ where f y | "@package " `isPrefixOf` y = ["@url " ++ x, y]
+ | otherwise = [y]
+-- copy end
+
+filterHaddock :: URL -> String -> String
+filterHaddock url = unlines . haddockHacks . haddockPackageUrl url . lines
+
+readFileGz :: FilePath -> IO String
+readFileGz file
+-- | takeExtension file == ".gz" = do
+-- c <- BL.readFile file
+-- return $ BL8.unpack . decompress $ c
+ | otherwise = readFile file
+
+readAndPrint :: URL -> String -> FilePath -> FilePath -> IO ()
+readAndPrint prefix strip outdir file = do
+ f <- readFileGz file
+ writeFile outfile $ filterHaddock url f
+ where dropgz f | takeExtension f == ".gz" = dropExtension f
+ | otherwise = f
+ outfile = outdir </> takeFileName (dropgz file)
+ url = prefix ++ (fromMaybe "" . stripPrefix strip . dropFileName $ file)
+
+main :: IO ()
+main = do
+ [p, s, o] <- getArgs
+ c <- getContents
+ mapM_ (readAndPrint p s o) (lines c)
diff -rN -u old-haskell-devscripts//haddock-collect.hs new-haskell-devscripts//haddock-collect.hs
--- old-haskell-devscripts//haddock-collect.hs 2012-10-04 13:13:48.295726638 +0000
+++ new-haskell-devscripts//haddock-collect.hs 1970-01-01 00:00:00.000000000 +0000
@@ -1,55 +0,0 @@
-#!/usr/bin/runhaskell
-{-# OPTIONS -Wall #-}
-
-import Data.List
-import Data.Char
-import Data.Maybe
-import System.Environment
-import System.FilePath
---import qualified Data.ByteString.Lazy as BL
---import qualified Data.ByteString.Lazy.Char8 as BL8
---import Codec.Compression.GZip
-
-type URL = String
-
--- copy from hoogle/src/Recipe/Hackage.hs
-haddockHacks :: [String] -> [String]
-haddockHacks = map (unwords . map f . words) . filter (not . isPrefixOf "@version ")
- where
- f "::" = "::"
- f (':':xs) = "(:" ++ xs ++ ")"
- f ('!':'!':x:xs) | isAlpha x = xs
- f ('!':x:xs) | isAlpha x || x `elem` "[(" = x:xs
- f x | x `elem` ["[overlap","ok]","[incoherent]"] = ""
- f x = x
-
-haddockPackageUrl :: URL -> [String] -> [String]
-haddockPackageUrl x = concatMap f
- where f y | "@package " `isPrefixOf` y = ["@url " ++ x, y]
- | otherwise = [y]
--- copy end
-
-filterHaddock :: URL -> String -> String
-filterHaddock url = unlines . haddockHacks . haddockPackageUrl url . lines
-
-readFileGz :: FilePath -> IO String
-readFileGz file
--- | takeExtension file == ".gz" = do
--- c <- BL.readFile file
--- return $ BL8.unpack . decompress $ c
- | otherwise = readFile file
-
-readAndPrint :: URL -> String -> FilePath -> FilePath -> IO ()
-readAndPrint prefix strip outdir file = do
- f <- readFileGz file
- writeFile outfile $ filterHaddock url f
- where dropgz f | takeExtension f == ".gz" = dropExtension f
- | otherwise = f
- outfile = outdir </> takeFileName (dropgz file)
- url = prefix ++ (fromMaybe "" . stripPrefix strip . dropFileName $ file)
-
-main :: IO ()
-main = do
- [p, s, o] <- getArgs
- c <- getContents
- mapM_ (readAndPrint p s o) (lines c)
diff -rN -u old-haskell-devscripts//hlibrary.mk new-haskell-devscripts//hlibrary.mk
--- old-haskell-devscripts//hlibrary.mk 2012-10-04 13:13:48.310246718 +0000
+++ new-haskell-devscripts//hlibrary.mk 2012-10-04 13:13:48.335184657 +0000
@@ -57,6 +57,9 @@
DEB_HADDOCK_OPTS += --hyperlink-source
endif
+DEB_HOOGLE_URLPREFIX = http://localhost/cgi-bin/hoogle/file
+DEB_HOOGLE_TXT_DIR = /usr/lib/ghc-doc/hoogle/
+
MAKEFILE := debian/hlibrary.Makefile
#ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
@@ -171,6 +174,10 @@
[ 0 = `ls debian/tmp-inst-ghc/$(DEB_HADDOCK_DIR)/ 2>/dev/null | wc -l` ] || \
cp -r debian/tmp-inst-ghc/$(DEB_HADDOCK_DIR)/*.haddock \
debian/$(notdir $@)/$(DEB_HADDOCK_DIR)
+ mkdir -p debian/$(notdir $@)/$(DEB_HOOGLE_TXT_DIR)
+ find debian/$(notdir $@)/$(DEB_HADDOCK_HTML_DIR) -name "*.txt" | \
+ /usr/bin/haddock-collect $(DEB_HOOGLE_URLPREFIX) \
+ debian/$(notdir $@) debian/$(notdir $@)/$(DEB_HOOGLE_TXT_DIR)
dh_haskell_depends -p$(notdir $@)
install/libhugs-$(CABAL_PACKAGE):: $(DEB_SETUP_BIN_NAME) dist-hugs debian/extra-depends
More information about the Pkg-haskell-commits
mailing list