@@ -2,6 +2,7 @@
2import Stackage.Types
2import Stackage.Types
3import Stackage.Build (build, defaultBuildSettings)
3import Stackage.Build (build, defaultBuildSettings)
4import Stackage.Init (stackageInit)
4import Stackage.Init (stackageInit)
5+import Stackage.Util (allowPermissive)
5import System.Environment (getArgs, getProgName)
6import System.Environment (getArgs, getProgName)
6import Data.Set (fromList)
7import Data.Set (fromList)
7import System.IO (hFlush, stdout)
8import System.IO (hFlush, stdout)
@@ -10,16 +11,26 @@ data BuildArgs = BuildArgs
10 { noClean :: Bool
11 { noClean :: Bool
11 , excluded :: [String]
12 , excluded :: [String]
12 , noPlatform :: Bool
13 , noPlatform :: Bool
14+ , onlyPermissive :: Bool
15+ , allowed :: [String]
15parseBuildArgs :: [String] -> IO BuildArgs
18parseBuildArgs :: [String] -> IO BuildArgs
16parseBuildArgs =
19parseBuildArgs =
17− loop $ BuildArgs False [] False
20+ loop BuildArgs
24+ , onlyPermissive = False
19 loop x [] = return x
28 loop x [] = return x
20 loop x ("--no-clean":rest) = loop x { noClean = True } rest
29 loop x ("--no-clean":rest) = loop x { noClean = True } rest
21 loop x ("--exclude":y:rest) = loop x { excluded = y : excluded x } rest
30 loop x ("--exclude":y:rest) = loop x { excluded = y : excluded x } rest
22 loop x ("--no-platform":rest) = loop x { noPlatform = True } rest
31 loop x ("--no-platform":rest) = loop x { noPlatform = True } rest
32+ loop x ("--only-permissive":rest) = loop x { onlyPermissive = True } rest
33+ loop x ("--allow":y:rest) = loop x { allowed = y : allowed x } rest
23 loop _ (y:_) = error $ "Did not understand argument: " ++ y
34 loop _ (y:_) = error $ "Did not understand argument: " ++ y
25main :: IO ()
36main :: IO ()
@@ -32,6 +43,10 @@ main = do
32 { cleanBeforeBuild = not noClean
43 { cleanBeforeBuild = not noClean
33 , excludedPackages = fromList $ map PackageName excluded
44 , excludedPackages = fromList $ map PackageName excluded
34 , requireHaskellPlatform = not noPlatform
45 , requireHaskellPlatform = not noPlatform
48+ then allowPermissive allowed
49+ else const $ Right ()
36 ["init"] -> do
51 ["init"] -> do
37 putStrLn "Note: init isn't really ready for prime time use."
52 putStrLn "Note: init isn't really ready for prime time use."
@@ -49,5 +64,5 @@ main = do
49 putStrLn "Available commands:"
64 putStrLn "Available commands:"
50 putStrLn " update Download updated Stackage databases. Automatically calls init."
65 putStrLn " update Download updated Stackage databases. Automatically calls init."
51 putStrLn " init Initialize your cabal file to use Stackage"
66 putStrLn " init Initialize your cabal file to use Stackage"
52− putStrLn " build [--no-clean] [--no-platform] [--exclude package...]"
67+ putStrLn " build [--no-clean] [--no-platform] [--exclude package...] [--only-permissive] [--allow package]"
53 putStrLn " Build the package databases (maintainers only)"
68 putStrLn " Build the package databases (maintainers only)"