Skip to content

Commit

Permalink
Merge pull request ocaml#2239 from OCamlPro/conf-file-1.2
Browse files Browse the repository at this point in the history
Only update opam version of ~/.opam/config to 1.2
  • Loading branch information
AltGr committed Jul 3, 2015
2 parents 1fedb45 + 05e347b commit 2aecfac
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 11 deletions.
4 changes: 2 additions & 2 deletions META.in
Expand Up @@ -29,12 +29,12 @@ package "state" (
version = "@PACKAGE_VERSION@"
archive(byte) = "opam-state.cma"
archive(native) = "opam-state.cmxa"
requires = "opam-lib, opam-lib.format, opam-lib.solver, opam-lib.repository, cmdliner"
requires = "re.glob, opam-lib, opam-lib.format, opam-lib.solver, opam-lib.repository, cmdliner"
)

package "client" (
version = "@PACKAGE_VERSION@"
archive(byte) = "opam-client.cma"
archive(native) = "opam-client.cmxa"
requires = "cmdliner, re.glob, opam-lib, opam-lib.format, opam-lib.solver, opam-lib.repository, opam-lib.state"
requires = "cmdliner, opam-lib, opam-lib.format, opam-lib.solver, opam-lib.repository, opam-lib.state"
)
2 changes: 1 addition & 1 deletion admin-scripts/Makefile
Expand Up @@ -5,5 +5,5 @@

couverture: couverture.ml
sed 's/^#.*//' $< >couverture-tmp.ml
ocamlfind ocamlopt -package opam-lib.state -linkpkg ../src/tools/opam_admin_top.ml couverture-tmp.ml -o $@
ocamlfind ocamlopt -package re.glob,opam-lib.state -linkpkg ../src/tools/opam_admin_top.ml couverture-tmp.ml -o $@
rm couverture-tmp.ml
2 changes: 1 addition & 1 deletion src/format/opamFile.ml
Expand Up @@ -806,7 +806,7 @@ module X = struct

let with_repositories t repositories = { t with repositories }
let with_switch t switch = { t with switch }
let with_current_opam_version t = { t with opam_version = OpamVersion.current_nopatch }
let with_opam_version t opam_version = { t with opam_version }
let with_criteria t solver_criteria = { t with solver_criteria }
let with_solver t solver = { t with solver }

Expand Down
4 changes: 2 additions & 2 deletions src/format/opamFile.mli
Expand Up @@ -71,8 +71,8 @@ module Config: sig
(** Repository updates *)
val with_repositories: t -> repository_name list -> t

(** Update opam-version to the current one *)
val with_current_opam_version: t -> t
(** Update opam-version *)
val with_opam_version: t -> OpamVersion.t -> t

val with_criteria: t -> (solver_criteria * string) list -> t

Expand Down
13 changes: 8 additions & 5 deletions src/state/opamState.ml
Expand Up @@ -1204,12 +1204,15 @@ let load_config root =
(OpamFilename.Dir.to_string (OpamStateConfig.(!r.root_dir)));
(* opam has been updated, so refresh the configuration file and
clean-up the cache. *)
if OpamVersion.compare config_version (OpamVersion.of_string "1.2") < 0 then
let v1_2 = OpamVersion.of_string "1.2" in
if OpamVersion.compare config_version v1_2 < 0 then
let config = OpamFile.Config.with_opam_version config v1_2 in
!upgrade_to_1_2_hook ();
let config = OpamFile.Config.with_current_opam_version config in
OpamStateConfig.write root config;
Cache.remove ();
config
OpamStateConfig.write root config;
Cache.remove ();
config
else
config
) else
config

Expand Down

0 comments on commit 2aecfac

Please sign in to comment.