diff options
author | Ian Lynagh <igloo@earth.li> | 2008-08-01 14:17:31 +0000 |
---|---|---|
committer | Ian Lynagh <igloo@earth.li> | 2008-08-01 14:17:31 +0000 |
commit | 8a7dbb3c7dca35a840ed11d85f7c2ea459cf3699 (patch) | |
tree | 49712c8281938bcf8795700ef2d79dacfdb7df6b /libraries | |
parent | 8f46f7c5c40756f6f5d260db0abd5392f0ead492 (diff) | |
download | haskell-8a7dbb3c7dca35a840ed11d85f7c2ea459cf3699.tar.gz |
Fix ifBuildable
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/Makefile | 2 | ||||
-rw-r--r-- | libraries/ifBuildable.hs | 20 |
2 files changed, 13 insertions, 9 deletions
diff --git a/libraries/Makefile b/libraries/Makefile index 9282d2bca3..9ff8db44b1 100644 --- a/libraries/Makefile +++ b/libraries/Makefile @@ -147,7 +147,7 @@ subdirs: HERE_ABS=$(FPTOOLS_TOP_ABS)/libraries -IFBUILDABLE=ifBuildable/ifBuildable $(HERE_ABS)/boot-packages +IFBUILDABLE=ifBuildable/ifBuildable $(FPTOOLS_TOP_ABS)/packages CABAL_GHC_FLAGS = -Wall ifeq "$(ghc_ge_605)" "NO" diff --git a/libraries/ifBuildable.hs b/libraries/ifBuildable.hs index 3f8813b63d..7364a1135a 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 <boot-packages-file> <package>" + error "Syntax: ifBuildable <packages-file> <package>" 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 ((2 == ) . length) $ map words nonCommentLines + requiredLibraries = [ x | 'l':'i':'b':'r':'a':'r':'i':'e':'s':'/':x + <- map head requiredLines ] + return $ filter ("editline" /=) requiredLibraries |