Change compiler's requested version

This commit is contained in:
Pierre Chambart 2018-01-18 16:18:55 +01:00 committed by Grégoire Henry
parent b5f9e2479f
commit 590ddb750f
12 changed files with 156 additions and 13 deletions

View File

@ -2,6 +2,13 @@
DEV ?= --dev
PACKAGES:=$(patsubst %.opam,%,$(notdir $(shell find -name *.opam)))
current_ocaml_version := $(shell ocamlc -version)
include scripts/version.sh
ifneq (${current_ocaml_version},${ocaml_version})
$(error Unexpected ocaml version (found: ${current_ocaml_version}, expected: ${ocaml_version}))
endif
all:
@jbuilder build ${DEV} \
src/bin_node/main.exe \

View File

@ -4,7 +4,7 @@ How to build and run
Build instructions
------------------
To compile Tezos, you need an OCaml compiler (version 4.04.2) and all
To compile Tezos, you need an OCaml compiler (version 4.06.0) and all
the libraries listed in the various ``tezos-*.opam`` files.
The best way to install all dependencies is by first installing
@ -19,7 +19,7 @@ projects or other versions of Tezos.
::
opam update
opam switch "tezos" --alias-of 4.04.2
opam switch "tezos" --alias-of 4.06.0
Note that if you previously created a switch named ``tezos`` but with an
older OCaml version you need to remove the switch with

View File

@ -74,7 +74,7 @@ RUN mkdir ~/.ssh && \
git config --global user.name "Tezos CI" && \
opam init --bare --no-setup --yes \
tezos_deps /home/opam/opam-repository-tezos_deps && \
opam switch create --yes tezos ocaml-base-compiler.4.04.2
opam switch create --yes tezos ocaml-base-compiler.${ocaml_version}
RUN opam install --yes opam-depext

View File

@ -77,7 +77,7 @@ COPY opam-repository-master opam-repository-master
COPY opam /usr/local/bin/opam
RUN apk add --no-cache ocaml build-base m4 tar xz bzip2 curl perl rsync
RUN cd ./opam-repository-master/compilers && \
( ls -1 | grep -v \$(ocamlc --version) | xargs rm -r )
( ls -1 | grep -v ${ocaml_version} | xargs rm -r )
RUN opam init --no-setup --yes default ./opam-repository-master
RUN opam install --yes opam-bundle
COPY opam-repository-tezos opam-repository-tezos

View File

@ -10,6 +10,7 @@ export OPAMYES=yes
### Temporary HACK
## Should be in sync with `opam-unpin.sh`
opam pin add --no-action leveldb git://github.com/chambart/ocaml-leveldb.git#update_4.06
opam pin add --no-action --dev-repo ocplib-json-typed
## Unpin package we used to pin...

View File

@ -12,7 +12,7 @@ opam pin remove $packages
### Temporary HACK
## Should be in sync with `opam-pin.sh`
opam pin remove --no-action sodium
opam pin remove --no-action leveldb
opam pin remove --no-action ocplib-json-typed
### End of temporary HACK

View File

@ -1,10 +1,10 @@
#! /bin/sh
## `ocaml-verions` should be in sync with
## `ocaml-version` should be in sync with `README.rst` and
## `lib.protocol-compiler/tezos-protocol-compiler.opam`
alpine_version=3.6
ocaml_version=4.04.2
ocaml_version=4.06.1
leveldb_version=1.18
opam_version=2.0.0~rc
opam_tag=2.0.0-rc

View File

