[DHG_packages] 06/15: hoogle: Patch hoogle to accept the `--local' flag more than once

Ilias Tsitsimpis iliastsi-guest at moszumanska.debian.org
Sun Oct 30 16:52:33 UTC 2016


This is an automated email from the git hooks/post-receive script.

iliastsi-guest pushed a commit to branch master
in repository DHG_packages.

commit 1f0e9e7302dff38a6cd68cfb929256afd397da4c
Author: Ilias Tsitsimpis <i.tsitsimpis at gmail.com>
Date:   Thu Oct 27 22:33:08 2016 +0300

    hoogle: Patch hoogle to accept the `--local' flag more than once
    
    This enables hoogle to generate docs for more than one packages
    at the same database. Debian uses this in the update-hoogle command.
---
 p/haskell-hoogle/debian/changelog                  |  3 +
 .../debian/patches/generate_from_multiple_sources  | 64 ++++++++++++++++++++++
 p/haskell-hoogle/debian/patches/series             |  1 +
 3 files changed, 68 insertions(+)

diff --git a/p/haskell-hoogle/debian/changelog b/p/haskell-hoogle/debian/changelog
index f23a03b..8b83a1e 100644
--- a/p/haskell-hoogle/debian/changelog
+++ b/p/haskell-hoogle/debian/changelog
@@ -12,6 +12,9 @@ haskell-hoogle (5.0.1-3) UNRELEASED; urgency=medium
     - Rename `MIT' to `Expat'.
     - Bump Copyright years.
     - Add missing files.
+  * Patch hoogle to accept the `--local' flag more than once.
+    This enables hoogle to generate docs for more than one packages
+    at the same database. Debian uses this in the update-hoogle command.
 
  -- Ilias Tsitsimpis <i.tsitsimpis at gmail.com>  Fri, 28 Oct 2016 13:02:02 +0300
 
diff --git a/p/haskell-hoogle/debian/patches/generate_from_multiple_sources b/p/haskell-hoogle/debian/patches/generate_from_multiple_sources
new file mode 100644
index 0000000..c44e945
--- /dev/null
+++ b/p/haskell-hoogle/debian/patches/generate_from_multiple_sources
@@ -0,0 +1,64 @@
+Description: Generate docs from multiple sources
+ Patch generate command to accept the `--local' flag more than once, hence
+ enabling Hoogle to generate docs for more than one packages at same database.
+Author: Ilias Tsitsimpis <i.tsitsimpis at gmail.com>
+Forwarded: no
+
+Index: b/src/Action/CmdLine.hs
+===================================================================
+--- a/src/Action/CmdLine.hs
++++ b/src/Action/CmdLine.hs
+@@ -35,7 +35,7 @@ data CmdLine
+         ,database :: FilePath
+         ,insecure :: Bool
+         ,include :: [String]
+-        ,local_ :: Maybe FilePath
++        ,local_ :: [Maybe FilePath]
+         ,debug :: Bool
+         ,language :: Language
+         }
+Index: b/src/Action/Generate.hs
+===================================================================
+--- a/src/Action/Generate.hs
++++ b/src/Action/Generate.hs
+@@ -126,9 +126,9 @@ readHaskellOnline timing settings downlo
+     return (cbl, want, source)
+ 
+ 
+-readHaskellDir :: Timing -> FilePath -> IO (Map.Map String Package, Set.Set String, Source IO (String, URL, LStr))
+-readHaskellDir timing dir = do
+-    packages <- map (takeBaseName &&& id) . filter ((==) ".txt" . takeExtension) <$> listFiles dir
++readHaskellDirs :: Timing -> [FilePath] -> IO (Map.Map String Package, Set.Set String, Source IO (String, URL, LStr))
++readHaskellDirs timing dirs = do
++    packages <- map (takeBaseName &&& id) . filter ((==) ".txt" . takeExtension) <$> concat <$> mapM listFiles dirs
+     let source = forM_ packages $ \(name, file) -> do
+             src <- liftIO $ strReadFile file
+             yield (name, hackagePackageURL name, lstrFromChunks [src])
+@@ -171,10 +171,10 @@ actionGenerate g at Generate{..} = withTimi
+     download <- return $ downloadInput timing insecure download (takeDirectory database)
+     settings <- loadSettings
+     (cbl, want, source) <- case language of
+-        Haskell | Just "" <- local_ -> readHaskellGhcpkg timing settings
+-                | Just dir <- local_ -> readHaskellDir timing dir
+-                | otherwise -> readHaskellOnline timing settings download
+-        Frege | isJust local_ -> errorIO "No support for local Frege databases"
++        Haskell | [Just ""] <- local_ -> readHaskellGhcpkg timing settings
++                | [] <- local_ -> readHaskellOnline timing settings download
++                | otherwise -> readHaskellDirs timing (fromJust <$> local_)
++        Frege | null local_ -> errorIO "No support for local Frege databases"
+               | otherwise -> readFregeOnline timing download
+     let (cblErrs, popularity) = packagePopularity cbl
+     want <- return $ if include /= [] then Set.fromList include else want
+Index: b/src/Action/Test.hs
+===================================================================
+--- a/src/Action/Test.hs
++++ b/src/Action/Test.hs
+@@ -28,7 +28,7 @@ actionTest Test{..} = withBuffering stdo
+     putStrLn ""
+ 
+     putStrLn "Sample database tests"
+-    actionGenerate defaultGenerate{database=sample, local_=Just "misc/sample-data"}
++    actionGenerate defaultGenerate{database=sample, local_=[Just "misc/sample-data"]}
+     action_search_test True sample
+     action_server_test True sample
+     putStrLn ""
diff --git a/p/haskell-hoogle/debian/patches/series b/p/haskell-hoogle/debian/patches/series
index e69de29..4d4ccf0 100644
--- a/p/haskell-hoogle/debian/patches/series
+++ b/p/haskell-hoogle/debian/patches/series
@@ -0,0 +1 @@
+generate_from_multiple_sources

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-haskell/DHG_packages.git



More information about the Pkg-haskell-commits mailing list