On Wed, Nov 06, 2013 at 11:17:14AM -0700, Jon wrote: > I tried to comment this out and recompile guestfs, but I get an error: > > make[2]: Entering directory `/root/libguestfs-1.25.6/builder' > ocamlfind ocamlopt -g -warn-error CDEFLMPSUVYZX -package str,unix -I > ../src/.libs -I ../ocaml -I ../mllib -package gettext-stub -c builder.ml -o > builder.cmx > File "builder.ml", line 53, characters 4-14: > Error: Unbound value List.iteri > make[2]: *** [builder.cmx] Error 2 > make[2]: Leaving directory `/root/libguestfs-1.25.6/builder' > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory `/root/libguestfs-1.25.6' > make: *** [all] Error 2
Hmm, this is actually another bug :-( The attached patch should fix this one and allow you to compile libguestfs with the older version of OCaml that didn't have List.iteri. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://people.redhat.com/~rjones/virt-top
>From a2ef259c3cf41f96140cff238fb6539de1db263c Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" <[email protected]> Date: Wed, 6 Nov 2013 19:19:20 +0000 Subject: [PATCH] builder: Old OCaml didn't have List.iteri, so add a utility function. --- builder/builder.ml | 2 +- mllib/common_utils.ml | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/builder/builder.ml b/builder/builder.ml index a5a4dfe..21023fa 100644 --- a/builder/builder.ml +++ b/builder/builder.ml @@ -50,7 +50,7 @@ let main () = eprintf "command line:"; List.iter (eprintf " %s") (Array.to_list Sys.argv); prerr_newline (); - List.iteri ( + iteri ( fun i (source, fingerprint) -> eprintf "source[%d] = (%S, %S)\n" i source fingerprint ) sources diff --git a/mllib/common_utils.ml b/mllib/common_utils.ml index e7ed3fe..953638f 100644 --- a/mllib/common_utils.ml +++ b/mllib/common_utils.ml @@ -164,6 +164,13 @@ let rec filter_map f = function | Some y -> y :: filter_map f xs | None -> filter_map f xs +let iteri f xs = + let rec loop i = function + | [] -> () + | x :: xs -> f i x; loop (i+1) xs + in + loop 0 xs + (* Timestamped progress messages, used for ordinary messages when not * --quiet. *) -- 1.8.3.1
_______________________________________________ Libguestfs mailing list [email protected] https://www.redhat.com/mailman/listinfo/libguestfs
