X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=libraries%2FifBuildable.hs;h=68b619751b63f6b659cda495e19bb26916f22a53;hb=66579ff945831c5fc9a17c58c722ff01f2268d76;hp=3f8813b63d66d7401c582d182f16a0f8e4e6723f;hpb=d7d755865a3849be26a468a3fa430ff96c8e9e0c;p=ghc-hetmet.git diff --git a/libraries/ifBuildable.hs b/libraries/ifBuildable.hs index 3f8813b..68b6197 100644 --- a/libraries/ifBuildable.hs +++ b/libraries/ifBuildable.hs @@ -12,25 +12,29 @@ import System.IO main :: IO () main = do args <- getArgs case args of - [bootPackagesFile, package] -> - doit bootPackagesFile package + [packagesFile, package] -> + doit packagesFile package _ -> - error "Syntax: ifBuildable " + error "Syntax: ifBuildable " doit :: FilePath -> String -> IO () -doit bootPackagesFile package +doit packagesFile package = do setCurrentDirectory package unbuildable <- doesFileExist "unbuildable" if not unbuildable then exitWith ExitSuccess - else do mustBeBuildables <- getMustBeBuildables bootPackagesFile + else do mustBeBuildables <- getMustBeBuildables packagesFile if package `elem` mustBeBuildables then exitWith ExitSuccess else do hPutStrLn stderr "Warning: Package is unbuildable" exitWith (ExitFailure 1) getMustBeBuildables :: FilePath -> IO [String] -getMustBeBuildables bootPackagesFile - = do xs <- readFile bootPackagesFile - return $ filter ("editline" /=) $ lines xs +getMustBeBuildables packagesFile + = do xs <- readFile packagesFile + let nonCommentLines = filter (("#" /=) . take 1) $ lines xs + requiredLines = filter ((3 == ) . length) $ map words nonCommentLines + requiredLibraries = [ x | 'l':'i':'b':'r':'a':'r':'i':'e':'s':'/':x + <- map head requiredLines ] + return $ filter ("editline" /=) requiredLibraries