#1839: need ghc-pkg dump feature
-----------------------------+----------------------------------------------
Reporter: duncan | Owner:
Type: feature request | Status: new
Priority: normal | Milestone: 6.10 branch
Component: Compiler | Version: 6.8.1
Severity: normal | Resolution:
Keywords: | Difficulty: Unknown
Testcase: | Architecture: Unknown
Os: Unknown |
-----------------------------+----------------------------------------------
Comment (by guest):
instead of seeing this as a dump feature, one might see it as another
example of "it would be nice if `ghc-pkg` could handle bulk queries",
something i've often wanted myself (#1463, point 1, is another example).
i've implemented a `-bulk` option for `ghc-pkg`, which features the
following changes (from `usageHeader`):
{{{
" $p list [pkg]\n" ++
" List registered packages in the global database, and also the\n" ++
" user database if --user is given. If a package name is given\n" ++
" All the registered versions will be listed in ascending order.\n"
++
" Accepts package patterns if --bulk is given.\n" ++
" Accepts the --simple-output flag.\n" ++
"\n" ++
" $p find-module {module}\n" ++
" List registered packages exposing module {module} in the global\n"
++
" database, and also the user database if --user is given. \n" ++
" All the registered versions will be listed in ascending order.\n"
++
" Accepts module patterns if --bulk is given.\n" ++
" Accepts the --simple-output flag.\n" ++
" $p describe {pkg-id}\n" ++
" Give the registered description for the specified package. The\n"
++
" description is returned in precisely the syntax required by $p\n"
++
" register. Accepts package patterns if --bulk is given.\n" ++
"\n" ++
" $p field {pkg-id} {field}\n" ++
" Extract the specified field of the package description for the\n"
++
" specified package. Accepts package patterns and comma-separated\n"
++
" multiple fields if --bulk is given.\n" ++
}}}
(without `--bulk`, all commands behave as they did before). that means we
can
{{{
-- list all regex packages
$ ./ghc-pkg-inplace list regex --bulk
c:/fptools/ghc/driver/package.conf.inplace:
regex-base-0.72.0.1, regex-compat-0.71.0.1, regex-posix-0.72.0.2
-- list all packages exposing Data.* modules
$ ./ghc-pkg-inplace find-module ^Data --bulk
c:/fptools/ghc/driver/package.conf.inplace:
array-0.1, base-3.0, bytestring-0.9, containers-0.1, fgl-5.4.1.1,
(ghc-6.9.20071106), packedstring-0.1, time-1.1.2.0
-- list all packages exposing Monad modules
$ ./ghc-pkg-inplace find-module Monad --bulk
c:/fptools/ghc/driver/package.conf.inplace:
base-3.0, cgi-3001.1.5.1, fgl-5.4.1.1, (ghc-6.9.20071106),
haskell-src-1.0.1.1, haskell98-1.0.1, mtl-1.1.0.0, stm-2.1.1.0
-- list all package maintainers or lack of them
$ ./ghc-pkg-inplace --bulk field . name,maintainer
name: rts
maintainer: [EMAIL PROTECTED]
name: base
maintainer: [EMAIL PROTECTED]
name: array
maintainer: [EMAIL PROTECTED]
name: packedstring
maintainer: [EMAIL PROTECTED]
name: containers
maintainer: [EMAIL PROTECTED]
name: bytestring
maintainer: [EMAIL PROTECTED], [EMAIL PROTECTED]
name: old-locale
maintainer: [EMAIL PROTECTED]
name: old-time
maintainer: [EMAIL PROTECTED]
name: filepath
maintainer:
..
-- list all haddock-html fields (#1463)
$ ./ghc-pkg-inplace --bulk field . haddock-html
haddock-html:
haddock-html: c:\fptools\ghc\libraries\base\dist\doc\html\base
haddock-html: c:\fptools\ghc\libraries\array\dist\doc\html\array
haddock-html:
c:\fptools\ghc\libraries\packedstring\dist\doc\html\packedstring
haddock-html: c:\fptools\ghc\libraries\containers\dist\doc\html\containers
haddock-html: c:\fptools\ghc\libraries\bytestring\dist\doc\html\bytestring
haddock-html: c:\fptools\ghc\libraries\old-locale\dist\doc\html\old-locale
haddock-html: c:\fptools\ghc\libraries\old-time\dist\doc\html\old-time
haddock-html: c:\fptools\ghc\libraries\filepath\dist\doc\html\filepath
haddock-html: c:\fptools\ghc\libraries\directory\dist\doc\html\directory
haddock-html: c:\fptools\ghc\libraries\Win32\dist\doc\html\Win32
haddock-html: c:\fptools\ghc\libraries\process\dist\doc\html\process
haddock-html: c:\fptools\ghc\libraries\pretty\dist\doc\html\pretty
haddock-html: c:\fptools\ghc\libraries\hpc\dist\doc\html\hpc
haddock-html: c:\fptools\ghc\libraries\template-haskell\dist\doc\html
\template-haskell
haddock-html: c:\fptools\ghc\libraries\Cabal\dist\doc\html\Cabal
haddock-html: c:\fptools\ghc\libraries\random\dist\doc\html\random
haddock-html: c:\fptools\ghc\libraries\haskell98\dist\doc\html\haskell98
haddock-html: c:\fptools\ghc\libraries\regex-base\dist\doc\html\regex-base
haddock-html: c:\fptools\ghc\libraries\regex-posix\dist\doc\html\regex-
posix
haddock-html: c:\fptools\ghc\libraries\regex-compat\dist\doc\html\regex-
compat
haddock-html: c:\fptools\ghc\libraries\parsec\dist\doc\html\parsec
haddock-html: c:\fptools\ghc\libraries\haskell-src\dist\doc\html\haskell-
src
haddock-html: c:\fptools\ghc\libraries\html\dist\doc\html\html
haddock-html: c:\fptools\ghc\libraries\network\dist\doc\html\network
haddock-html: c:\fptools\ghc\libraries\QuickCheck\dist\doc\html\QuickCheck
haddock-html: c:\fptools\ghc\libraries\HUnit\dist\doc\html\HUnit
haddock-html: c:\fptools\ghc\libraries\mtl\dist\doc\html\mtl
haddock-html: c:\fptools\ghc\libraries\fgl\dist\doc\html\fgl
haddock-html: c:\fptools\ghc\libraries\time\dist\doc\html\time
haddock-html: c:\fptools\ghc\libraries\OpenGL\dist\doc\html\OpenGL
haddock-html: c:\fptools\ghc\libraries\GLUT\dist\doc\html\GLUT
haddock-html: c:\fptools\ghc\libraries\stm\dist\doc\html\stm
haddock-html: c:\fptools\ghc\libraries\xhtml\dist\doc\html\xhtml
haddock-html: c:\fptools\ghc\libraries\cgi\dist\doc\html\cgi
haddock-html: c:\fptools\ghc\libraries\parallel\dist\doc\html\parallel
haddock-html: c:/fptools/ghc/libraries/ghc/html
}}}
of course, we can also do `./ghc-pkg-inplace describe . --bulk` to get the
kind of full dump this ticket asks for (the `name:` field starts each
record).
the only problem i have is that this requires `Text.Regex`, which is in a
non-boot package. any suggestions?
i'll attach the output of `darcs diff -u Main.hs` in `utils/ghc-pkg/`, in
case someone wants to play or help out with the changes.
claus
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/1839#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs