From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sahitihi Subject: Re: Next steps Date: Sat, 16 Jun 2018 20:25:49 +0530 Message-ID: References: <8ea5d026-fab9-7b12-198e-610ad7743cb2@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> <2b03fcec-c2d8-0604-156c-70fe7643a6cb@swecha.net> <87zhzzbqn6.fsf@elephly.net> <8f509759-c798-a150-bf5a-9b13cd07ac5b@swecha.net> <87lgbibir5.fsf@elephly.net> <564233bd-9511-7f84-3350-6a3a905534a8@swecha.net> <87r2l767sg.fsf@elephly.net> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------8F28D56239A11AAEC68CE292" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:57161) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1fUCcS-0005YD-U3 for guix-devel@gnu.org; Sat, 16 Jun 2018 10:56:02 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1fUCcP-0006iH-Qg for guix-devel@gnu.org; Sat, 16 Jun 2018 10:56:00 -0400 In-Reply-To: <87r2l767sg.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. --------------8F28D56239A11AAEC68CE292 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Hi Ricardo, Patch file is attached with the following changes. > Excellent, this looks better. Unfortunately, your patch includes a > couple of unrelated indentation changes. Please remove those. > > 2) Fixing the other soft port procedures As described I will proceed on with next steps and will make ensure to complete it in-time. ---- Thanks!! Sahithi --------------8F28D56239A11AAEC68CE292 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 99526f5624633e5fdc72fe8fb280b1279bea0636 Mon Sep 17 00:00:00 2001 From: Sahithi Yarlagadda Date: Sat, 16 Jun 2018 13:21:42 +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 | 49 ++++++++++++++++++++++++++++++++++++++++++++= ++++- 2 files changed, 49 insertions(+), 4 deletions(-) diff --git a/guix/scripts/build.scm b/guix/scripts/build.scm index 4dd4fbccd..81ad255d8 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-outpu= t-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..88e5fa6b7 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,51 @@ be reset such that subsequent output will not have= any colors in effect." str (color 'RESET))) =20 +(define (handle-string str) + "Accepts input string(str) as argument and checks whether it matches wi= th one=20 +of the regular expressions specified. Upon matching, each substring is c= olorized=20 +with corresponding colors and the modified colored string is returned. I= f the=20 +input string fails match with the following conditionals it returns back= the=20 +unmodified input string." + (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)(.*)(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=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 with any expression, returns back unmodifie= d string. + str))) + (display message (current-error-port)))) + +(define colorful-build-output-port + (make-soft-port + (vector + ;; procedure accepting one character for output + (lambda (c) (write c (current-error-port))) + ;; procedure accepting a string for handle-string procedure + handle-string + (lambda () (force-output (current-error-port))) + (const #t) + (lambda () (display "@" (current-error-port)))) + "rw")) + + ;;; ui.scm ends here --=20 2.11.0 --------------8F28D56239A11AAEC68CE292--