@ -293,7 +293,7 @@ let setup_formatter ppf format verbosity =
Format.pp_get_formatter_tag_functions ppf (),
Format.pp_get_print_tags ppf () in
begin
Format.pp_flush_formatter ppf ;
Format.pp_print_flush ppf () ;
Format.pp_set_formatter_out_functions ppf
{ out_string =
(fun s b a ->
@ -302,7 +302,8 @@ let setup_formatter ppf format verbosity =
else if not !skip then orig_out_functions.out_string s b a) ;
out_spaces = (fun n -> if not !skip then orig_out_functions.out_spaces n) ;
out_newline = (fun () -> if not !skip then orig_out_functions.out_newline ()) ;
out_flush = (fun () -> if not !skip then orig_out_functions.out_flush ()) } ;
out_flush = (fun () -> if not !skip then orig_out_functions.out_flush ()) ;
out_indent = orig_out_functions.out_indent } ;
let levels = ref [] in
let setup_level (level, op) =
if op level verbosity then
@ -499,7 +500,7 @@ let setup_formatter ppf format verbosity =
orig_state
let restore_formatter ppf (out_functions, tag_functions, tags) =
Format.pp_flush_formatter ppf ;
Format.pp_print_flush ppf () ;
Format.pp_set_formatter_out_functions ppf out_functions ;
Format.pp_set_formatter_tag_functions ppf tag_functions ;
Format.pp_set_print_tags ppf tags

View File

@ -120,8 +120,8 @@ let main select_commands =
Format.printf "@{<error>@{<title>Fatal error@}@} %s." (Printexc.to_string exn) ;
Lwt.return 1
end >>= fun retcode ->
Format.pp_flush_formatter Format.std_formatter ;
Format.pp_flush_formatter Format.err_formatter ;
Format.pp_print_flush Format.err_formatter () ;
Format.pp_print_flush Format.std_formatter () ;
Lwt.return retcode
(* Where all the user friendliness starts *)

View File

@ -23,4 +23,4 @@ build-test: [
[ "jbuilder" "runtest" "-p" name "-j" jobs ]
]
## ocaml-version should be in sync with `script/version.sh`
available: [ ocaml-version = "4.04.2" ]
available: [ ocaml-version = "4.06.1" ]

View File

