build progress bar
Clemens Lang
cal at macports.org
Wed Feb 22 13:57:17 UTC 2017
Hi,
----- On 21 Feb, 2017, at 20:29, René J.V. Bertin rjvbertin at gmail.com wrote:
> I'm pretty sure they won't, but I think that incremental builds might be more
> common than you think among the users who are esp. interested in progress
> reporting.
There are two cases here, reporting that there is some progress (where lines
can still be used) and drawing a progress bar (where line count does not work
in incremental builds). Regardless, incremental builds are uncommon for our
users aside from "power users".
> The progress info provided by Ninja and CMake+Make works in those cases.
Sure, I'm not saying we shouldn't use the progress info provided by CMake or
Ninja, I'm saying we could also attempt to provide progress information where
we don't have Ninja or CMake.
> > We already run C code for every line of output produced by a port's
> > build system. Of course calling back into Tcl for each line isn't
> > possible, but keeping track of the last call and invoking a Tcl callback
> > every second, for example, is entirely possible.
>
> That's what I thought too initially, but as far as I've found the Pextlib/C
> version of ui_info and family do exactly that: they call the Tcl versions.
Well, the magic happens in
https://github.com/macports/macports-base/blob/master/src/pextlib1.0/system.c#L303
so it seems we do call to Tcl once for each line generated by a build system.
That's probably buffered, though, so those calls happens every few KB of
output.
This is also the place where progress reporting could be added.
> That's why my current barebones prototype that just prints "XX% done" works. Am
> I overlooking something? It does make sense, in the end.
Yes. Probably still not a good idea to put progress guessing into the
implementation of ui_info, though.
> My bad, macports.tcl has access to macports::ui_options. The blocker is that I
> need to call the start and finish methods from another file, and I haven't
> managed to access macports::ui_options from there.
Which file? Why do you need to call start and finish from different files? That
sounds like a problem waiting to happen if you do the progress setting from
macports.tcl but the start and finish from somewhere else.
--
Clemens Lang
More information about the macports-dev
mailing list