cab – A maintenance command of Haskell packages
Kazu Yamamoto
cab is a MacPorts-like maintenance command of
Haskell cabal packages. Some parts of this program are a wrapper to
ghc-pkg and cabal version 0.18 or later.
If you are always confused due to inconsistency of ghc-pkg and cabal,
or if you want a way to check all outdated packages,
or if you want a way to remove outdated packages recursively,
this command helps you.
cab is designed to maintain user packages only assuming that
users use a Haskell Platform and don’t want to touch the global
packages.
cab is tested on both Mac and Windows and with GHC 7.6.3 or later.
Usage
The following commands are provided:
cab- Display the help message.
cab sync-
Fetch the latest package index.
Command aliases:update cab install [-n] [-f <flags>] [-t] [-d] [-p] [-e] [-j <jobs>] [-s] [<package> [<ver>]]- Install packages.
cab uninstall [-n] [-r] <package> [<ver>]-
Uninstall packages.
Command aliases:delete,remove,unregister cab installed [-a] [-r] [-m]-
List installed packages.
Command aliases:list cab configure [-f <flags>] [-t] [-b] [-p] [-e] [-s]-
Configure a cabal package.
Command aliases:conf cab build [-j <jobs>]- Build a cabal package.
cab clean- Clean up a build directory.
cab outdated [-a] [-c]- Display outdated packages.
cab info <package> [<ver>]- Display information of a package.
cab sdist-
Make tar.gz for source distribution.
Command aliases:pack cab upload [-n]-
Uploading tar.gz to HackageDB.
Command aliases:up cab unpack <package> [<ver>]- Untar a package in the current directory.
cab deps [-r] [-a] [-m] <package> [<ver>]- Show dependencies of this package.
cab revdeps [-r] [-a] [-m] <package> [<ver>]-
Show reverse dependencies of this package.
Command aliases:dependents cab check- Check consistency of packages.
cab genpaths-
Generate Paths_
.hs.
Command aliases:genpath cab search <key>- Search available packages by package name.
cab add <source>-
Add a source directory.
Command aliases:add-source cab test [testsuite]- Run tests.
cab bench- Run benchmarks.
cab doc-
Generate manuals.
Command aliases:haddock,man cab ghci [-i <dir>:<dir>]-
Run GHCi (with a sandbox).
Command aliases:repl cab init- Initialize a sandbox.
cab help [<command>]- Display the help message of the command.
The following options are provided:
--dry-run,-n- Run without destructive operations
--recursive,-r- Follow dependencies recursively
--all,-a- Show global packages in addition to user packages
--info,-m- Show license and author information
--flags,-f- Specify flags
--test,-t- Enable test
--bench,-b- Enable benchmark
--dep-only,-d- Target only dependencies
--lib-prof,-p- Enable library profiling
--exec-prof,-e- Enable library profiling
--jobs,-j- Run N jobs
--import,-i- Add module import paths
--static,-s- Create static libraries only
--cleanup,-c- Removing outdated packages
Catching up HackageDB
% cab sync
% cab outdated
foo 0.0.1 < 0.0.2
% cab delete -r foo
Deleting foo 0.0.1
Deleting bar 2.0.5
% cab install bar
cab outdated -c removes all outdated packages.
Installing a new package
Before installing, check whether or not a new package break user packages:
% cab -n install foo
Reading available packages...
Resolving dependencies...
In order, the following would be installed:
bar-1.0.9 (reinstall)
If you see reinstall, please stop installing. You should consider to use a sandbox.
Developing
A sandbox is very useful to develop your package which requires new non-registered packages.
% cd <your_package>
% cab init
% cab install -d -t -j 3
% cab conf
% cab build
Understanding dependency
Dependency of a package:
% cab -r deps wai-app-file-cgi
attoparsec 0.8.5.0
blaze-builder 0.2.1.4
enumerator 0.4.9.1
network 2.2.1.10
wai 0.3.2
blaze-builder 0.2.1.4
enumerator 0.4.9.1
network 2.2.1.10
wai-app-static 0.0.1.4
blaze-html 0.4.1.0
blaze-builder 0.2.1.4
file-embed 0.0.3.1
unix-compat 0.2.1.1
wai 0.3.2
blaze-builder 0.2.1.4
enumerator 0.4.9.1
network 2.2.1.10
web-routes 0.23.4
network 2.2.1.10
utf8-string 0.3.6
Reverse dependency of a package:
% cab revdeps blaze-builder
blaze-builder-enumerator 0.2.0.2
blaze-html 0.4.1.0
cookie 0.0.0
hamlet 0.7.3
http-enumerator 0.3.1
json-enumerator 0.0.1.1
mime-mail 0.1.0.1
wai 0.3.2
wai-app-file-cgi 0.0.2
wai-extra 0.3.3
warp 0.3.3
yesod-core 0.7.0.2
yesod-form 0.0.0.2
Install
Type as follows:
% cabal install cab
You should add ~/.cabal/bin to the PATH environment variable.
Repository
The latest source code is available from github:
Acknowledgment
I thank shelarcy for his testing.