@ -86,6 +86,19 @@ sig
of [x] in [m] disappears.
@before 4.03 Physical equality was not ensured. *)
val update: key -> ('a option -> 'a option) -> 'a t -> 'a t
(** [update x f m] returns a map containing the same bindings as
[m], except for the binding of [x]. Depending on the value of
[y] where [y] is [f (find_opt x m)], the binding of [x] is
added, removed or updated. If [y] is [None], the binding is
removed if it exists; otherwise, if [y] is [Some z] then [x]
is associated to [z] in the resulting map. If [x] was already
bound in [m] to a value that is physically equal to [z], [m]
is returned unchanged (the result of the function is then
physically equal to [m]).
@since 4.06.0
*)
val singleton: key -> 'a -> 'a t
(** [singleton x y] returns the one-element map that contains a binding [y]
for [x].
@ -184,12 +197,25 @@ sig
@since 3.12.0
*)
val min_binding_opt: 'a t -> (key * 'a) option
(** Return the smallest binding of the given map
(with respect to the [Ord.compare] ordering), or [None]
if the map is empty.
@since 4.05
*)
val max_binding: 'a t -> (key * 'a)
(** Same as {!Map.S.min_binding}, but returns the largest binding
of the given map.
@since 3.12.0
*)
val max_binding_opt: 'a t -> (key * 'a) option
(** Same as {!Map.S.min_binding_opt}, but returns the largest binding
of the given map.
@since 4.05
*)
val choose: 'a t -> (key * 'a)
(** Return one binding of the given map, or raise [Not_found] if
the map is empty. Which binding is chosen is unspecified,
@ -197,6 +223,13 @@ sig
@since 3.12.0
*)
val choose_opt: 'a t -> (key * 'a) option
(** Return one binding of the given map, or [None] if
the map is empty. Which binding is chosen is unspecified,
but equal bindings will be chosen for equal maps.
@since 4.05
*)
val split: key -> 'a t -> 'a t * 'a option * 'a t
(** [split x m] returns a triple [(l, data, r)], where
[l] is the map with all the bindings of [m] whose key
@ -212,6 +245,47 @@ sig
(** [find x m] returns the current binding of [x] in [m],
or raises [Not_found] if no such binding exists. *)
val find_opt: key -> 'a t -> 'a option
(** [find_opt x m] returns [Some v] if the current binding of [x]
in [m] is [v], or [None] if no such binding exists.
@since 4.05
*)
val find_first: (key -> bool) -> 'a t -> key * 'a
(** [find_first f m], where [f] is a monotonically increasing function,
returns the binding of [m] with the lowest key [k] such that [f k],
or raises [Not_found] if no such key exists.
For example, [find_first (fun k -> Ord.compare k x >= 0) m] will return
the first binding [k, v] of [m] where [Ord.compare k x >= 0]
(intuitively: [k >= x]), or raise [Not_found] if [x] is greater than any
element of [m].
@since 4.05
*)
val find_first_opt: (key -> bool) -> 'a t -> (key * 'a) option
(** [find_first_opt f m], where [f] is a monotonically increasing function,
returns an option containing the binding of [m] with the lowest key [k]
such that [f k], or [None] if no such key exists.
@since 4.05
*)
val find_last: (key -> bool) -> 'a t -> key * 'a
(** [find_last f m], where [f] is a monotonically decreasing function,
returns the binding of [m] with the highest key [k] such that [f k],
or raises [Not_found] if no such key exists.
@since 4.05
*)
val find_last_opt: (key -> bool) -> 'a t -> (key * 'a) option
(** [find_last_opt f m], where [f] is a monotonically decreasing function,
returns an option containing the binding of [m] with the highest key [k]
such that [f k], or [None] if no such key exists.
@since 4.05
*)
val map: ('a -> 'b) -> 'a t -> 'b t
(** [map f m] returns a map with same domain as [m], where the
associated value [a] of all bindings of [m] has been

View File

@ -168,15 +168,35 @@ sig
(with respect to the [Ord.compare] ordering), or raise
[Not_found] if the set is empty. *)
val min_elt_opt: t -> elt option
(** Return the smallest element of the given set
(with respect to the [Ord.compare] ordering), or [None]
if the set is empty.
@since 4.05
*)
val max_elt: t -> elt
(** Same as {!Set.S.min_elt}, but returns the largest element of the
given set. *)
val max_elt_opt: t -> elt option
(** Same as {!Set.S.min_elt_opt}, but returns the largest element of the
given set.
@since 4.05
*)
val choose: t -> elt
(** Return one element of the given set, or raise [Not_found] if
the set is empty. Which element is chosen is unspecified,
but equal elements will be chosen for equal sets. *)
val choose_opt: t -> elt option
(** Return one element of the given set, or [None] if
the set is empty. Which element is chosen is unspecified,
but equal elements will be chosen for equal sets.
@since 4.05
*)
val split: elt -> t -> t * bool * t
(** [split x s] returns a triple [(l, present, r)], where
[l] is the set of elements of [s] that are
@ -192,6 +212,46 @@ sig
exists.
@since 4.01.0 *)
val find_opt: elt -> t -> elt option
(** [find_opt x s] returns the element of [s] equal to [x] (according
to [Ord.compare]), or [None] if no such element
exists.
@since 4.05 *)
val find_first: (elt -> bool) -> t -> elt
(** [find_first f s], where [f] is a monotonically increasing function,
returns the lowest element [e] of [s] such that [f e],
or raises [Not_found] if no such element exists.
For example, [find_first (fun e -> Ord.compare e x >= 0) s] will return
the first element [e] of [s] where [Ord.compare e x >= 0] (intuitively:
[e >= x]), or raise [Not_found] if [x] is greater than any element of
[s].
@since 4.05
*)
val find_first_opt: (elt -> bool) -> t -> elt option
(** [find_first_opt f s], where [f] is a monotonically increasing function,
returns an option containing the lowest element [e] of [s] such that
[f e], or [None] if no such element exists.
@since 4.05
*)
val find_last: (elt -> bool) -> t -> elt
(** [find_last f s], where [f] is a monotonically decreasing function,
returns the highest element [e] of [s] such that [f e],
or raises [Not_found] if no such element exists.
@since 4.05
*)
val find_last_opt: (elt -> bool) -> t -> elt option
(** [find_last_opt f s], where [f] is a monotonically decreasing function,
returns an option containing the highest element [e] of [s] such that
[f e], or [None] if no such element exists.
@since 4.05
*)
val of_list: elt list -> t
(** [of_list l] creates a set from a list of elements.
This is usually more efficient than folding [add] over the list,