cab 0.2.20 → 0.2.21
raw patch · 7 files changed
+28/−6 lines, 7 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Distribution.Cab: OptCleanUp :: Option
Files
- Distribution/Cab/Commands.hs +9/−2
- Distribution/Cab/Sandbox.hs +2/−2
- cab.cabal +1/−1
- src/Commands.hs +9/−0
- src/Options.hs +4/−1
- src/Run.hs +1/−0
- src/Types.hs +2/−0
Distribution/Cab/Commands.hs view
@@ -5,6 +5,7 @@ , genpaths, check, initSandbox, add, ghci ) where +import qualified Control.Exception as E import Control.Monad (forM_, unless, when, void) import Data.Char (toLower) import Data.List (intercalate, isPrefixOf)@@ -42,6 +43,7 @@ | OptFuture | OptDebug | OptAllowNewer+ | OptCleanUp deriving (Eq,Show) ----------------------------------------------------------------@@ -77,12 +79,17 @@ outdated _ opts _ = do pkgs <- toPkgInfos <$> getDB opts verDB <- toMap <$> getVerDB InstalledOnly+ let del = OptCleanUp `elem` opts forM_ pkgs $ \p -> case M.lookup (nameOfPkgInfo p) verDB of Nothing -> return () Just ver -> do let comp = verOfPkgInfo p `compare` ver- when (dated comp) $- putStrLn $ fullNameOfPkgInfo p ++ (showIneq comp) ++ verToString ver+ when (dated comp) $ do+ if del then do+ let (nm,vr) = pairNameOfPkgInfo p+ uninstall [nm,vr] [OptRecursive] [] `E.catch` \(E.SomeException _) -> return ()+ else+ putStrLn $ fullNameOfPkgInfo p ++ showIneq comp ++ verToString ver where dated LT = True dated GT = OptFuture `elem` opts
Distribution/Cab/Sandbox.hs view
@@ -94,6 +94,6 @@ where file = takeFileName dir findVer = drop 4 . head . filter ("ghc-" `isPrefixOf`) . tails- (verStr1,_:left) = break (== '.') $ findVer file- (verStr2,_) = break (== '.') left+ (verStr1,left) = break (== '.') $ findVer file+ (verStr2,_) = break (== '.') $ tail left ver = read verStr1 * 100 + read verStr2
cab.cabal view
@@ -1,5 +1,5 @@ Name: cab-Version: 0.2.20+Version: 0.2.21 Author: Kazu Yamamoto <kazu@iij.ad.jp> Maintainer: Kazu Yamamoto <kazu@iij.ad.jp> License: BSD3
src/Commands.hs view
@@ -95,6 +95,7 @@ , routing = RouteFunc outdated , switches = [(SwAll, None) ,(SwFuture, Solo "--future")+ ,(SwCleanUp, None) ] , manual = Nothing }@@ -221,6 +222,14 @@ , commandNames = ["init"] , document = "Initialize a sandbox" , routing = RouteFunc initSandbox+ , switches = []+ , manual = Nothing+ }+ , CommandSpec {+ command = DocTest+ , commandNames = ["doctest"]+ , document = "Run doctest"+ , routing = RouteCabal ["v1-repl", "--with-ghc=doctest"] , switches = [] , manual = Nothing }
src/Options.hs view
@@ -57,10 +57,13 @@ , Option ['x'] ["newer"] (NoArg OptAllowNewer) "Allow newer versions"+ , Option ['c'] ["cleanup"]+ (NoArg OptCleanUp)+ "Remove outdated packages" , Option ['h'] ["help"] (NoArg OptHelp) "Show help message" ] optionDB :: OptionDB-optionDB = zip [SwNoharm,SwRecursive,SwAll,SwInfo,SwFlag,SwTest,SwBench,SwDepsOnly,SwLibProfile,SwExecProfile,SwDebug,SwJobs,SwImport,SwStatic,SwFuture,SwAllowNewer] getOptDB+optionDB = zip [SwNoharm,SwRecursive,SwAll,SwInfo,SwFlag,SwTest,SwBench,SwDepsOnly,SwLibProfile,SwExecProfile,SwDebug,SwJobs,SwImport,SwStatic,SwFuture,SwAllowNewer,SwCleanUp] getOptDB
src/Run.hs view
@@ -31,6 +31,7 @@ toSwitch OptStatic = SwStatic toSwitch OptFuture = SwFuture toSwitch OptAllowNewer = SwAllowNewer+toSwitch OptCleanUp = SwCleanUp toSwitch _ = error "toSwitch" ----------------------------------------------------------------
src/Types.hs view
@@ -25,6 +25,7 @@ | SwStatic | SwFuture | SwAllowNewer+ | SwCleanUp deriving (Eq,Show) ----------------------------------------------------------------@@ -65,6 +66,7 @@ | Bench | Doc | Init+ | DocTest | Help deriving (Eq,Show)