@@ -25,6 +25,7 @@ data Configuration = Configuration
2525 , optDoCheck :: Bool
2626 , optJailbreak :: Bool
2727 , optHyperlinkSource :: Bool
28+ , optHackageDb :: Maybe FilePath
2829 }
2930 deriving (Show)
3031
@@ -39,11 +40,13 @@ defaultConfiguration = Configuration
3940 , optDoCheck = True
4041 , optJailbreak = False
4142 , optHyperlinkSource = True
43+ , optHackageDb = Nothing
4244 }
4345
4446options :: [OptDescr (Configuration -> Configuration)]
4547options =
4648 [ Option "h" ["help"] (NoArg (\o -> o { optPrintHelp = True })) "show this help text"
49+ , Option "" ["hackage-db"] (ReqArg (\x o -> o { optHackageDb = Just x }) "FILEPATH") "path to the local hackage db in tar format"
4750 , Option "" ["sha256"] (ReqArg (\x o -> o { optSha256 = Just x }) "HASH") "sha256 hash of source tarball"
4851 , Option "m" ["maintainer"] (ReqArg (\x o -> o { optMaintainer = x : optMaintainer o }) "MAINTAINER") "maintainer of this package (may be specified multiple times)"
4952 , Option "p" ["platform"] (ReqArg (\x o -> o { optPlatform = x : optPlatform o }) "PLATFORM") "supported build platforms (may be specified multiple times)"
@@ -79,7 +82,7 @@ main = bracket (return ()) (\() -> hFlush stdout >> hFlush stderr) $ \() -> do
7982 when (optPrintHelp cfg) (putStr usage >> exitSuccess)
8083 when (length args /= 1) (cmdlineError "*** exactly one url-to-cabal-file must be specified\n")
8184
82− cabal' <- fmap parsePackageDescription (readCabalFile (head args))
85+ cabal' <- fmap parsePackageDescription (readCabalFile (optHackageDb cfg) (head args))
8386 cabal <- case cabal' of
8487 ParseOk _ a -> return a
8588 ParseFailed err -> do