From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sahitihi Subject: Re: Fwd: Re: Patch file for colorize module Date: Wed, 13 Jun 2018 02:36:39 +0530 Message-ID: <2b03fcec-c2d8-0604-156c-70fe7643a6cb@swecha.net> References: <8ea5d026-fab9-7b12-198e-610ad7743cb2@swecha.net> <87602zbrcc.fsf@elephly.net> <328742c6-f96f-74b8-68ef-3b165a6199aa@swecha.net> <87zi0a3m3t.fsf@elephly.net> <07c93c07-2172-6bf1-6188-88830c1d8b4c@swecha.net> <87o9gpyq4t.fsf@elephly.net> <91773c8b-3072-2a82-dca3-cbeb5adf826d@swecha.net> <87fu1zznl3.fsf@elephly.net> <87bmcnzjsp.fsf@elephly.net> <18408eca-ad0b-111a-0ef6-ab452c9ca89c@swecha.net> <878t7ryxvf.fsf@elephly.net> <02e1a59a-ebc1-dfce-e1d6-22e97e742214@swecha.net> <874lifypeb.fsf@elephly.net> <648f81fc-0607-2c3b-f9a3-ca3b29cd637b@swecha.net> <87bmck22uz.fsf@elephly.net> <8736xv1xvq.fsf@elephly.net> <64dfaf0c-3bcf-7b76-5831-b1c41d3f5563@swecha.net> <877en4ccut.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------1CE362BA2C1E2ACB73751DB7" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57105) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fSqVp-0005Z7-4c for guix-devel@gnu.org; Tue, 12 Jun 2018 17:07:34 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fSqVl-0006LB-5H for guix-devel@gnu.org; Tue, 12 Jun 2018 17:07:33 -0400 In-Reply-To: <877en4ccut.fsf@elephly.net> Content-Language: en-US List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Ricardo Wurmus Cc: guix-devel This is a multi-part message in MIME format. --------------1CE362BA2C1E2ACB73751DB7 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ricardo, > I cannot seem to apply the patch onto either the =E2=80=9Cwip-sahithi=E2= =80=9D or > =E2=80=9Cmaster=E2=80=9D branches. Could you rebase your changes on to= p of the > =E2=80=9Cwip-sahithi=E2=80=9D branch, please? If that turns out to be = too difficult, > please rebase the changes on top of the current =E2=80=9Cmaster=E2=80=9D= 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. --------------1CE362BA2C1E2ACB73751DB7 Content-Type: text/x-patch; name="0001-guix-Add-coloring-soft-port.patch" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="0001-guix-Add-coloring-soft-port.patch" =46rom a7bd2a2b9740d2e5134588d396672afbee33eb6a Mon Sep 17 00:00:00 2001 From: Sahithi Yarlagadda 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) =20 - (parameterize ((current-build-output-port (if quiet? - (%make-void-port "= w") - (current-error-por= t)))) + (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)) =20 ;;; Commentary: ;;; @@ -1631,4 +1631,43 @@ be reset such that subsequent output will not have= any colors in effect." str (color 'RESET))) =20 +(define (handle-string str) + (let ((message (or (and=3D> (string-match "^(starting phase)(.*)" s= tr) + (lambda (m) + (string-append + (colorize-string (match:substring m 1) 'BLUE) + (colorize-string (match:substring m 2) 'GREEN)))) + + (and=3D> (string-match "^(phase) (.*) (succeeded after) (.*) (sec= onds)" 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=3D> (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=E2=80=99t 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 --=20 2.11.0 --------------1CE362BA2C1E2ACB73751DB7--