Skip to content
Open
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 @@ -24,6 +24,7 @@ users)
## Config report

## Actions
* The internal `sources` directory now only serves to cache dev packages instead of every packages, saving disk space [#6440 @kit-ty-kate - fix #4056 #5448]

## Install

Expand All @@ -35,6 +36,7 @@ users)
* Read full lines when asking for user input when `TERM=dumb` [#6829 @arvidj - fix #6828]

## Switch
* The internal `sources` directory is now always created on switch creation [#6440 @kit-ty-kate]

## Config

Expand Down
7 changes: 4 additions & 3 deletions src/client/opamSolution.ml
Original file line number Diff line number Diff line change
Expand Up @@ -644,21 +644,22 @@ let parallel_apply t
"" (OpamPackage.Map.find_opt nv inplace));
Done (`Successful (installed, removed)))
else
let source_dir = source_dir nv in
let is_inplace, build_dir =
try true, OpamPackage.Map.find nv inplace
with Not_found ->
let dir = OpamPath.Switch.build t.switch_global.root t.switch nv in
if not OpamClientConfig.(!r.reuse_build_dir) then
let source_dir_is_build_dir = OpamFilename.Dir.equal dir source_dir in
if not (OpamClientConfig.(!r.reuse_build_dir) || source_dir_is_build_dir) then
OpamFilename.rmdir dir;
false, dir
source_dir_is_build_dir, dir
in
let test, doc, dev_setup =
let found = OpamPackage.Set.mem nv requested in
OpamStateConfig.(!r.build_test) && found,
OpamStateConfig.(!r.build_doc) && found,
OpamStateConfig.(!r.dev_setup) && found
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)
Expand Down
1 change: 1 addition & 0 deletions src/state/opamSwitchAction.ml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ let create_empty_switch gt ?synopsis ?repos ?invariant switch =
OpamFilename.mkdir (OpamPath.Switch.lib_dir root switch config);
OpamFilename.mkdir (OpamPath.Switch.stublibs root switch config);
OpamFilename.mkdir (OpamPath.Switch.toplevel root switch config);
OpamFilename.mkdir (OpamPath.Switch.sources_dir root switch);
OpamFilename.mkdir (OpamPath.Switch.build_dir root switch);
OpamFilename.mkdir (OpamPath.Switch.bin root switch config);
OpamFilename.mkdir (OpamPath.Switch.sbin root switch config);
Expand Down
9 changes: 6 additions & 3 deletions src/state/opamSwitchState.ml
Original file line number Diff line number Diff line change
Expand Up @@ -765,9 +765,12 @@ let is_version_pinned st name =
| None -> false

let source_dir st nv =
if OpamPackage.Set.mem nv st.pinned
then OpamPath.Switch.pinned_package st.switch_global.root st.switch nv.name
else OpamPath.Switch.sources st.switch_global.root st.switch nv
if OpamPackage.Set.mem nv st.pinned then
OpamPath.Switch.pinned_package st.switch_global.root st.switch nv.name
else if is_dev_package st nv then
OpamPath.Switch.sources st.switch_global.root st.switch nv
else
OpamPath.Switch.build st.switch_global.root st.switch nv

let overlay_opam_file st name =
if is_pinned st name then
Expand Down
104 changes: 49 additions & 55 deletions tests/reftests/action-disk.test

Large diffs are not rendered by default.

7 changes: 4 additions & 3 deletions tests/reftests/dot-install.test
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ ACTION prepare_package_source: dot.~dev at ${BASEDIR}/O
ACTION Removing dot.~dev
-> removed dot.~dev
Installing dot.~dev.
TRACK after install: 0 elements, 0 added, scanned in 0.000s
TRACK after install: 3 elements, 0 added, scanned in 0.000s
-> installed dot.~dev
ACTION Cleaning up artefacts of dot.~dev
Done.
Expand Down Expand Up @@ -263,7 +263,6 @@ The following actions will be performed:
- install no-specified-dir 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
SYSTEM rmdir ${BASEDIR}/OPAM/rem-dir/.opam-switch/build/no-specified-dir.1
SYSTEM mkdir ${BASEDIR}/OPAM/rem-dir/.opam-switch/build/no-specified-dir.1
SYSTEM read ${BASEDIR}/OPAM/repo/default/packages/no-specified-dir/no-specified-dir.1/files/no-specified-dir.install
SYSTEM write ${BASEDIR}/OPAM/rem-dir/.opam-switch/build/no-specified-dir.1/no-specified-dir.install
Expand Down Expand Up @@ -345,7 +344,9 @@ SYSTEM rmdir ${BASEDIR}/OPAM/rem-dir/.opam-switch/packa
SYSTEM rm ${BASEDIR}/OPAM/rem-dir/.opam-switch/packages/no-specified-dir.1/opam
SYSTEM rm ${BASEDIR}/OPAM/rem-dir/.opam-switch/packages/no-specified-dir.1/files/no-specified-dir.install
SYSTEM rm ${BASEDIR}/OPAM/rem-dir/.opam-switch/packages/no-specified-dir.1/files/a-file
SYSTEM rmdir ${BASEDIR}/OPAM/rem-dir/.opam-switch/sources/no-specified-dir.1
SYSTEM rmdir ${BASEDIR}/OPAM/rem-dir/.opam-switch/build/no-specified-dir.1
SYSTEM rm ${BASEDIR}/OPAM/rem-dir/.opam-switch/build/no-specified-dir.1/no-specified-dir.install
SYSTEM rm ${BASEDIR}/OPAM/rem-dir/.opam-switch/build/no-specified-dir.1/a-file
Done.
SYSTEM LOCK ${BASEDIR}/OPAM/rem-dir/.opam-switch/lock (write => none)
SYSTEM LOCK ${BASEDIR}/OPAM/rem-dir/.opam-switch/lock (none => none)
Expand Down
12 changes: 6 additions & 6 deletions tests/reftests/download.test
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ The following actions will be performed:
- install foo 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
SYSTEM rmdir ${BASEDIR}/OPAM/download/.opam-switch/sources/foo.1
SYSTEM rmdir ${BASEDIR}/OPAM/download/.opam-switch/build/foo.1
SYSTEM mkdir ${OPAMTMP}
Processing 1/1: [foo.1: rsync]
+ rsync "-rLptgoDvc" "--exclude" ".git" "--exclude" "_darcs" "--exclude" ".hg" "--exclude" ".#*" "--exclude" "_opam*" "--exclude" "_build" "--delete" "--delete-excluded" "${BASEDIR}/arch.tgz" "${OPAMTMP}"
Expand All @@ -197,8 +197,8 @@ SYSTEM copy ${OPAMTMP}/arch.tgz -> ${BASEDIR}/OPAM/down
SYSTEM mkdir ${OPAMTMP}
Processing 1/1: [foo.1: extract]
+ tar "xfz" "${OPAMTMP}/arch.tgz" "-C" "${OPAMTMP}"
SYSTEM copydir ${OPAMTMP}/REPO -> ${BASEDIR}/OPAM/download/.opam-switch/sources/foo.1
SYSTEM mkdir ${BASEDIR}/OPAM/download/.opam-switch/sources/foo.1
SYSTEM copydir ${OPAMTMP}/REPO -> ${BASEDIR}/OPAM/download/.opam-switch/build/foo.1
SYSTEM mkdir ${BASEDIR}/OPAM/download/.opam-switch/build/foo.1
SYSTEM rmdir ${OPAMTMP}
SYSTEM rmdir ${OPAMTMP}
Done.
Expand Down Expand Up @@ -265,7 +265,7 @@ The following actions will be performed:
- install baz 1

<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
SYSTEM rmdir ${BASEDIR}/OPAM/download/.opam-switch/sources/baz.1
SYSTEM rmdir ${BASEDIR}/OPAM/download/.opam-switch/build/baz.1
SYSTEM mkdir ${OPAMTMP}
Processing 1/1: [baz.1: http]
+ wget "--header=Accept: */*" "-t" "3" "-O" "${OPAMTMP}/v1.0.0.tar.gz.part" "-U" "opam/current" "--" "https://github.com/UnixJunkie/get_line/archive/v1.0.0.tar.gz"
Expand All @@ -275,8 +275,8 @@ SYSTEM copy ${OPAMTMP}/v1.0.0.tar.gz -> ${BASEDIR}/OPAM
SYSTEM mkdir ${OPAMTMP}
Processing 1/1: [baz.1: extract]
+ tar "xfz" "${OPAMTMP}/v1.0.0.tar.gz" "-C" "${OPAMTMP}"
SYSTEM copydir ${OPAMTMP}/get_line-1.0.0 -> ${BASEDIR}/OPAM/download/.opam-switch/sources/baz.1
SYSTEM mkdir ${BASEDIR}/OPAM/download/.opam-switch/sources/baz.1
SYSTEM copydir ${OPAMTMP}/get_line-1.0.0 -> ${BASEDIR}/OPAM/download/.opam-switch/build/baz.1
SYSTEM mkdir ${BASEDIR}/OPAM/download/.opam-switch/build/baz.1
SYSTEM rmdir ${OPAMTMP}
SYSTEM rmdir ${OPAMTMP}
Done.
Expand Down
5 changes: 0 additions & 5 deletions tests/reftests/sources-directory-cleaning.test
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ The following actions will be performed:
-> installed waste.1
Done.
### ls OPAM/sources-dir/.opam-switch/sources/
waste.1
### : at removal
### opam remove waste
The following actions will be performed:
Expand All @@ -71,7 +70,6 @@ The following actions will be performed:
-> installed waste.1
Done.
### ls OPAM/sources-dir/.opam-switch/sources
waste.1
### opam reinstall waste
The following actions will be performed:
=== recompile 1 package
Expand All @@ -83,7 +81,6 @@ The following actions will be performed:
-> installed waste.1
Done.
### ls OPAM/sources-dir/.opam-switch/sources
waste.1
### : at atomic reinstall
### opam remove waste
The following actions will be performed:
Expand Down Expand Up @@ -119,7 +116,6 @@ The following actions will be performed:
-> installed waste.1
Done.
### ls OPAM/sources-dir/.opam-switch/sources
waste.1
### opam remove waste
The following actions will be performed:
=== remove 1 package
Expand Down Expand Up @@ -156,7 +152,6 @@ The following actions will be performed:
-> installed waste.1
Done.
### ls OPAM/sources-dir/.opam-switch/sources
waste.1
### opam remove waste
The following actions will be performed:
=== remove 1 package
Expand Down
Loading