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

Give the user some control over progressbar invasiveness #348

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

RJVB
Copy link
Contributor

@RJVB RJVB commented Aug 17, 2024

Progress reporting is useful but also has its drawbacks, like writing to the calling terminal when it's not in the appropriate state, or slowing down the process being reported on. This commit addresses both situations:

  1. a set of 3 configuration variables is introduced with which the user can control (via macports.conf) after how long the progressbar should appear, if it should also show indeterminate progress (aka "we're busy") and what operations should report progress in addition to the traditional ones (fetch, build, destroot). The defaults for these are the current hardwired settings. The "also_for" setting is designed to be a list that currently only accepts "de/activation" for the recent progress reporting added to port activate and port deactivate. (Which causes a significant increase in duration of those operations.)
    NB: I didn't think it necessary to design separate entries for activation and deactivation, but it annoys me a bit that now I have to do the same check in 2 locations.

  2. a Pextlib function is introduced to determine whether port runs as a foreground process connected to a terminal. This function is called to check the current state before doing any actual progressbar output. It thus becomes possible to push a long-running operation (say, a build) to the background and do other work in the same terminal, without getting frequent terminal and most likely illegible output.

Progress reporting is useful but also has its drawbacks, like writing
to the calling terminal when it's not in the appropriate state, or
slowing down the process being reported on. This commit addresses both
situations:

1. a set of 3 configuration variables is introduced with which the user
can control (via macports.conf) after how long the progressbar should
appear, if it should also show indeterminate progress (aka "we're busy")
and what operations should report progress in addition to the traditional
ones (fetch, build, destroot). The defaults for these are the current
hardwired settings. The "also_for" setting is designed to be a list that
currently only accepts "de/activation" for the recent progress reporting
added to `port activate` and `port deactivate`. (Which causes a significant
increase in duration of those operations.)

2. a Pextlib function is introduced to determine whether `port` runs as a
foreground process connected to a terminal. This function is called to
check the current state before doing any actual progressbar output. It
thus becomes possible to push a long-running operation (say, a build) to
the background and do other work in the same terminal, without getting
frequent terminal and most likely illegible output.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant