diff options
author | Xavier Clerc <xavier.clerc@inria.fr> | 2012-07-16 08:53:51 +0000 |
---|---|---|
committer | Xavier Clerc <xavier.clerc@inria.fr> | 2012-07-16 08:53:51 +0000 |
commit | e17f1f82f251d0bf645f440d3c78ba8811902b04 (patch) | |
tree | 7addfbf40453fdcbdd8ef25dba6bc25a05ed12f3 | |
parent | 7ce309af1bd65894468434563d8056cd1790ba1d (diff) |
PR#5214: ocamlfind plugin invokes 'cut' utility
git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@12713 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
-rw-r--r-- | Changes | 1 | ||||
-rw-r--r-- | ocamlbuild/findlib.ml | 18 |
2 files changed, 18 insertions, 1 deletions
@@ -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 diff --git a/ocamlbuild/findlib.ml b/ocamlbuild/findlib.ml index 873adbabf..b5ef87810 100644 --- a/ocamlbuild/findlib.ml +++ b/ocamlbuild/findlib.ml @@ -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 |