packages feed

cabal-db 0.1.7 → 0.1.8

raw patch · 4 files changed

+29/−2 lines, 4 files

Files

README.md view
@@ -13,7 +13,9 @@ * search-maintainer: search all the database for match in the maintainer field. * graph: generate a dot format graph of the dependency * license: list all licenses used by packages and their dependencies+* bumpable: list all the upper version bounds that could be bumped for a list of packages  Check the original blog post for more information:  * [Cabal-db announcement](http://tab.snarc.org/posts/haskell/2013-03-13-cabal-db.html)+* [Cabal-db license](http://tab.snarc.org/posts/haskell/2014-03-29-cabal-db-license.html)
Src/Main.hs view
@@ -209,6 +209,23 @@     run availablePackages hidePlatform hidden pkgs  -----------------------------------------------------------------------+runCmd (CmdBumpable pkgs) = do+    apkgs <- loadAvailablePackages+    let getPkg n = (fmap fst . finPkgDesc) <$> getPackageDescription apkgs (PackageName n) Nothing+        bumpables = filter (not . null . snd) $ map checkBump pkgs+        checkBump pname = case getPkg pname of+            Nothing -> error ("no such package : " ++ show pname)+            Just resp -> (,) pname $ do+                Dependency (PackageName depname) verrange <- case resp of+                    Left d -> d+                    Right x -> buildDepends x+                v <- case getPkg depname of+                         Just (Right a) -> return (pkgVersion (package a))+                         _ -> mzero -- might be an error ?+                guard (not (withinRange v verrange))+                return $ PP.string depname PP.<+> PP.string "->" PP.<+> PP.cat (intersperse PP.dot (map PP.int (versionBranch v)))+    forM_ bumpables $ \(pname, desc) -> PP.putDoc (PP.string pname PP.<$> PP.indent 4 (PP.vcat desc) PP.<> PP.line)+----------------------------------------------------------------------- runCmd (CmdDiff (PackageName -> pname) v1 v2) = runDiff   where runDiff = do             availablePackages <- loadAvailablePackages
Src/Options.hs view
@@ -35,6 +35,9 @@         , licensePrintSummary :: Bool         , licensePackages :: [String]         }+    | CmdBumpable+        { bumpablePackages :: [String]+        }  data SearchTerm = SearchMaintainer | SearchAuthor @@ -46,6 +49,7 @@     <> command "search-author" (info (cmdSearch SearchAuthor) (progDesc "search the cabal database by author(s)"))     <> command "search-maintainer" (info (cmdSearch SearchMaintainer) (progDesc "search the cabal database by maintainer(s)"))     <> command "license" (info cmdLicense (progDesc "list all licenses of a set of packages and their dependencies"))+    <> command "bumpable" (info cmdBumpable (progDesc "list all dependencies that could receive an upper-bound version bump"))     )   where cmdGraph = CmdGraph                 <$> many (strOption (long "hide" <> short 'h' <> metavar "PACKAGE" <> help "package to hide"))@@ -65,6 +69,8 @@                 <$> switch (short 't' <> long "tree" <> help "show the tree dependencies of license")                 <*> switch (short 's' <> long "summary" <> help "Show the summary")                 <*> packages+        cmdBumpable = CmdBumpable+                <$> packages         packages = some (argument Just (metavar "<packages..>"))  getOptions :: IO Command
cabal-db.cabal view
@@ -1,6 +1,6 @@ Name:                cabal-db-Version:             0.1.7-Synopsis:            query tools for the local cabal database (revdeps, graph, info, search-by)+Version:             0.1.8+Synopsis:            query tools for the local cabal database (revdeps, graph, info, search-by, license, bounds) Description:     Query tool for the local cabal database     .@@ -13,6 +13,8 @@       * Generate graphs of dependencies in dot format     .       * List licenses of package and their dependencies+    .+      * List all the upper version bounds that could be bumped for a list of packages  License:             BSD3 License-file:        LICENSE