Fixed yesod devel flag checking

This commit is contained in:
Michael Snoyman 2012-04-25 10:43:21 +03:00
parent fbc75699da
commit a8b06e0e9a

View File

@ -139,7 +139,7 @@ checkCabalFile :: D.GenericPackageDescription -> IO [FilePath]
checkCabalFile gpd = case D.condLibrary gpd of checkCabalFile gpd = case D.condLibrary gpd of
Nothing -> failWith "incorrect cabal file, no library" Nothing -> failWith "incorrect cabal file, no library"
Just ct -> Just ct ->
case lookupDevelLib ct of case lookupDevelLib gpd ct of
Nothing -> Nothing ->
failWith "no development flag found in your configuration file. Expected a 'library-only' flag or the older 'devel' flag" failWith "no development flag found in your configuration file. Expected a 'library-only' flag or the older 'devel' flag"
Just dLib -> do Just dLib -> do
@ -196,14 +196,13 @@ ghcPackageArgs isCabalDev ghcVer
| otherwise = selectOpts opts (x2:xs) | otherwise = selectOpts opts (x2:xs)
selectOpts _ _ = [] selectOpts _ _ = []
lookupDevelLib :: D.CondTree D.ConfVar c a -> Maybe a lookupDevelLib :: D.GenericPackageDescription -> D.CondTree D.ConfVar c a -> Maybe a
lookupDevelLib ct | found = Just (D.condTreeData ct) lookupDevelLib gpd ct | found = Just (D.condTreeData ct)
| otherwise = Nothing | otherwise = Nothing
where where
found = not . null . map (\(_,x,_) -> D.condTreeData x) . flags = map (unFlagName . D.flagName) $ D.genPackageFlags gpd
filter isDevelLib . D.condTreeComponents $ ct unFlagName (D.FlagName x) = x
isDevelLib (D.Var (D.Flag (D.FlagName f)), _, _) = f `elem` ["library-only", "devel"] found = any (`elem` ["library-only", "devel"]) flags
isDevelLib _ = False
-- | Acts like @rawSystem@, but filters out lines from the output that we're not interested in seeing. -- | Acts like @rawSystem@, but filters out lines from the output that we're not interested in seeing.
rawSystemFilter :: String -> [String] -> IO ExitCode rawSystemFilter :: String -> [String] -> IO ExitCode