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 @@ -31,6 +31,7 @@ users)

## Actions
* Reorder the list of actions by increased priority [#6864 @kit-ty-kate - fix #6863]
* The internal `sources` directory now only serves to cache dev packages instead of every packages, saving disk space. For other packages it is now removed during the build phase. [#6440 @kit-ty-kate - fix #4056 #5448]

## Install
* Remove the build directory as soon as possible when installing a package [#6906 @kit-ty-kate - fix #5884]
Expand Down Expand Up @@ -332,6 +333,7 @@ users)
* `OpamSysInteract`: add `available_packages` and `installed_packages` to be computed separately, redefine `packages_status` accordingly. These funct-ions are now no-op if the given system packages set is empty. [#6489 @arozovyk]
* `OpamGlobalState`: add `is_root_read_only` to check if we are in sandboxed environment [#6489 @rjbou]
* `OpamSwitchState`: add `update_sys_packages` to update depexts status of a set of packages. [#6489 @arozovyk]
* `OpamSwitchState`: add `is_source_dir_temporary` [#6440 @kit-ty-kate]
* `OpamSysInteract`: add `available_packages` and `installed_packages` to be computed separately, redefine `packages_status` accordingly [#6489 @arozovyk]
* `OpamStateTypes`: add available system package status field `repos_syspkgs_available` (and its type `repo_syspkgs_available`) in `repos_state` for all the depexts declared in repo's packages. The new field is also added to the cache. [#6489 @arozovyk @rjbou]
* `OpamRepositoryState.load`: load repo's available system packages [#6489 @arozovyk]
Expand Down
14 changes: 11 additions & 3 deletions src/client/opamSolution.ml
Original file line number Diff line number Diff line change
Expand Up @@ -661,8 +661,12 @@ let parallel_apply t
in
let source_dir = source_dir nv in
(if OpamFilename.exists_dir source_dir
then (if not is_inplace then
OpamFilename.copy_dir ~src:source_dir ~dst:build_dir)
then
(if not is_inplace then
(if OpamSwitchState.is_source_dir_temporary t nv then
OpamFilename.move_dir ~src:source_dir ~dst:build_dir
else
OpamFilename.copy_dir ~src:source_dir ~dst:build_dir))
else OpamFilename.mkdir build_dir;
OpamAction.prepare_package_source t nv build_dir @@+ function
| Some exn -> store_time (); Done (`Exception exn)
Expand Down Expand Up @@ -702,7 +706,11 @@ let parallel_apply t
OpamFilename.rmdir d;
let source_dir = source_dir nv in
if OpamFilename.exists_dir source_dir
then OpamFilename.copy_dir ~src:source_dir ~dst:d
then
(if OpamSwitchState.is_source_dir_temporary t nv then
OpamFilename.move_dir ~src:source_dir ~dst:d
else
OpamFilename.copy_dir ~src:source_dir ~dst:d)
else OpamFilename.mkdir d;
OpamAction.prepare_package_source t nv d
else Done None) @@+ fun _ ->
Expand Down
3 changes: 3 additions & 0 deletions src/state/opamSwitchState.ml
Original file line number Diff line number Diff line change
Expand Up @@ -808,6 +808,9 @@ let source_dir st nv =
then OpamPath.Switch.pinned_package st.switch_global.root st.switch nv.name
else OpamPath.Switch.sources st.switch_global.root st.switch nv

let is_source_dir_temporary st nv =
not (OpamPackage.Set.mem nv st.pinned || is_dev_package st nv)

let overlay_opam_file st name =
if is_pinned st name then
let file =
Expand Down
8 changes: 7 additions & 1 deletion src/state/opamSwitchState.mli
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,15 @@ val dev_packages: 'a switch_state -> package_set

(** Returns the local source mirror for the given package
({!OpamPath.Switch.sources} or {!OpamPath.Switch.pinned_package}, depending
on wether it's pinned). *)
on whether it's pinned. If it's not pinned, be mindful that the directory
is temporary (see {!is_source_dir_temporary}). *)
val source_dir: 'a switch_state -> package -> dirname

(** Returns [true] if the {!source_dir} of the package is meant to be a
temporary directory: packages that are not pinned or "dev package"
as defined in {!is_dev_package}. *)
val is_source_dir_temporary: 'a switch_state -> package -> bool

(** Returns the opam file overlay stored internally for pinned packages *)
val overlay_opam_file:
'a switch_state -> OpamPackage.Name.t -> OpamFile.OPAM.t OpamFile.t option
Expand Down
Loading
Loading