2 module Main (main) where
6 import System.Directory
7 import System.Environment
12 main = do args <- getArgs
15 error "No package or command given"
17 error "No command given"
18 package : prog : progArgs ->
19 doit package prog progArgs
21 doit :: String -> String -> [String] -> IO ()
22 doit package prog progArgs
23 = do setCurrentDirectory package
24 unbuildable <- doesFileExist "unbuildable"
26 then do mustBeBuildables <- getMustBeBuildablePackages
27 if package `elem` mustBeBuildables
28 then error (package ++ " is unbuildable")
29 else hPutStrLn stderr "Warning: Package is unbuildable"
30 else do ec <- rawSystem prog progArgs
33 getMustBeBuildablePackages :: IO [String]
34 getMustBeBuildablePackages
35 = do xs <- readFile "../core-packages"
36 return $ filter ("readline" /=) $ lines xs