Skip to content

Commit

Permalink
Hack: Displaying extractions in the status bar
Browse files Browse the repository at this point in the history
  • Loading branch information
dra27 committed Jun 9, 2024
1 parent f3c0b69 commit 67af380
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 5 deletions.
1 change: 1 addition & 0 deletions master_changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ users)

## Update / Upgrade
* [BUG] Stop triggering "Undefined filter variable variable" warning for `?variable` [#5983 @dra27]
* Display extractions in the status bar [#5977 @dra27]

## 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
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

0 comments on commit 67af380

Please sign in to comment.