From 221baefb81f65f706683b81fa30fc3654634be93 Mon Sep 17 00:00:00 2001 From: Jeremie Dimino Date: Sun, 7 May 2017 20:59:29 +0100 Subject: [PATCH] Make subst add the version to the opam file --- src/watermarks.ml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/watermarks.ml b/src/watermarks.ml index 6c84d21c..e3f28128 100644 --- a/src/watermarks.ml +++ b/src/watermarks.ml @@ -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