1 -- Returns exitcode 0 if the given package is buildable or is a boot package,
4 module Main (main) where
7 import System.Directory
8 import System.Environment
13 main = do args <- getArgs
15 [bootPackagesFile, package] ->
16 doit bootPackagesFile package
18 error "Syntax: ifBuildable <boot-packages-file> <package>"
20 doit :: FilePath -> String -> IO ()
21 doit bootPackagesFile package
22 = do setCurrentDirectory package
23 unbuildable <- doesFileExist "unbuildable"
25 then exitWith ExitSuccess
26 else do mustBeBuildables <- getMustBeBuildables bootPackagesFile
27 if package `elem` mustBeBuildables
28 then exitWith ExitSuccess
29 else do hPutStrLn stderr "Warning: Package is unbuildable"
30 exitWith (ExitFailure 1)
32 getMustBeBuildables :: FilePath -> IO [String]
33 getMustBeBuildables bootPackagesFile
34 = do xs <- readFile bootPackagesFile
35 return $ filter ("editline" /=) $ lines xs