-
Notifications
You must be signed in to change notification settings - Fork 125
/
buildInfos.ml.post
42 lines (39 loc) · 1021 Bytes
/
buildInfos.ml.post
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(* this is the post infos *)
let git_version_counter =
opalang_git_version
let version_id = Printf.sprintf "%d-(%s)"
git_version_counter
opalang_git_sha
let assert_minimal_version s =
let check_int version =
if version > 27000
then
(*
At the time we write this code, the number of build
has been reset to 0.
*)
true
else
version <= opalang_git_version
in
try
let version = int_of_string s in
Some (check_int version)
with
| Failure "int_of_string" ->
(*
The given string may be: v45.
These tests are painful, but we are outside of libbase's scope there :)
*)
if String.length s > 0 && s.[0] = 'v'
then
let sub = String.sub s 1 (pred (String.length s)) in
try Some (check_int (int_of_string sub))
with Failure _ -> None
else
(* or S3.5 *)
if String.length s > 0 && s.[0] = 'S'
then
Some (s <= opa_version_name)
else
None