diff options
author | claus.reinke@talk21.com <unknown> | 2008-01-21 16:17:44 +0000 |
---|---|---|
committer | claus.reinke@talk21.com <unknown> | 2008-01-21 16:17:44 +0000 |
commit | 68f7cd160712d9666a492703f7d4a89ad7e9158c (patch) | |
tree | dc002b870c8463faebf19ef0c9db423870715672 /utils/ghc-pkg/Makefile | |
parent | 64bfc0114c0811fe175149dd6d803c7c77de0062 (diff) | |
download | haskell-68f7cd160712d9666a492703f7d4a89ad7e9158c.tar.gz |
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 '*'
Diffstat (limited to 'utils/ghc-pkg/Makefile')
-rw-r--r-- | utils/ghc-pkg/Makefile | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/utils/ghc-pkg/Makefile b/utils/ghc-pkg/Makefile index cef5a1f26b..9cb2a598e6 100644 --- a/utils/ghc-pkg/Makefile +++ b/utils/ghc-pkg/Makefile @@ -28,12 +28,16 @@ endif # ($bindir/ghc-pkg.exe), whereas on Unix it needs a wrapper script # to pass the appropriate flag to the real binary # ($libexecdir/ghc-pkg.bin) so that it can find package.conf. +# on Windows, we need to take control of filename globbing ourselves ifeq "$(HOSTPLATFORM)" "i386-unknown-mingw32" HS_PROG = ghc-pkg.exe INSTALL_PROGS += $(HS_PROG) +EXCLUDE_SRCS += CRT_noglob.c +NOGLOB_O = CRT_noglob.o else HS_PROG = ghc-pkg.bin INSTALL_LIBEXECS += $(HS_PROG) +NOGLOB_O = endif # ----------------------------------------------------------------------------- @@ -69,12 +73,12 @@ INPLACE_HS=ghc-pkg-inplace.hs INPLACE_PROG=ghc-pkg-inplace EXCLUDED_SRCS+=$(INPLACE_HS) -$(INPLACE_HS): Makefile $(FPTOOLS_TOP)/mk/config.mk +$(INPLACE_HS): Makefile $(FPTOOLS_TOP)/mk/config.mk $(NOGLOB_O) echo "import System.Cmd; import System.Environment; import System.Exit" > $@ echo "main = do args <- getArgs; rawSystem \"$(FPTOOLS_TOP_ABS)/$(GHC_PKG_DIR_REL)/$(HS_PROG)\" (\"--global-conf\":\"$(FPTOOLS_TOP_ABS)/driver/package.conf.inplace\":args) >>= exitWith" >> $@ $(INPLACE_PROG): $(INPLACE_HS) - $(HC) --make $< -o $@ + $(HC) --make $< -o $@ $(LD_OPTS) $(NOGLOB_O) all :: $(INPLACE_PROG) |