Make subst add the version to the opam file

This commit is contained in:
Jeremie Dimino 2017-05-07 20:59:29 +01:00 committed by Jeremie Dimino
parent e498b5a720
commit 221baefb81
1 changed files with 8 additions and 1 deletions

View File

@ -129,7 +129,14 @@ let subst_string s ~map =
Some (Buffer.contents buf)
let subst_file fn ~map =
match read_file fn |> subst_string ~map with
let s = read_file fn in
let s =
if String.is_suffix fn ~suffix:".opam" then
"version: \"%%" ^ "VERSION_NUM" ^ "%%\"\n" ^ s
else
s
in
match subst_string s ~map with
| None -> ()
| Some s -> write_file fn s