Treat package list instead as a set

This commit is contained in:
Michael Snoyman 2015-03-26 17:57:28 +02:00
parent d69497ebf9
commit 55880e0f15

View File

@ -23,7 +23,9 @@ getBuildPlanR slug = do
fp <- fmap fpToString $ ltsFP $ concat [tshow major, ".", tshow minor] fp <- fmap fpToString $ ltsFP $ concat [tshow major, ".", tshow minor]
bp <- liftIO $ decodeFileEither fp >>= either throwIO return bp <- liftIO $ decodeFileEither fp >>= either throwIO return
packages <- lookupGetParams "package" -- treat packages as a set to skip duplicates and make order of parameters
-- irrelevant
packages <- setFromList <$> lookupGetParams "package"
when (null packages) $ invalidArgs ["Must provide at least one package"] when (null packages) $ invalidArgs ["Must provide at least one package"]
fullDeps <- (== Just "true") <$> lookupGetParam "full-deps" fullDeps <- (== Just "true") <$> lookupGetParam "full-deps"
let eres = runCatch $ execStateT (getDeps bp fullDeps packages) (mempty, id) let eres = runCatch $ execStateT (getDeps bp fullDeps packages) (mempty, id)
@ -79,7 +81,7 @@ type DList a = [a] -> [a]
getDeps :: (MonadThrow m, MonadState TheState m) getDeps :: (MonadThrow m, MonadState TheState m)
=> BuildPlan => BuildPlan
-> Bool -> Bool
-> [Text] -> Set Text
-> m () -> m ()
getDeps BuildPlan {..} fullDeps = getDeps BuildPlan {..} fullDeps =
mapM_ (goName . PackageName . unpack) mapM_ (goName . PackageName . unpack)