Show the run log's last lines under Details, live
The percentage says an update is alive. It does not say what it is alive doing, and for the longest stretch of a run there was no way to find out: an AUR package compiling for a quarter of an hour talks constantly, and every word of it went into a file nobody was looking at. So the run log's last five lines now travel with the progress entry and sit under Details, refreshed every two seconds for as long as the update lasts. Polled rather than followed, for the same reason the pacman watcher polls: only the last few lines are ever displayed, so every line in between would be work nobody sees, and re-reading the tail whole makes truncation and rotation of the log a non-event. The job model behind this interface carries exactly two description fields - descriptionValue1 and 2, there is no third - so one stays with the package being worked on and the other takes the tail. Newlines inside a field do render, which is what lets five lines share one of them. They travel tab separated because the protocol is one instruction per line, and a tab inside a log line becomes a space first: either renders as whitespace, but a line split in half renders as nonsense. Five lines clipped to 120 columns also keeps an instruction well inside PIPE_BUF, which is what makes the write atomic against the runner sending its own progress down the same pipe.
This commit is contained in:
1 parent
f9cd8a0ace
commit
c8666da714
7 files changed
+118
-2
No files matched your search
@@ -8,6 +8,7 @@
|
||||
#
|
||||
# info<TAB>text headline, already translated by the caller
|
||||
# detail<TAB>name<TAB>value a labelled line under "Details"
|
||||
# log<TAB>name<TAB>line<TAB>line... the run log's last lines, one per field
|
||||
# total<TAB>n how many items this step has
|
||||
# done<TAB>n how many of them are finished
|
||||
# percent<TAB>n overall progress, 0-100
|
||||
@@ -113,6 +114,16 @@ def main():
|
||||
elif cmd == "detail" and len(fields) > 2:
|
||||
job.call("setDescriptionField",
|
||||
GLib.Variant("(uss)", (0, arg, fields[2])))
|
||||
elif cmd == "log" and len(fields) > 2:
|
||||
# Field 1, and there is no field 2: the job model behind this
|
||||
# interface carries exactly two, and anything further is
|
||||
# discarded without complaint at the other end.
|
||||
#
|
||||
# The tail arrives one line per field, because the protocol
|
||||
# itself is one instruction per line. Joined back up with the
|
||||
# newlines the job view does render.
|
||||
job.call("setDescriptionField",
|
||||
GLib.Variant("(uss)", (1, arg, "\n".join(fields[2:]))))
|
||||
elif cmd == "total":
|
||||
job.call("setTotalAmount", GLib.Variant("(ts)", (int(arg), unit)))
|
||||
elif cmd == "done":
|
||||
|
||||
Reference in new issue
Block a user