Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display a note when reloading a repository #5977

Merged
merged 3 commits into from
Jun 10, 2024
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 @@ -54,6 +54,8 @@ users)

## Update / Upgrade
* [BUG] Stop triggering "Undefined filter variable variable" warning for `?variable` [#5983 @dra27]
* Display extractions in the status bar [#5977 @dra27]
* Display a note when reloading a repository [#5977 @kit-ty-kate]

## Tree
* [BUG] Fix `opam tree --with-*` assigning the `with-*` variables to unrequested packages [#5919 @kit-ty-kate @rjbou - fix #5755]
Expand Down
15 changes: 14 additions & 1 deletion src/repository/opamRepository.ml
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,11 @@ let pull_tree_t
| Some e -> Done (Not_available (None, Printexc.to_string e))
in
match dirnames with
| [ _label, local_dirname, _subpath ] ->
| [ label, local_dirname, _subpath ] ->
(fun archive msg ->
OpamFilename.cleandir local_dirname;
let text = OpamProcess.make_command_text label "extract" in
OpamProcess.Job.with_text text @@
OpamFilename.extract_job archive local_dirname
@@+ fallback (fun () -> Done (Up_to_date msg)))
| _ ->
Expand All @@ -285,6 +287,17 @@ let pull_tree_t
(Some label, OpamProcess.result_summary r))))
dirnames
in
let text =
let label =
match dirnames with
| [(label1, _, _); (label2, _, _)] ->
label1 ^ ", " ^ label2
| (label, _, _)::rest ->
Printf.sprintf "%s + %d others" label (List.length rest)
| [] -> assert false in
OpamProcess.make_command_text label "extract"
in
OpamProcess.Job.with_text text @@
OpamFilename.extract_job archive tmpdir
@@+ fallback (fun () ->
let failing =
Expand Down
7 changes: 6 additions & 1 deletion src/state/opamRepositoryState.ml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ module Cache = struct
end

let load_opams_from_dir repo_name repo_root =
if OpamConsole.disp_status_line () || OpamConsole.verbose () then
OpamConsole.status_line "Processing: [%s: loading data]"
(OpamConsole.colorise `blue (OpamRepositoryName.to_string repo_name));
(* FIXME: why is this different from OpamPackage.list ? *)
let rec aux r dir =
if OpamFilename.exists_dir dir then
Expand All @@ -104,7 +107,9 @@ let load_opams_from_dir repo_name repo_root =
r fnames
else r
in
aux OpamPackage.Map.empty (OpamRepositoryPath.packages_dir repo_root)
Fun.protect
(fun () -> aux OpamPackage.Map.empty (OpamRepositoryPath.packages_dir repo_root))
~finally:OpamConsole.clear_status

let load_repo repo repo_root =
let t = OpamConsole.timer () in
Expand Down
8 changes: 4 additions & 4 deletions tests/reftests/download.test
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The following actions will be performed:
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing 1/1: [foo.1: http]
curl-or-wget -- "https://github.com/UnixJunkie/get_line/archive/v1.0.0.tar.gz"
Processing 1/1:
Processing 1/1: [foo.1: extract]
+ tar "xfz" "${OPAMTMP}/v1.0.0.tar.gz" "-C" "${OPAMTMP}"
Done.
### opam clean -c
Expand All @@ -34,7 +34,7 @@ The following actions will be performed:
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing 1/1: [foo.1: http]
+ wget "--content-disposition" "-t" "3" "-O" "${BASEDIR}/OPAM/download/.opam-switch/sources/foo.1/v1.0.0.tar.gz.part" "-U" "opam/current" "--" "https://github.com/UnixJunkie/get_line/archive/v1.0.0.tar.gz"
Processing 1/1:
Processing 1/1: [foo.1: extract]
+ tar "xfz" "${OPAMTMP}/v1.0.0.tar.gz" "-C" "${OPAMTMP}"
Done.
### opam clean -c
Expand All @@ -49,7 +49,7 @@ The following actions will be performed:
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing 1/1: [foo.1: http]
+ curl "--write-out" "%{http_code}\n" "--retry" "3" "--retry-delay" "2" "--user-agent" "opam/current" "-L" "-o" "${BASEDIR}/OPAM/download/.opam-switch/sources/foo.1/v1.0.0.tar.gz.part" "--" "https://github.com/UnixJunkie/get_line/archive/v1.0.0.tar.gz"
Processing 1/1:
Processing 1/1: [foo.1: extract]
+ tar "xfz" "${OPAMTMP}/v1.0.0.tar.gz" "-C" "${OPAMTMP}"
Done.
### opam clean -c
Expand Down Expand Up @@ -148,7 +148,7 @@ The following actions will be performed:
<><> Processing actions <><><><><><><><><><><><><><><><><><><><><><><><><><><><>
Processing 1/1: [foo.1: http]
+ wget "--content-disposition" "-t" "3" "-O" "${BASEDIR}/OPAM/download/.opam-switch/sources/foo.1/v1.0.0.tar.gz.part" "-U" "opam/current" "--" "https://github.com/UnixJunkie/get_line/archive/v1.0.0.tar.gz"
Processing 1/1:
Processing 1/1: [foo.1: extract]
+ tar "xfz" "${OPAMTMP}/v1.0.0.tar.gz" "-C" "${OPAMTMP}"
Done.
### opam clean -c
Expand Down
18 changes: 18 additions & 0 deletions tests/reftests/dune.inc
Original file line number Diff line number Diff line change
Expand Up @@ -1415,6 +1415,24 @@
%{targets}
(run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:update-upgrade.test} %{read-lines:testing-env}))))

(rule
(alias reftest-update)
(action
(diff update.test update.out)))

(alias
(name reftest)
(deps (alias reftest-update)))

(rule
(targets update.out)
(deps root-N0REP0)
(package opam)
(action
(with-stdout-to
%{targets}
(run ./run.exe %{exe:../../src/client/opamMain.exe.exe} %{dep:update.test} %{read-lines:testing-env}))))

(rule
(alias reftest-upgrade-format)
(action
Expand Down
10 changes: 10 additions & 0 deletions tests/reftests/update.test
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
N0REP0
### <REPO/packages/pkg/pkg.1/opam>
opam-version: "2.0"
### opam update --verbose

<><> Updating package repositories ><><><><><><><><><><><><><><><><><><><><><><>
Processing 1/1: [default: rsync]
[default] synchronised from file://${BASEDIR}/REPO
Processing: [default: loading data]
Now run 'opam upgrade' to apply any package updates.
Loading