Hi Ricardo, Please find my changes in the patch file attached.
> (Generally, you really shouldn’t be developing things as > “root”.) > This time I din't do it as root. > For this commit a message like this would be appropriate: Added a appropriate commit message. > Please always add a so-called docstring for all defined procedures. Please bear me for this time. I din't add this yet. > You have probably noticed that this looks rather repetitive at this > point. Maybe we can think of a better way to express what colours > should be applied. The match group numbers are monotonically > increasing, so maybe we can avoid repeated statements of this kind and > simply iterate over a list of colours… I have an idea already; how > about you? :) I have an idea about making a using filter-string and lists. Not sure about functionality but that seems fine. :-P > Another thing that’s worth thinking about now is the next step: > how can we *optionally* hide all lines between these build system > notices about started and completed build phases? I din't think of it yet. Will do it in mean process. > One more thing: the fact that handle-string didn’t do the right thing > indicates that you didn’t test the changes well enough. To test them, > please locally modify “guix/scripts/build.scm” and/or > “guix/scripts/package.scm” to make it use your colourful port instead of > the default, as discussed on IRC and in previous emails. I made changes to /guix/scripts/build.scm /but that din/t workout. That resulted me colourless outputs as before. :-( Thanks! Sahithi
From ee2ccccf26b05093cc3227a37b96196ec3a29182 Mon Sep 17 00:00:00 2001 From: Sahithi Yarlagadda <s...@swecha.net> Date: Thu, 7 Jun 2018 00:07:34 +0530 Subject: [PATCH 2/2] guix: Add coloring soft port. * guix/ui.scm (handle-string): New procedures. (colorful-build-output-port): New variable. --- guix/ui.scm | 41 ++++++++++++++++++++--------------------- 1 file changed, 20 insertions(+), 21 deletions(-) mode change 100644 => 100755 guix/ui.scm diff --git a/guix/ui.scm b/guix/ui.scm old mode 100644 new mode 100755 index 3a36daadc..51a1c4a46 --- a/guix/ui.scm +++ b/guix/ui.scm @@ -109,8 +109,7 @@ warning info guix-main - colorize-string - guix-colorful-port)) + colorful-build-output-port)) ;;; Commentary: ;;; @@ -1632,43 +1631,43 @@ be reset such that subsequent output will not have any colors in effect." str (color 'RESET))) -(define target-port (current-output-port)) (define (handle-string str) (or (and=> (string-match "^(starting phase)(.*)" str) (lambda (m) (string-append - (colorized-display (match:substring m 1) '(BLUE)) - (colorized-display (match:substring m 2) '(GREEN))))) + (colorize-string (match:substring m 1) '(BLUE)) + (colorize-string (match:substring m 2) '(GREEN))))) - (and=> (string-match "^(phase)(.*) (succeeded)(.*)" str) + (and=> (string-match "^(phase) (.*) (succeeded after) (.*) (seconds)" str) (lambda (m) (string-append - (colorized-display (match:substring m 1) '(BLUE)) - (colorized-display (match:substring m 2) '(GREEN)) - (colorized-display (match:substring m 3) '(BLUE)) - (colorized-display (match:substring m 4) '(GREEN))))) + (colorize-string (match:substring m 1) '(BLUE)) + (colorize-string (match:substring m 2) '(GREEN)) + (colorize-string (match:substring m 3) '(BLUE)) + (colorize-string (match:substring m 4) '(GREEN)) + (colorize-string (match:substring m 5) '(BLUE))))) - (and=> (string-match "^(phase)(.*) (failed)(.*)" str) + (and=> (string-match "^(phase)(.*) (failed after) (.*) (seconds)" str) (lambda (m) (string-append - (colorized-display (match:substring m 1) '(BLUE)) - (colorized-display (match:substring m 2) '(GREEN)) - (colorized-display (match:substring m 3) '(BLUE)) - (colorized-display (match:substring m 4) '(GREEN))))) + (colorize-string (match:substring m 1) '(RED)) + (colorize-string (match:substring m 2) '(GREEN)) + (colorize-string (match:substring m 3) '(RED)) + (colorize-string (match:substring m 4) '(GREEN)) + (colorize-string (match:substring m 5) '(RED))))) ;; Didnât match, so return unmodified string. - str) - (display str target-port)) + (display str current-error-port))) -(define guix-colorful-port +(define colorful-build-output-port (make-soft-port (vector - (lambda (c) (write c target-port)) + (lambda (c) (write c current-error-port)) handle-string - (lambda () (display "." target-port)) + (lambda () (display "." current-error-port)) (lambda () (char-upcase (read-char))) - (lambda () (display "@" target-port))) + (lambda () (display "@" current-error-port))) "rw")) ;;; ui.scm ends here -- 2.11.0