cabal2nix 1.65 → 1.66
raw patch · 4 files changed
+16/−12 lines, 4 files
Files
- cabal2nix.cabal +5/−4
- src/Cabal2Nix/Hackage.hs +6/−6
- src/Cabal2Nix/PostProcess.hs +1/−1
- src/cabal2nix.hs +4/−1
cabal2nix.cabal view
@@ -1,5 +1,5 @@ Name: cabal2nix-Version: 1.65+Version: 1.66 Copyright: Peter Simons, Andres Loeh License: BSD3 License-File: LICENSE@@ -10,7 +10,7 @@ Synopsis: Convert Cabal files into Nix build instructions Cabal-Version: >= 1.8 Build-Type: Custom-Tested-With: GHC >= 6.10.4 && <= 7.8.2+Tested-With: GHC >= 6.10.4 && <= 7.8.3 Data-files: README.md Description: The @cabal2nix@ utility converts Cabal files into Nix build instructions. The@@ -18,6 +18,7 @@ . > Usage: cabal2nix [options] url-to-cabal-file > -h --help show this help text+ > --hackage-db=FILEPATH path to the local hackage db in tar format > --sha256=HASH sha256 hash of source tarball > -m MAINTAINER --maintainer=MAINTAINER maintainer of this package (may be specified multiple times) > -p PLATFORM --platform=PLATFORM supported build platforms (may be specified multiple times)@@ -36,8 +37,8 @@ . The only required argument is the path to the cabal file. For example: .- > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.65/cabal2nix.cabal- > cabal2nix cabal://cabal2nix-1.65+ > cabal2nix http://hackage.haskell.org/packages/archive/cabal2nix/1.66/cabal2nix.cabal+ > cabal2nix cabal://cabal2nix-1.66 . If the @--sha256@ option has not been specified, cabal2nix calls @nix-prefetch-url@ to determine the hash automatically. This causes
src/Cabal2Nix/Hackage.hs view
@@ -57,21 +57,21 @@ where version = showVersion version' -readCabalFile :: FilePath -> IO String-readCabalFile path+readCabalFile :: Maybe FilePath -> FilePath -> IO String+readCabalFile hackageDbPath path | "cabal://" `isPrefixOf` path = do let pid p = fromJust $ simpleParse p packageName = drop 8 path case versionBranch $ pkgVersion $ pid packageName of [] -> do- packageDescription <- DB.lookup packageName `fmap` DB.readHackage+ packageDescription <- DB.lookup packageName `fmap` maybe DB.readHackage DB.readHackage' hackageDbPath case packageDescription of Just d -> do let version = showVersion $ last $ DB.keys d- readCabalFile $ hackagePath (pid $ packageName ++ "-" ++ version) Cabal+ readCabalFile Nothing $ hackagePath (pid $ packageName ++ "-" ++ version) Cabal Nothing -> error "No such package"- _ -> readCabalFile $ hackagePath (pid packageName) Cabal+ _ -> readCabalFile Nothing $ hackagePath (pid packageName) Cabal | "http://" `isPrefixOf` path = fetchUrl path- | "file://" `isPrefixOf` path = readCabalFile (drop 7 path)+ | "file://" `isPrefixOf` path = readCabalFile Nothing (drop 7 path) | otherwise = readFile path fetchUrl :: String -> IO String
src/Cabal2Nix/PostProcess.hs view
@@ -265,7 +265,7 @@ eitherNoHaddock :: String eitherNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"7.6\";" -httpNoHaddock, quickCheckNoHaddock, tarNoHaddock :: String+httpNoHaddock, quickCheckNoHaddock, tarNoHaddock, transformersNoHaddock :: String httpNoHaddock = "noHaddock = self.stdenv.lib.versionOlder self.ghc.version \"6.11\";" quickCheckNoHaddock = httpNoHaddock tarNoHaddock = httpNoHaddock
src/cabal2nix.hs view
@@ -25,6 +25,7 @@ , optDoCheck :: Bool , optJailbreak :: Bool , optHyperlinkSource :: Bool+ , optHackageDb :: Maybe FilePath } deriving (Show) @@ -39,11 +40,13 @@ , optDoCheck = True , optJailbreak = False , optHyperlinkSource = True+ , optHackageDb = Nothing } options :: [OptDescr (Configuration -> Configuration)] options = [ Option "h" ["help"] (NoArg (\o -> o { optPrintHelp = True })) "show this help text"+ , Option "" ["hackage-db"] (ReqArg (\x o -> o { optHackageDb = Just x }) "FILEPATH") "path to the local hackage db in tar format" , Option "" ["sha256"] (ReqArg (\x o -> o { optSha256 = Just x }) "HASH") "sha256 hash of source tarball" , Option "m" ["maintainer"] (ReqArg (\x o -> o { optMaintainer = x : optMaintainer o }) "MAINTAINER") "maintainer of this package (may be specified multiple times)" , Option "p" ["platform"] (ReqArg (\x o -> o { optPlatform = x : optPlatform o }) "PLATFORM") "supported build platforms (may be specified multiple times)"@@ -79,7 +82,7 @@ when (optPrintHelp cfg) (putStr usage >> exitSuccess) when (length args /= 1) (cmdlineError "*** exactly one url-to-cabal-file must be specified\n") - cabal' <- fmap parsePackageDescription (readCabalFile (head args))+ cabal' <- fmap parsePackageDescription (readCabalFile (optHackageDb cfg) (head args)) cabal <- case cabal' of ParseOk _ a -> return a ParseFailed err -> do