PR#5214: ocamlfind plugin invokes 'cut' utility

git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12713 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
master
Xavier Clerc 2012-07-16 08:53:51 +00:00
parent 7ce309af1b
commit e17f1f82f2
2 changed files with 18 additions and 1 deletions

View File

@ -125,6 +125,7 @@ Bug Fixes:
* PR#5312: command-line arguments @reponsefile auto-expansion feature
removed from the Windows OCaml runtime, to avoid conflicts with "-w @..."
- PR#5313: ocamlopt -g misses optimizations
- PR#5214: ocamlfind plugin invokes 'cut' utility
- PR#5316: objinfo now shows ccopts/ccobjs/force_link when applicable
- PR#5318: segfault on stack overflow when reading marshaled data
- PR#5322: type abbreviations expanding to a universal type variable

View File

@ -112,8 +112,24 @@ let rec query name =
| Lexers.Error s ->
error (Cannot_parse_query (name, s))
let split_nl s =
let x = ref [] in
let rec go s =
let pos = String.index s '\n' in
x := (String.before s pos)::!x;
go (String.after s (pos + 1))
in
try
go s
with Not_found -> !x
let before_space s =
try
String.before s (String.index s ' ')
with Not_found -> s
let list () =
run_and_parse Lexers.blank_sep_strings "%s list | cut -d' ' -f1" ocamlfind
List.map before_space (split_nl & run_and_read "%s list" ocamlfind)
(* The closure algorithm is easy because the dependencies are already closed
and sorted for each package. We only have to make the union. We could also