Skip to content

Commit

Permalink
Merge pull request #2043 from OCamlPro/fix-update
Browse files Browse the repository at this point in the history
Fix update bug introduced in fef5f07
  • Loading branch information
AltGr committed Mar 4, 2015
2 parents 05a52e6 + 4495dd3 commit ab224ff
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 5 deletions.
12 changes: 12 additions & 0 deletions doc/pages/FAQ.md
Original file line number Diff line number Diff line change
Expand Up @@ -301,3 +301,15 @@ If for some reason you want the old behaviour, use one of:
* an address of the form `vc-controlled-dir#branch`, typically `#master`
* on Git you can use `#HEAD` to always get to the currently checked out branch
(which used to be the default, and still is for remote gits)

---

#### 🐫 OPAM wants to do reinstallations after update. Can I skip them ?

OPAM registers the need to recompile packages when they had meaningful changes
in the repository, to guarantee consistency and allow to propagate fixes to
already installed packages ; the official repository maintainers generally don't
abuse this. There is no built-in command to reset them, in purpose, but removing
the file `~/.opam/<switch>/reinstall` is enough to make OPAM forget about them.
It's quite safe, but don't report issues if you did and your system is not up to
date, obviously.
2 changes: 1 addition & 1 deletion src/client/opamState.ml
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ let package_state_one t all nv =
| `all ->
OpamFilename.checksum opam
@ OpamFilename.checksum descr
@ OpamRepository.url_checksum url
@ OpamFilename.checksum url
@ OpamFilename.checksum_dir files
@ OpamFilename.checksum archive
| `partial true ->
Expand Down
7 changes: 6 additions & 1 deletion src/core/opamRepository.ml
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,12 @@ let package_state repo prefix nv all =
let fs = match all with
| `all -> package_files repo prefix nv ~archive:true
| `partial b -> package_important_files repo prefix nv ~archive:b in
let l = List.map OpamFilename.checksum fs in
let url = OpamPath.Repository.url repo prefix nv in
let l =
List.map (fun f ->
if all <> `all && f = url then url_checksum f
else OpamFilename.checksum f)
fs in
List.flatten l

(* Sort repositories by priority *)
Expand Down
10 changes: 7 additions & 3 deletions src/core/opamRepository.mli
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,19 @@ val compiler_index: repository repository_name_map -> (repository_name * string

(** {2 State} *)

(** Get the meaningful checksum off an url file *)
(** Get the package archive checksum off an url file *)
val url_checksum: OpamFilename.t -> checksums

(** Get all the package files *)
val package_files: repository -> string option -> package -> archive:bool ->
filename list

(** Compute a package state (ie. a list of checksums). *)
val package_state: repository -> string option -> package -> [`all|`partial of bool]
(** Compute a package state (ie. a list of checksums). If [`partial archive],
only the checksum of the archive within the url file (instead of the file
itself), of the files/ subdirectory, and of the archive if set are
returned. *)
val package_state: repository -> string option -> package ->
[`all|`partial of bool]
-> checksums

(** Get all the compiler files *)
Expand Down

0 comments on commit ab224ff

Please sign in to comment.