Hi Ricardo,

> I cannot seem to apply the patch onto either the “wip-sahithi” or
> “master” branches.  Could you rebase your changes on top of the
> “wip-sahithi” branch, please?  If that turns out to be too difficult,
> please rebase the changes on top of the current “master” branch after
> updating your clone of the git repository.

I have rebased the changes on "wip-sahithi" branch and sending the patch
file. I assume i cant rebase to "master" branch as the newly created
branch will have merge conflict with regard to ui.scm which is ahead of
master branch.

---
Thanks!!

Sahithi.
From a7bd2a2b9740d2e5134588d396672afbee33eb6a Mon Sep 17 00:00:00 2001
From: Sahithi Yarlagadda <s...@swecha.net>
Date: Wed, 13 Jun 2018 02:08:27 +0530
Subject: [PATCH] guix: Add coloring soft port.

* guix/ui.scm (handle-string): New procedures.
(colorful-build-output-port): New variable.

guix: Added colorful-build-output-port to build.scm instead of default
---
 guix/scripts/build.scm |  4 +---
 guix/ui.scm            | 41 ++++++++++++++++++++++++++++++++++++++++-
 2 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm
index 4dd4fbccd..f6924874d 100644
--- a/guix/scripts/build.scm
+++ b/guix/scripts/build.scm
@@ -733,9 +733,7 @@ needed."
         ;; Set the build options before we do anything else.
         (set-build-options-from-command-line store opts)
 
-        (parameterize ((current-build-output-port (if quiet?
-                                                      (%make-void-port "w")
-                                                      (current-error-port))))
+       (parameterize ((current-build-output-port  colorful-build-output-port))
           (let* ((mode  (assoc-ref opts 'build-mode))
                  (drv   (options->derivations store opts))
                  (urls  (map (cut string-append <> "/log")
diff --git a/guix/ui.scm b/guix/ui.scm
index 80f1a4d77..840ad82e8 100644
--- a/guix/ui.scm
+++ b/guix/ui.scm
@@ -109,7 +109,7 @@
             warning
             info
             guix-main
-            colorize-string))
+            colorful-build-output-port))
 
 ;;; Commentary:
 ;;;
@@ -1631,4 +1631,43 @@ be reset such that subsequent output will not have any colors in effect."
    str
    (color 'RESET)))
 
+(define (handle-string str)
+    (let ((message  (or (and=> (string-match "^(starting phase)(.*)" str)
+           (lambda (m)
+             (string-append
+               (colorize-string (match:substring m 1) 'BLUE)
+               (colorize-string (match:substring m 2) 'GREEN))))
+
+       (and=> (string-match "^(phase) (.*) (succeeded after) (.*) (seconds)" str)
+          (lambda (m)
+            (string-append
+              (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 after) (.*) (seconds)" str)
+          (lambda (m)
+            (string-append
+              (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 message (current-error-port))))
+
+(define colorful-build-output-port
+  (make-soft-port
+   (vector
+    (lambda (c) (write c (current-error-port)))
+    handle-string
+    (lambda () (display "." (current-error-port)))
+    (lambda () (char-upcase (read-char)))
+    (lambda () (display "@" (current-error-port))))
+   "rw"))
+
 ;;; ui.scm ends here
-- 
2.11.0

Reply via email to