darcs patch: fix #1839, #1463, by supporting ghc-pkg bulkqueries with substring matching

Claus Reinke claus.reinke at talk21.com
Mon Dec 3 09:58:17 EST 2007


>>    register, update, FlagGlobalConfig, FlagConfig
>> 
>> but all of these seem to expect exactly one file, to be stored in a 
>> single FilePath? am i missing something,
>> or was this a wild goose chase?-)
> 
> Just turn off self-globbing for ghc-pkg.  Anyone using a sensible shell 
> (i.e. bash) will still get globbing anyway.  I'd be surprised if anyone at 
> all notices.

ok. i don't like excluding users needlessly, but the ghc-pkg commands
don't seem to be prepared for globbing anyway, so the machinery for 
enabling selective self-globbing in ghc-pkg is in place, but commented 
out (to make validate happier) until someone needs it and decides 
where to provide it.

oddly, i couldn't find a configure.mk variable pointing to the
mingw location (there are several programs from there, ar, ld,
and distrib/prep-bindist-mingw makes its own guesses), so i
used an explicit path in Makefile, which should probably be
fixed. perhaps you'd like to integrate the glob.hs/CRT_noglob.o 
combo into ghc proper, as an option for other ghc-compiled
wanting to use '*' on windows? i leave that to you.

things appear to work as advertized with ghc-pkg-inplace in cygwin 
bash and cmd.exe; validate on ghc head, win/xp complains about:

   1914(ghci)
   ThreadDelay001(normal)
   countReaders001(normal)

none of which seem to have anything to do with this patch.
as this patch has platform-specific aspects, you might want
to try on a non-windows platform (provided it does what
you expect on windows;-) before committing (presumably
to both head and stable?).

over to you;-)
claus

------------- updated patch summary
  * FIX #1839, #1463, by supporting ghc-pkg bulk queries with substring matching

     - #1839 asks for a ghc-pkg dump feature, #1463 for the ability
       to query the same fields in several packages at once.

     - this patch enables substring matching for packages in 'list',
       'describe', and 'field', and for modules in find-module. it
       also allows for comma-separated multiple fields in 'field'.
       substring matching can optionally ignore cases to avoid the
       rather unpredictable capitalisation of packages.

     - the patch is not quite as full-featured as the one attached
       to #1839, but avoids the additional dependency on regexps.
       open ended substrings are indicated by '*' (only the three
       forms prefix*, *suffix, *infix* are supported)

     - on windows, the use of '*' for package/module name globbing
       leads to conflicts with filename globbing: by default, windows
       programs are self-globbing, and bash adds another level of
       globbing on top of that. it seems impossible to escape '*'
       from both levels of globbing, so we disable default globbing
       for ghc-pkg and ghc-pkg-inplace. users of bash will still
       have filename globbing available, users of cmd won't.

     - if it is considered necessary to reenable filename globbing
       for cmd users, it should be done selectively, only for
       filename parameters. to this end, the patch includes a
       glob.hs program which simply echoes its parameters after
       filename globbing. see the commented out glob command in
       Main.hs for usage or testing.

     - this covers both tickets, and permits for the most common
       query patterns (finding all packages contributing to the
       System. hierarchy, finding all regex or string packages,
       listing all package maintainers or haddock directories,
       ..), which not only i have wanted to have for a long time.

       examples (the quotes are needed to escape shell-based
       filename globbing and should be omitted in cmd.exe):

         ghc-pkg list '*regex*' --ignore-case
         ghc-pkg list '*string*' --ignore-case
         ghc-pkg list '*gl*' --ignore-case
         ghc-pkg find-module 'Data.*'
         ghc-pkg find-module '*Monad*'
         ghc-pkg field '*' name,maintainer
         ghc-pkg field '*' haddock-html
         ghc-pkg describe '*'

-------------- next part --------------
A non-text attachment was scrubbed...
Name: FIX_1839_1463-ghc-pkg-bulk-queries-noglob.patch
Type: application/octet-stream
Size: 35037 bytes
Desc: not available
Url : http://www.haskell.org/pipermail/cvs-ghc/attachments/20071203/c0eb32a4/FIX_1839_1463-ghc-pkg-bulk-queries-noglob-0001.obj


More information about the Cvs-ghc mailing list