From nobody Fri Apr 19 11:15:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568015398; cv=none; d=zoho.com; s=zohoarc; b=VKSqKrRdCahsp7+xMzkhiePyT7pP+cU3Qxg0zOGWB+kQcGo4YUlNwTKVLuH9z8spIf7JTq4QSMwJ1/x0mn19+wEAPVnHiNndkAX1koXodAY/SftuXxzJcX25mHuOYVYrsEITLj5wU0NCL+gat5Pnw/c+SlIIF0yyiBCz7r+ucmg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568015398; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=wsrxwMM+w0+3+8iSsMDuB5+bAf1XZiccm/qqGAi/tQ8=; b=OKOZbsRWEMqi6q9sZhiZT6cRzURwbXcV0LSPbmsAurbLbkjWRakdtG72n3Yt3TdYZ1+ot4hCRnSE41XS4ZQbFRirvyOEyglZVxcnC6tKIo+2xvtG2Yb1HcrK9ctB06etnmv5ZQQqllNKdC393UtAwBUCq5kllRYqHMCTaUS+iXA= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1568015398401300.54475880124266; Mon, 9 Sep 2019 00:49:58 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3E74B300BC7E; Mon, 9 Sep 2019 07:49:56 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 38F335D6A7; Mon, 9 Sep 2019 07:49:54 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 8D7C04A486; Mon, 9 Sep 2019 07:49:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x897nljp004843 for ; Mon, 9 Sep 2019 03:49:47 -0400 Received: by smtp.corp.redhat.com (Postfix) id A861E5D6B7; Mon, 9 Sep 2019 07:49:47 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 32E5A5D6A7 for ; Mon, 9 Sep 2019 07:49:47 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 9 Sep 2019 09:49:39 +0200 Message-Id: <4710592f0158dbbbe6a24be39e43faa6b4264e4e.1568015323.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/4] configure: Prefer LIBVIRT_RESULT over AC_MSG_NOTICE X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); Mon, 09 Sep 2019 07:49:56 +0000 (UTC) Content-Type: text/plain; charset="utf-8" One of the advantages is that LIBVIRT_RESULT aligns the resulting message for us. The other is that in near future we will colour some parts of the message and thus it helps if we get arguments split in two. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- configure.ac | 8 ++++---- m4/virt-chrdev-lock-files.m4 | 2 +- m4/virt-debug.m4 | 2 +- m4/virt-default-editor.m4 | 2 +- m4/virt-dtrace.m4 | 2 +- m4/virt-host-validate.m4 | 2 +- m4/virt-init-script.m4 | 2 +- m4/virt-loader-nvram.m4 | 2 +- m4/virt-login-shell.m4 | 2 +- m4/virt-numad.m4 | 2 +- 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/configure.ac b/configure.ac index bf9e7681bc..a8f8b0517e 100644 --- a/configure.ac +++ b/configure.ac @@ -1047,14 +1047,14 @@ LIBVIRT_WIN_RESULT_WINDRES AC_MSG_NOTICE([]) AC_MSG_NOTICE([Test suite]) AC_MSG_NOTICE([]) -AC_MSG_NOTICE([ Coverage: $enable_test_coverage]) -AC_MSG_NOTICE([ Alloc OOM: $enable_test_oom]) +LIBVIRT_RESULT([Coverage], [$enable_test_coverage]) +LIBVIRT_RESULT([Alloc OOM], [$enable_test_oom]) AC_MSG_NOTICE([]) AC_MSG_NOTICE([Miscellaneous]) AC_MSG_NOTICE([]) LIBVIRT_RESULT_DEBUG -AC_MSG_NOTICE([ Use -Werror: $enable_werror]) -AC_MSG_NOTICE([ Warning Flags: $WARN_CFLAGS]) +LIBVIRT_RESULT([Use -Werror], [$enable_werror]) +LIBVIRT_RESULT([Warning Flags], [$WARN_CFLAGS]) LIBVIRT_RESULT_DTRACE LIBVIRT_RESULT_NUMAD LIBVIRT_RESULT_INIT_SCRIPT diff --git a/m4/virt-chrdev-lock-files.m4 b/m4/virt-chrdev-lock-files.m4 index 7d85c0e21b..5802136b9f 100644 --- a/m4/virt-chrdev-lock-files.m4 +++ b/m4/virt-chrdev-lock-files.m4 @@ -48,5 +48,5 @@ AC_DEFUN([LIBVIRT_CHECK_CHRDEV_LOCK_FILES], [ ]) =20 AC_DEFUN([LIBVIRT_RESULT_CHRDEV_LOCK_FILES], [ - AC_MSG_NOTICE([ Char device locks: $with_chrdev_lock_files]) + LIBVIRT_RESULT([Char device locks], [$with_chrdev_lock_files]) ]) diff --git a/m4/virt-debug.m4 b/m4/virt-debug.m4 index d03cf10255..d3ac0564f2 100644 --- a/m4/virt-debug.m4 +++ b/m4/virt-debug.m4 @@ -29,5 +29,5 @@ AC_DEFUN([LIBVIRT_CHECK_DEBUG], [ ]) =20 AC_DEFUN([LIBVIRT_RESULT_DEBUG], [ - AC_MSG_NOTICE([ Debug: $enable_debug]) + LIBVIRT_RESULT([Debug], [$enable_debug]) ]) diff --git a/m4/virt-default-editor.m4 b/m4/virt-default-editor.m4 index 0c8e1e0798..4b4cad4e87 100644 --- a/m4/virt-default-editor.m4 +++ b/m4/virt-default-editor.m4 @@ -28,5 +28,5 @@ AC_DEFUN([LIBVIRT_CHECK_DEFAULT_EDITOR], [ ]) =20 AC_DEFUN([LIBVIRT_RESULT_DEFAULT_EDITOR], [ - AC_MSG_NOTICE([ Default Editor: $with_default_editor]) + LIBVIRT_RESULT([Default Editor], [$with_default_editor]) ]) diff --git a/m4/virt-dtrace.m4 b/m4/virt-dtrace.m4 index e072b639cd..3dc20d5343 100644 --- a/m4/virt-dtrace.m4 +++ b/m4/virt-dtrace.m4 @@ -41,5 +41,5 @@ AC_DEFUN([LIBVIRT_CHECK_DTRACE], [ ]) =20 AC_DEFUN([LIBVIRT_RESULT_DTRACE], [ - AC_MSG_NOTICE([ DTrace: $with_dtrace]) + LIBVIRT_RESULT([DTrace], [$with_dtrace]) ]) diff --git a/m4/virt-host-validate.m4 b/m4/virt-host-validate.m4 index 643cd8f06e..e43cec5366 100644 --- a/m4/virt-host-validate.m4 +++ b/m4/virt-host-validate.m4 @@ -39,5 +39,5 @@ AC_DEFUN([LIBVIRT_CHECK_HOST_VALIDATE], [ ]) =20 AC_DEFUN([LIBVIRT_RESULT_HOST_VALIDATE], [ - AC_MSG_NOTICE([virt-host-validate: $with_host_validate]) + LIBVIRT_RESULT([virt-host-validate], [$with_host_validate]) ]) diff --git a/m4/virt-init-script.m4 b/m4/virt-init-script.m4 index 91bbd68235..6eb81f0429 100644 --- a/m4/virt-init-script.m4 +++ b/m4/virt-init-script.m4 @@ -51,5 +51,5 @@ AC_DEFUN([LIBVIRT_CHECK_INIT_SCRIPT],[ ]) =20 AC_DEFUN([LIBVIRT_RESULT_INIT_SCRIPT],[ - AC_MSG_NOTICE([ Init script: $with_init_script]) + LIBVIRT_RESULT([Init script], [$with_init_script]) ]) diff --git a/m4/virt-loader-nvram.m4 b/m4/virt-loader-nvram.m4 index 0eb77fa923..d7e0c8ca18 100644 --- a/m4/virt-loader-nvram.m4 +++ b/m4/virt-loader-nvram.m4 @@ -37,5 +37,5 @@ AC_DEFUN([LIBVIRT_CHECK_LOADER_NVRAM], [ ]) =20 AC_DEFUN([LIBVIRT_RESULT_LOADER_NVRAM], [ - AC_MSG_NOTICE([ Loader/NVRAM: $with_loader_nvram]) + LIBVIRT_RESULT([Loader/NVRAM], [$with_loader_nvram]) ]) diff --git a/m4/virt-login-shell.m4 b/m4/virt-login-shell.m4 index 3baec5432f..713c488599 100644 --- a/m4/virt-login-shell.m4 +++ b/m4/virt-login-shell.m4 @@ -39,5 +39,5 @@ AC_DEFUN([LIBVIRT_CHECK_LOGIN_SHELL], [ ]) =20 AC_DEFUN([LIBVIRT_RESULT_LOGIN_SHELL], [ - AC_MSG_NOTICE([ virt-login-shell: $with_login_shell]) + LIBVIRT_RESULT([virt-login-shell], [$with_login_shell]) ]) diff --git a/m4/virt-numad.m4 b/m4/virt-numad.m4 index e760dcc579..378eba3c97 100644 --- a/m4/virt-numad.m4 +++ b/m4/virt-numad.m4 @@ -54,5 +54,5 @@ AC_DEFUN([LIBVIRT_CHECK_NUMAD], [ ]) =20 AC_DEFUN([LIBVIRT_RESULT_NUMAD], [ - AC_MSG_NOTICE([ numad: $with_numad]) + LIBVIRT_RESULT([numad], [$with_numad]) ]) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 11:15:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568015421; cv=none; d=zoho.com; s=zohoarc; b=KNct0p1pPMXEBIlBQ/YYUafeAAzvVWBA0ow3yp2TS6HWeV4DQJV3Cgk5JZPFKbNNRDEqNXmzoacdkI6m+uehJ0Brj+nKU2vx46gV8nECgAn/2yzGQ9c0c8OaoZCtdQd+bsehFNG2/8B6BB0eW/R9nir5/eLzrhsVqIzBEx4Hszs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568015421; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=T2y2MxMvAOUsMTD25+SxcwYjd/uCJkyZCiPcEJ0yBU8=; b=MAp/Wi26EeMb8N7+oM1iZFL4WD013oPGWZcH2IA+IV4Y8yPG/u7IHsMucOxVnptHqntB2tsLaK97jg0CzyUF3WU2uDbL9ehE5zJoFgGUwO7lz1M3Oz46rpGiSD1FI/dBDcNSp1PyAyZvxWp8vgrBNqHAygoZ7TqMffqCp/XXRKY= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1568015421849792.8568257954059; Mon, 9 Sep 2019 00:50:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E545F10A814B; Mon, 9 Sep 2019 07:50:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id BC0DC600C1; Mon, 9 Sep 2019 07:50:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 7C882C594; Mon, 9 Sep 2019 07:50:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x897nmjF004851 for ; Mon, 9 Sep 2019 03:49:48 -0400 Received: by smtp.corp.redhat.com (Postfix) id 780A35D6B7; Mon, 9 Sep 2019 07:49:48 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 011515D6A7 for ; Mon, 9 Sep 2019 07:49:47 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 9 Sep 2019 09:49:40 +0200 Message-Id: <516ef555771a0eb450bfc23008b2b6a27c9f22da.1568015323.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/4] virt-result.m4: Align string more generously X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.64]); Mon, 09 Sep 2019 07:50:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The times, when we had small CRTs are long gone. Now, in the era of wide screens we can be more generous when it comes to aligning the output of configure. The longest string before the colon is 'wireshark_dissector' which counts 19 characters. Therefore, align the strings at 20. At the same time, drop the useless result alignment. It behaves oddly - it puts a space at the end of each "no" because of the %-3s format we use. Signed-off-by: Michal Privoznik Reviewed-by: Cole Robinson Reviewed-by: Daniel P. Berrang=C3=A9 --- m4/virt-result.m4 | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/m4/virt-result.m4 b/m4/virt-result.m4 index cc622fe35b..36973ba0b5 100644 --- a/m4/virt-result.m4 +++ b/m4/virt-result.m4 @@ -33,9 +33,9 @@ dnl LIBVIRT_RESULT([yajl], [yes], [-I/opt/yajl/include -= lyajl]) dnl AC_DEFUN([LIBVIRT_RESULT], [ if test "$2" =3D "no" || test -z "$3" ; then - STR=3D`printf "%10s: %-3s" "$1" "$2"` + STR=3D`printf "%20s: %s" "$1" "$2"` else - STR=3D`printf "%10s: %-3s (%s)" "$1" "$2" "$3"` + STR=3D`printf "%20s: %s (%s)" "$1" "$2" "$3"` fi =20 AC_MSG_NOTICE([$STR]) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 11:15:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568015421; cv=none; d=zoho.com; s=zohoarc; b=bhGvKWevdKTwKE506Uba7WW/FwJJ/8SewUMaYWRcfZFJAALdVsFb0bWVaQxwo7eQbyqUw0bZJKMbbqVlUX9rsrAKyBdpYMgWZQydNrbRHQLp1pMP40dcCXSk8wgrg09aT8ZNVvklEZCcyTn4/nvq4ZzN4p2Ll9Tf9RhR90uc3JY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568015421; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=OWF3pW8BWFEO4R5MSZ5UqRQPPvI2oAl3Y0jFAZ62UaM=; b=P5C0cMb0vTXilpxm1cdlmss/QMO8x3coGS8WV80/9/AuEAuhSpp0l9ndwC19iibsT7qjdl5Vfdutlb3D4WIbiM5Ht+vU7OTQwQExCc6RiJIySusKRdZk27Kqy9rc8NCSusR2CMU4oTCrkcbQDeUNAJJ+Iq8jKc2k30G1M/WzdTU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1568015421832232.99407059604948; Mon, 9 Sep 2019 00:50:21 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id E2FB434CC; Mon, 9 Sep 2019 07:50:19 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B390D5D721; Mon, 9 Sep 2019 07:50:19 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 73FC0C593; Mon, 9 Sep 2019 07:50:19 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x897nnAF004858 for ; Mon, 9 Sep 2019 03:49:49 -0400 Received: by smtp.corp.redhat.com (Postfix) id 44EF25D6B7; Mon, 9 Sep 2019 07:49:49 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id C33B05D6A7 for ; Mon, 9 Sep 2019 07:49:48 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 9 Sep 2019 09:49:41 +0200 Message-Id: <9c68f4a84f6553422c11b3b800d9c8e6e1730367.1568015323.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 3/4] configure: Colorize output X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Mon, 09 Sep 2019 07:50:20 +0000 (UTC) Content-Type: text/plain; charset="utf-8" If we're running from a TTY we can put some colors around 'yes', 'no' and other messages. Shamelessly copied from Ruby source code and modified a bit to comply with syntax-check. https://github.com/ruby/ruby/commit/e4879592873abd4cd8aeed56f4cbaa360a3d3736 Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- m4/virt-colours.m4 | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 m4/virt-colours.m4 diff --git a/m4/virt-colours.m4 b/m4/virt-colours.m4 new file mode 100644 index 0000000000..251778f2ff --- /dev/null +++ b/m4/virt-colours.m4 @@ -0,0 +1,62 @@ +dnl Colourful configure +dnl +dnl Copyright (C) 2015 Nobuyoshi Nakada +dnl +dnl This library is free software; you can redistribute it and/or +dnl modify it under the terms of the GNU Lesser General Public +dnl License as published by the Free Software Foundation; either +dnl version 2.1 of the License, or (at your option) any later version. +dnl +dnl This library is distributed in the hope that it will be useful, +dnl but WITHOUT ANY WARRANTY; without even the implied warranty of +dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +dnl Lesser General Public License for more details. +dnl +dnl You should have received a copy of the GNU Lesser General Public +dnl License along with this library. If not, see +dnl . + +AC_DEFUN([_COLORIZE_RESULT_PREPARE], [ + msg_checking=3D msg_result_yes=3D msg_result_no=3D msg_result_other=3D= msg_reset=3D + AS_IF([test -t 1], [ + msg_begin=3D"`tput smso 2>/dev/null`" + AS_CASE(["$msg_begin"], ['=1B@<:@'*m], + [msg_begin=3D"`echo "$msg_begin" | sed ['s/[0-9]*m$//']`" + msg_checking=3D"${msg_begin}33m" + AS_IF([test ${TEST_COLORS:+set}], [ + msg_result_yes=3D[`expr ":$TEST_COLORS:" : ".*:pass=3D\([^:]*\):"`] + msg_result_no=3D[`expr ":$TEST_COLORS:" : ".*:fail=3D\([^:]*\):"`] + msg_result_other=3D[`expr ":$TEST_COLORS:" : ".*:skip=3D\([^:]*\):"`] + ]) + msg_result_yes=3D"${msg_begin}${msg_result_yes:-32;1}m" + msg_result_no=3D"${msg_begin}${msg_result_no:-31;1}m" + msg_result_other=3D"${msg_begin}${msg_result_other:-33;1}m" + msg_reset=3D"${msg_begin}m" + ]) + AS_UNSET(msg_begin) + ]) + AS_REQUIRE_SHELL_FN([colorize_result], + [AS_FUNCTION_DESCRIBE([colorize_result], [MSG], [Colorize result])], + [AS_CASE(["$[]1"], + [yes], [AS_ECHO(["${msg_result_yes}$[]1${msg_reset}]")], + [no], [AS_ECHO(["${msg_result_no}$[]1${msg_reset}]")], + [AS_ECHO(["${msg_result_other}$[]1${msg_reset}]")])]) +]) + +AC_DEFUN([COLORIZE_RESULT], [AC_REQUIRE([_COLORIZE_RESULT_PREPARE])dnl + AS_LITERAL_IF([$1], + [m4_case([$1], + [yes], [AS_ECHO(["${msg_result_yes}$1${msg_reset}"])], + [no], [AS_ECHO(["${msg_result_no}$1${msg_reset}"])], + [AS_ECHO(["${msg_result_other}$1${msg_reset}"])])], + [colorize_result "$1"]) dnl +]) + +AC_DEFUN([AC_CHECKING],[dnl +AC_REQUIRE([_COLORIZE_RESULT_PREPARE])dnl +AS_MESSAGE([checking ${msg_checking}$1${msg_reset}...])]) + +AC_DEFUN([AC_MSG_RESULT], [dnl +{ _AS_ECHO_LOG([result: $1]) +COLORIZE_RESULT([$1]); dnl +}]) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list From nobody Fri Apr 19 11:15:39 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1568015425; cv=none; d=zoho.com; s=zohoarc; b=kkth20HjerhYKD4hJNMGllvNuGcSAS5kATrqx7YLzSikOMikalVSZfRrjq0dRRnNoperH2IaABd2SqxQX7rY0iUtU27zGmslhzCCIediu7SAtBh1dmzyFjLf6GIAmycWaFrDSQ8EaBfO1p8pSn4evu8+PIi6frdW1qbe/pW7XMg= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1568015425; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To:ARC-Authentication-Results; bh=3jOTGh0UZK/QxBRrR1CS7icQKj4YqQ0DC5mInBD8c5g=; b=g0xMPB5sCTghgMK1ZZyZ/kTvN0Z5JciwNn5xwd/iDyhV8R6gj3ZU758Unclk4ojZUtjNLbqJpeMCuHwmt6O4Ok6f24e/eeAu5jPup2M98ps8kWHMXMllTl1Ug9agd+YE8lVeAaQOIQfmBYWKLPXKnahTjgBZSz/OJ/CfQVkwBDU= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 156801542580036.05483759233243; Mon, 9 Sep 2019 00:50:25 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 114263174654; Mon, 9 Sep 2019 07:50:24 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id DCA995DAAD; Mon, 9 Sep 2019 07:50:23 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 9300024FDE; Mon, 9 Sep 2019 07:50:23 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x897nqlv004881 for ; Mon, 9 Sep 2019 03:49:52 -0400 Received: by smtp.corp.redhat.com (Postfix) id 175995D6B7; Mon, 9 Sep 2019 07:49:52 +0000 (UTC) Received: from moe.brq.redhat.com (unknown [10.43.2.30]) by smtp.corp.redhat.com (Postfix) with ESMTP id 94D765D6A7 for ; Mon, 9 Sep 2019 07:49:49 +0000 (UTC) From: Michal Privoznik To: libvir-list@redhat.com Date: Mon, 9 Sep 2019 09:49:42 +0200 Message-Id: <119b31a8abc815a3494bdbcda83cb9bba1b10b23.1568015323.git.mprivozn@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 4/4] virt-result.m4: Colourize summary printings X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.41]); Mon, 09 Sep 2019 07:50:24 +0000 (UTC) Content-Type: text/plain; charset="utf-8" The LIBVIRT_RESULT function takes two or three arguments. The first one is the name of the result (aka CHECK_NAME). It is printed before the colon character. The rest of the arguments is printed after the character. To produce colourized output a couple of changes needs to be made. Firstly, we need to print the CHECK_NAME using "echo -n" so that the new line is not appended at the end of the message. To achieve this, AS_MESSAGE_N function is introduced. It's a verbatim copy of AS_MESSAGE (which is just another alias to AC_MSG_NOTICE) except it doesn't put '\n' at the EOL. The alias is defined at /usr/share/autoconf-*/autoconf/general.m4 and the AS_MESSAGE is then defined at /usr/share/autoconf-2.69/m4sugar/m4sh.m4. Secondly, the rest of the arguments are printed colourized and to achieve that and also keep printing them into the log file the _AS_ECHO and COLORIZE_RESULT functions need to be called. Signed-off-by: Michal Privoznik Reviewed-by: Daniel P. Berrang=C3=A9 --- m4/virt-result.m4 | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/m4/virt-result.m4 b/m4/virt-result.m4 index 36973ba0b5..9115be5774 100644 --- a/m4/virt-result.m4 +++ b/m4/virt-result.m4 @@ -31,12 +31,27 @@ dnl eg dnl dnl LIBVIRT_RESULT([yajl], [yes], [-I/opt/yajl/include -lyajl]) dnl + +m4_defun_init([_AS_ECHO_LOG_N], +[AS_REQUIRE([_AS_LINENO_PREPARE])], +[_AS_ECHO_N([$as_me:${as_lineno-$LINENO}: $1], AS_MESSAGE_LOG_FD)]) + +m4_defun_init([AS_MESSAGE_N], +[AS_REQUIRE([_AS_ME_PREPARE])], +[m4_ifval(AS_MESSAGE_LOG_FD, + [{ _AS_ECHO_LOG_N([$1]) +_AS_ECHO_N([$as_me: $1], [$2]);}], + [_AS_ECHO_N([$as_me: $1], [$2])])[]]) + AC_DEFUN([LIBVIRT_RESULT], [ + STR=3D`printf "%20s: " "$1"` if test "$2" =3D "no" || test -z "$3" ; then - STR=3D`printf "%20s: %s" "$1" "$2"` + VAL=3D`printf "%s" "$2"` else - STR=3D`printf "%20s: %s (%s)" "$1" "$2" "$3"` + VAL=3D`printf "%s (%s)" "$2" "$3"` fi =20 - AC_MSG_NOTICE([$STR]) + AS_MESSAGE_N([$STR]) + _AS_ECHO([$VAL], AS_MESSAGE_LOG_FD) + COLORIZE_RESULT([$VAL]) ]) --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list