From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id 2C5881382C5 for ; Sat, 3 Apr 2021 10:17:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 962C5E0839; Sat, 3 Apr 2021 10:17:51 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 46BCCE0831 for ; Sat, 3 Apr 2021 10:17:51 +0000 (UTC) From: Andreas Sturmlechner To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] [PATCH] optfeature.eclass: Introduce optfeature header Date: Sat, 03 Apr 2021 12:17:40 +0200 Message-ID: <4434463.vXUDI8C0e8@tuxbrain> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2012355.9o76ZdvQCi"; micalg="pgp-sha512"; protocol="application/pgp-signature" X-Archives-Salt: fa9bc8de-b78b-4d42-8099-bfbfc927c810 X-Archives-Hash: 33100288caff7a7be1f296f29abf5e77 --nextPart2012355.9o76ZdvQCi Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii"; protected-headers="v1" From: Andreas Sturmlechner To: gentoo-dev@lists.gentoo.org Subject: [PATCH] optfeature.eclass: Introduce optfeature header Date: Sat, 03 Apr 2021 12:17:40 +0200 Message-ID: <4434463.vXUDI8C0e8@tuxbrain> Before this change, optfeature() will print a list of optional dependencies, or nothing if deps are installed. Ebuilds commonly print their own elog ahead of optfeature, which then may not be followed up by any list at all. This change adds a default header text, which may be changed by the ebuild, that is only printed if optfeature is about to list at least one dependency. Signed-off-by: Andreas Sturmlechner --- eclass/optfeature.eclass | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/eclass/optfeature.eclass b/eclass/optfeature.eclass index e13fc3eba81..46f8012b2c3 100644 --- a/eclass/optfeature.eclass +++ b/eclass/optfeature.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: optfeature.eclass @@ -14,6 +14,18 @@ esac if [[ -z ${_OPTFEATURE_ECLASS} ]]; then _OPTFEATURE_ECLASS=1 +# @ECLASS-VARIABLE: OPTFEATURE_HEADER +# @DESCRIPTION: +# Overridable default header printed ahead of the first optfeature output. +# Will remain silent if all optional dependencies are present. +: ${OPTFEATURE_HEADER:="Install additional packages for optional runtime features:"} + +# @ECLASS-VARIABLE: _OPTFEATURE_DOHEADER +# @INTERNAL +# @DESCRIPTION: +# If true, print header ahead of the first optfeature output. +_OPTFEATURE_DOHEADER=true + # @FUNCTION: optfeature # @USAGE: [other atoms] # @DESCRIPTION: @@ -51,6 +63,10 @@ optfeature() { fi done if [[ ${flag} -eq 0 ]]; then + if [[ ${_OPTFEATURE_DOHEADER} == true ]]; then + elog ${OPTFEATURE_HEADER} + _OPTFEATURE_DOHEADER=false + fi for i; do read -r -d '' -a arr <<<"${i}" msg=" " -- 2.31.1 --nextPart2012355.9o76ZdvQCi Content-Type: application/pgp-signature; name="signature.asc" Content-Description: This is a digitally signed message part. Content-Transfer-Encoding: 7Bit -----BEGIN PGP SIGNATURE----- iQGTBAABCgB9FiEE/x0UfMgLbk/MiQ+AUIqgAODug+AFAmBoQMRfFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEZG MUQxNDdDQzgwQjZFNEZDQzg5MEY4MDUwOEFBMDAwRTBFRTgzRTAACgkQUIqgAODu g+AV5gf+PRT8WrsUsUkt/rQdzB+LYxoESBzpk5Lqgfzwr27hAo1fviAUlDGMRh4c zk0An9JJHKYgBdRHd5RXisTAFL1l6VErkz4MQkpSr4S0eTtaR5usHMQh1YeF2SRq PdUO9SCXb5R9Vrkn0EmqOhRRUluv2k2IWKLM5hbcdSlGoniVUfKIO1PngOGPK+Ti w0tjBWyDAq29RHz7K5kvnqgNBmKzT+wZvLkEj7ji/Jt+SShGqz/Sa4/GV8SXCT9J t/og6mGFGyV7iCo5gUpyBAqJHGirCFmX+FUsyz1MBzZNdK7zXnfjnvmD9hZCTipN XNLTkcXONABNweNoVzaRKXUfjIXg8g== =71gw -----END PGP SIGNATURE----- --nextPart2012355.9o76ZdvQCi--