* [gentoo-dev] [PATCH] optfeature.eclass: Introduce optfeature header
@ 2021-04-03 10:17 Andreas Sturmlechner
0 siblings, 0 replies; only message in thread
From: Andreas Sturmlechner @ 2021-04-03 10:17 UTC (permalink / raw
To: gentoo-dev
[-- Attachment #1: Type: text/plain, Size: 1811 bytes --]
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 <asturm@gentoo.org>
---
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: <short description> <package atom to match> [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
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-04-03 10:17 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-04-03 10:17 [gentoo-dev] [PATCH] optfeature.eclass: Introduce optfeature header Andreas Sturmlechner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox