Update Cabal version, be more resilient about generating Cabal files

This commit is contained in:
Michael Snoyman 2014-04-16 15:52:28 +03:00
parent b2170578ae
commit 45bac17582
2 changed files with 10 additions and 2 deletions

View File

@ -266,12 +266,19 @@ createView viewName modifyCabal src sink = withSystemTempDirectory "createview"
case msrc of
Nothing -> return mempty
Just src -> do
-- FIXME only create a new file if the old one doesn't exist?
orig <- src $$ sinkLazy
new <-
case parsePackageDescription $ unpack $ decodeUtf8 orig of
ParseOk _ gpd -> do
gpd' <- modifyCabal name version time gpd
return $ encodeUtf8 $ pack $ showGenericPackageDescription gpd'
let str = showGenericPackageDescription gpd'
-- sanity check
case parsePackageDescription str of
ParseOk _ _ -> return $ encodeUtf8 $ pack str
x -> do
$logError $ "Created cabal file that could not be parsed: " ++ tshow (x, str)
return orig
_ -> return orig
sourceLazy new $$ storeWrite (HackageViewCabal viewName name version)
let fp = fpFromString dir </> relfp

View File

@ -111,7 +111,8 @@ library
, esqueleto
, xml-conduit
, html-conduit
, Cabal
-- Avoid https://github.com/haskell/cabal/issues/1202
, Cabal >= 1.18
, lifted-base
, mono-traversable