git.iko.soy/typeable/cabal2nix
on master help sign in
Distribution/NixOS/Derivation/Cabal.hs: don't fail with 'error' when the version string can't be parsed
commitae12979da39cb100e13b4787d76d925549d59d68 authorPeter Simons <simons@cryp.to> dateMon 15 Aug 2011, 12:11 (15 years ago) parentf716ae2
1 file changed+3−2
src/Distribution/NixOS/Derivation/Cabal.hs+3−2
src/Distribution/NixOS/Derivation/Cabal.hs+3−2
@@ -77,14 +77,15 @@ parseDerivation :: String -> Maybe Derivation
7777parseDerivation buf
7878 | buf =~ "cabal.mkDerivation"
7979 , [name] <- buf `regsubmatch` "pname *= *\"([^\"]+)\""
80− , [vers] <- buf `regsubmatch` "version *= *\"([^\"]+)\""
80+ , [vers'] <- buf `regsubmatch` "version *= *\"([^\"]+)\""
81+ , Just vers <- simpleParse vers'
8182 , [sha] <- buf `regsubmatch` "sha256 *= *\"([^\"]+)\""
8283 , plats <- buf `regsubmatch` "platforms *= *([^;]+);"
8384 , maint <- buf `regsubmatch` "maintainers *= *\\[([^\"]+)]"
8485 , noHaddock <- buf `regsubmatch` "noHaddock *= *(true|false) *;"
8586 = Just $ MkDerivation
8687 { pname = name
87− , version = maybe (error $ "cannot parse version " ++ show vers) id (simpleParse vers)
88+ , version = vers
8889 , sha256 = sha
8990 , isLibrary = False
9091 , isExecutable = False