Add fix for https://github.com/ocaml/dune/issues/3736
This commit is contained in:
parent
5203fad767
commit
e699447e52
45
3739.patch
Normal file
45
3739.patch
Normal file
@ -0,0 +1,45 @@
|
||||
From 4a1fee49b97e7bd4da368c83c5a28cdbde9e140d Mon Sep 17 00:00:00 2001
|
||||
From: Rudi Grinberg <me@rgrinberg.com>
|
||||
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 <me@rgrinberg.com>
|
||||
---
|
||||
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
|
@ -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 <rjones@redhat.com> - 2.7.0-3
|
||||
- Add fix for https://github.com/ocaml/dune/issues/3736
|
||||
|
||||
* Fri Aug 21 2020 Richard W.M. Jones <rjones@redhat.com> - 2.7.0-2
|
||||
- OCaml 4.11.0 rebuild
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user