From e699447e52e618c187b9615190df733e3f26c853 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Mon, 24 Aug 2020 08:38:29 +0100 Subject: [PATCH] Add fix for https://github.com/ocaml/dune/issues/3736 --- 3739.patch | 45 +++++++++++++++++++++++++++++++++++++++++++++ ocaml-dune.spec | 9 ++++++++- 2 files changed, 53 insertions(+), 1 deletion(-) create mode 100644 3739.patch diff --git a/3739.patch b/3739.patch new file mode 100644 index 0000000..55e47d1 --- /dev/null +++ b/3739.patch @@ -0,0 +1,45 @@ +From 4a1fee49b97e7bd4da368c83c5a28cdbde9e140d Mon Sep 17 00:00:00 2001 +From: Rudi Grinberg +Date: Sat, 22 Aug 2020 20:56:56 -0700 +Subject: [PATCH] [configurator] more flexible #define parsing + +Allow duplicate values for the same key as long as they are the same. + +Signed-off-by: Rudi Grinberg +--- + otherlibs/configurator/src/v1.ml | 17 +++++++++++++++-- + 1 file changed, 15 insertions(+), 2 deletions(-) + +diff --git a/otherlibs/configurator/src/v1.ml b/otherlibs/configurator/src/v1.ml +index 1cdc5c5672..721c0e7384 100644 +--- a/otherlibs/configurator/src/v1.ml ++++ b/otherlibs/configurator/src/v1.ml +@@ -532,13 +532,26 @@ const char *s%i = "BEGIN-%i-false-END"; + let extract_values obj_file vars = + let values = + Io.with_lexbuf_from_file obj_file ~f:(Extract_obj.extract []) +- |> Int.Map.of_list_exn ++ |> List.fold_left ~init:Int.Map.empty ~f:(fun acc (key, v) -> ++ Int.Map.update acc ~key ~f:(function ++ | None -> Some (Ok v) ++ | Some (Error vs) -> Some (Error (v :: vs)) ++ | Some (Ok v') -> ++ Some ++ ( if v = v' then ++ Ok v' ++ else ++ Error [ v; v' ] ))) + in + List.mapi vars ~f:(fun i (name, t) -> + let raw_val = + match Int.Map.find values i with + | None -> die "Unable to get value for %s" name +- | Some v -> v ++ | Some (Ok v) -> v ++ | Some (Error vs) -> ++ let vs = List.sort_uniq ~cmp:compare vs in ++ die "Duplicate values for %s:\n%s" name ++ (vs |> List.map ~f:(sprintf "- %s") |> String.concat ~sep:"\n") + in + let value = + match t with diff --git a/ocaml-dune.spec b/ocaml-dune.spec index ed51cb3..a028aae 100644 --- a/ocaml-dune.spec +++ b/ocaml-dune.spec @@ -6,7 +6,7 @@ Name: ocaml-%{libname} Version: 2.7.0 -Release: 2%{?dist} +Release: 3%{?dist} Summary: A composable build system for OCaml # Dune itself is MIT. Some bundled libraries have a different license: @@ -22,6 +22,10 @@ License: MIT and LGPLv2 and LGPLv2 with exceptions and ISC URL: https://dune.build Source0: https://github.com/ocaml/%{libname}/archive/%{version}/%{libname}-%{version}.tar.gz +# https://github.com/ocaml/dune/issues/3736 +# https://github.com/ocaml/dune/pull/3739 +Patch1: 3739.patch + BuildRequires: emacs BuildRequires: ocaml >= 4.08 BuildRequires: ocaml-findlib @@ -191,6 +195,9 @@ cp -ar README.md CHANGES.md MIGRATION.md doc/_build/* %{buildroot}%{_pkgdocdir}/ %{_emacs_sitelispdir}/dune* %changelog +* Mon Aug 24 2020 Richard W.M. Jones - 2.7.0-3 +- Add fix for https://github.com/ocaml/dune/issues/3736 + * Fri Aug 21 2020 Richard W.M. Jones - 2.7.0-2 - OCaml 4.11.0 rebuild