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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows-inspired tweaks to the UI #5883

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft

Conversation

dra27
Copy link
Member

@dra27 dra27 commented Mar 17, 2024

None of this is intended for direct merging - it's the result of some idle hacking while travelling at the moment.

There are four separable parts of this PR, which anyone should feel free to take and move to completion 馃檪

  • The display of command output (when -v) is specified is implemented on Unix using Unix.alarm and so was consequently disabled on Windows in Semi-synchronous verbose mode聽#1915. It's an irritating limitation when debugging the compiler in opam on Windows, though! The approach is to use a thread instead of sigalrm, but the implementation needs to be hardened (the XXX notes are things I didn't have in my frontal lobe and couldn't be bothered to lookup!)
  • Hidden in that first commit is also an actual bug fix. The code in Semi-synchronous verbose mode聽#1915 uses input_line until it reaches End_of_file, but the final line may not actually be complete. Regardless, opam then displays it on a complete. Even on Linux, this causes lines in configure scripts to get split. There's a hack in the commit to fix it by using seek_in, but it would be better to use proper input functions and do the job properly (but it's fiddly). I'm fairly sure the statement of correctness in a comment in the code is wrong.
  • Extracting tarballs with many files is slow on Windows... the next two commits were starts of an implementation to display an "extract" item at this point, which makes opam looks much less like it's crashed while it extracts either the compiler or Dune tarballs (I was amused when installing a package from npm earlier to note that it really ought to do the same thing.......)
  • Finally, packages are slower on Windows to build at the moment (especially the compiler) and the last commit provides a PoC for displaying spinners. The commit message has a few more notes. This needs massively tidying up - OpamProcess should acquire a more structured way of determining "progress" (which might allow, say, the download jobs to tick when content is received and the tarball extractions to tick when a file has been extracted) and the type for the status bar in OpamParallel should be made richer so that it can be much less hackily annotated the a spinner. Obviously the spinner itself needs to get through the usual mechanisms in OpamConsole for UTF-8 detection, but I was hacking all this in Windows Terminal, with full Unicode joy...

The verbose fixes are optional for 2.2.0, but both the extract and spinners I think are required for 2.2.0 because there are otherwise extremely long pauses on Windows which invite pressing CTRL+C.

This also contains a bug-fix for Linux as well with the handling of incomplete lines.
Starting point was adding a ?text parameter (which wasn't needed) but also tidying
a few bits and bobs.
Implementation is a waste of space, but PoCs two ideas:
- Don't display _anything_ about a job until it has been running
  for at least 2 seconds (idea is that tiny jobs don't keep churning
  the status indicator)
- After 5 seconds, display a spinner for jobs which updates if
  stdout/stderr has changed since the last refresh (a thread is used
  to poll for changes).
@dra27 dra27 added AREA: UI PR: WIP Not for merge at this stage labels Mar 17, 2024
@dra27 dra27 changed the title Windows-inspired tweaks the UI Windows-inspired tweaks the to UI Mar 17, 2024
@dra27 dra27 changed the title Windows-inspired tweaks the to UI Windows-inspired tweaks to the UI Mar 17, 2024
@dra27 dra27 added this to For RC in Opam 2.2.0 Mar 17, 2024
@dra27
Copy link
Member Author

dra27 commented Mar 17, 2024

It can be seen in action on Windows in:

opam4

@dra27 dra27 linked an issue Mar 28, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AREA: UI PR: WIP Not for merge at this stage
Projects
Opam 2.2.0
  
For RC
Development

Successfully merging this pull request may close these issues.

UI Improvements for Really Long Builds.
1 participant