Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ users)
## External dependencies

## Format upgrade
* Fix switch and repo format upgrade on Windows. A block occurred because the global lock fd was reopened instead of using the one already opened. [#6839 @rjbou]

## Sandbox
* Allow the macOS sandbox to write in the `/var/folders/` and `/var/db/mds/` directories as it is required by some of macOS core tools [#4797 @kit-ty-kate - fix #4389 #6460]
Expand Down Expand Up @@ -164,6 +165,7 @@ users)
* `OpamRepositoryState.load_opams_from_diff` track added packages to avoid removing version-equivalent packages [#6774 @arozovyk fix #6754]
* `OpamGlobalState.all_installed_versions`: was added [#6818 @dra27]
* `OpamGlobalState.installed_versions`: was removed [#6818 @dra27]
* `OpamStateTypes.global_state`: add field `lock` that contains the global lock (not config one) [#6839 @rjbou]

## opam-solver

Expand Down
1 change: 1 addition & 0 deletions src/client/opamAdminCommand.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1087,6 +1087,7 @@ let get_virtual_switch_state repo_root env =
in
let gt = {
global_lock = OpamSystem.lock_none;
lock = OpamSystem.lock_none;
root = OpamStateConfig.(!r.root_dir);
config = OpamStd.Option.Op.(OpamStateConfig.(
load ~lock_kind:`Lock_read !r.root_dir) +!
Expand Down
10 changes: 3 additions & 7 deletions src/state/opamFormatUpgrade.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1204,12 +1204,8 @@ let flock_root =
) in
fun () -> Lazy.force t
in
fun ?global_lock kind root ->
fun ~global_lock kind ->
try
let global_lock = match global_lock with
| Some g -> g
| None -> OpamFilename.flock `Lock_read (OpamPath.lock root)
in
OpamFilename.with_flock_upgrade kind ?dontblock:(dontblock ()) global_lock
with OpamSystem.Locked ->
OpamConsole.error_and_exit `Locked
Expand Down Expand Up @@ -1345,7 +1341,7 @@ let as_necessary ?reinit requested_lock global_lock root config =
(OpamFilename.Dir.to_string root)
(OpamVersion.to_string root_version)
(OpamVersion.to_string latest_version);
flock_root global_lock_kind ~global_lock root @@ fun _ ->
flock_root ~global_lock global_lock_kind @@ fun _ ->
if not on_the_fly then
if need_hard_upg then
if is_dev &&
Expand Down Expand Up @@ -1416,7 +1412,7 @@ let as_necessary_repo_switch_t updates read_f lock_kind gt =
(OpamVersion.to_string written_root_version)
(OpamVersion.to_string (OpamFile.Config.opam_root_version config));
if OpamConsole.confirm "Continue?" then
flock_root `Lock_write root @@ fun _ ->
flock_root `Lock_write ~global_lock:gt.lock @@ fun _ ->
(* we keep only light upgrades as hard upgrade is already handled by
global state loading, so we must not have to handle hard upgrades
as this point. *)
Expand Down
6 changes: 4 additions & 2 deletions src/state/opamGlobalState.ml
Original file line number Diff line number Diff line change
Expand Up @@ -139,12 +139,14 @@ let load lock_kind =
acc)
global_variables eval_variables
in
{ global_lock = config_lock;
{
lock = global_lock;
global_lock = config_lock;
root;
config;
global_variables;
global_state_to_upgrade;
}
}

let switches gt =
OpamFile.Config.installed_switches gt.config
Expand Down
4 changes: 4 additions & 0 deletions src/state/opamStateTypes.mli
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ type gt_changes = { gtc_repo: bool; gtc_switch: bool }
(** Global state corresponding to an opam root and its configuration *)
type +'lock global_state = {
global_lock: OpamSystem.lock;
(** Global config lock file *)

lock: OpamSystem.lock;
(** Global lock file *)

root: OpamPath.t;
(** The global opam root path (caution: this is stored here but some code may
Expand Down
Loading