-getMustBeBuildablePackages :: IO [String]
-getMustBeBuildablePackages
- = do xs <- readFile "../core-packages"
- return $ filter ("readline" /=) $ lines xs
+doit :: FilePath -> String -> IO ()
+doit bootPackagesFile package
+ = do setCurrentDirectory package
+ unbuildable <- doesFileExist "unbuildable"
+ if not unbuildable
+ then exitWith ExitSuccess
+ else do mustBeBuildables <- getMustBeBuildables bootPackagesFile
+ 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