Skip to content

Commit

Permalink
Tweak 1.x -> 2.0 repo upgrade
Browse files Browse the repository at this point in the history
The repository upgrade automatically adds a dependency on the ocaml
package (i.e. the compiler) if none are inferred (through ocaml-version
translation, etc.). This is a nuisance if running opam admin upgrade for
a second time (e.g. because some older package definitions have been
imported) where you have packages which intentionally do not depend on
the compiler.

Process tweaked so that if the opam file already has opam-version: 2.0,
then the automatic dependency is not added.

Signed-off-by: David Allsopp <[email protected]>
  • Loading branch information
dra27 committed Sep 3, 2017
1 parent f462137 commit f9b0656
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/state/opamFormatUpgrade.ml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ let opam_file_from_1_2_to_2_0 ?filename opam =
aux available
in
let pkg_deps =
if NMap.mem ocaml_wrapper_pkgname pkg_deps ||
if OpamVersion.compare (OpamFile.OPAM.opam_version opam) v2_0 >= 0 ||
NMap.mem ocaml_wrapper_pkgname pkg_deps ||
OpamFile.OPAM.has_flag Pkgflag_Conf opam
then pkg_deps
else NMap.add ocaml_wrapper_pkgname Empty pkg_deps
Expand Down

0 comments on commit f9b0656

Please sign in to comment.