* [gentoo-commits] proj/portage:master commit in: lib/portage/, bin/install-qa-check.d/, bin/
@ 2021-10-04 7:28 Michał Górny
0 siblings, 0 replies; only message in thread
From: Michał Górny @ 2021-10-04 7:28 UTC (permalink / raw
To: gentoo-commits
commit: 204537a426c8738528063c3c5226642de3b7d097
Author: Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Tue Sep 28 12:39:22 2021 +0000
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Mon Oct 4 07:27:46 2021 +0000
URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=204537a4
Prefix color vars with "PORTAGE_COLOR_"
Rename color variables used by einfo etc. to use "PORTAGE_COLOR_"
prefix. Currently these variables are prone to being accidentally
ovewritten e.g. if an ebuild uses GOOD or BAD variables for some
purpose. Using PORTAGE prefix should keep us safe.
As an extra benefit, this makes it trivial to grep for all uses of color
variables.
Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>
bin/install-qa-check.d/10ignored-flags | 4 ++--
bin/isolated-functions.sh | 42 +++++++++++++++++-----------------
bin/save-ebuild-env.sh | 16 +++++++------
lib/portage/output.py | 4 ++--
4 files changed, 34 insertions(+), 32 deletions(-)
diff --git a/bin/install-qa-check.d/10ignored-flags b/bin/install-qa-check.d/10ignored-flags
index 89706cd4c..7cd073578 100644
--- a/bin/install-qa-check.d/10ignored-flags
+++ b/bin/install-qa-check.d/10ignored-flags
@@ -52,7 +52,7 @@ ignored_flag_check() {
f=$(<"${T}"/scanelf-ignored-CFLAGS.log)
if [[ -n ${f} ]] ; then
__vecho -ne '\n'
- eqawarn "${BAD}QA Notice: Files built without respecting CFLAGS have been detected${NORMAL}"
+ eqawarn "${PORTAGE_COLOR_BAD}QA Notice: Files built without respecting CFLAGS have been detected${PORTAGE_COLOR_NORMAL}"
eqawarn " Please include the following list of files in your report:"
eqawarn "${f}"
__vecho -ne '\n'
@@ -82,7 +82,7 @@ ignored_flag_check() {
f=$(<"${T}"/scanelf-ignored-LDFLAGS.log)
if [[ -n ${f} ]] ; then
__vecho -ne '\n'
- eqawarn "${BAD}QA Notice: Files built without respecting LDFLAGS have been detected${NORMAL}"
+ eqawarn "${PORTAGE_COLOR_BAD}QA Notice: Files built without respecting LDFLAGS have been detected${PORTAGE_COLOR_NORMAL}"
eqawarn " Please include the following list of files in your report:"
eqawarn "${f}"
__vecho -ne '\n'
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index 5630dcf4c..3e79ea6e3 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -255,7 +255,7 @@ __elog_base() {
shift
;;
*)
- __vecho -e " ${BAD}*${NORMAL} Invalid use of internal function __elog_base(), next message will not be logged"
+ __vecho -e " ${PORTAGE_COLOR_BAD}*${PORTAGE_COLOR_NORMAL} Invalid use of internal function __elog_base(), next message will not be logged"
return 1
;;
esac
@@ -270,7 +270,7 @@ eqawarn() {
__elog_base QA "$*"
[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2
echo -e "$@" | while read -r ; do
- echo " $WARN*$NORMAL $REPLY" >&2
+ echo " ${PORTAGE_COLOR_WARN}*${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2
done
LAST_E_CMD="eqawarn"
return 0
@@ -280,7 +280,7 @@ elog() {
__elog_base LOG "$*"
[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2
echo -e "$@" | while read -r ; do
- echo " $GOOD*$NORMAL $REPLY" >&2
+ echo " ${PORTAGE_COLOR_GOOD}*${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2
done
LAST_E_CMD="elog"
return 0
@@ -290,7 +290,7 @@ einfo() {
__elog_base INFO "$*"
[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2
echo -e "$@" | while read -r ; do
- echo " $GOOD*$NORMAL $REPLY" >&2
+ echo " ${PORTAGE_COLOR_GOOD}*${PORTAGE_COLOR_NORMAL} ${REPLY}" >&2
done
LAST_E_CMD="einfo"
return 0
@@ -299,7 +299,7 @@ einfo() {
einfon() {
__elog_base INFO "$*"
[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2
- echo -ne " ${GOOD}*${NORMAL} $*" >&2
+ echo -ne " ${PORTAGE_COLOR_GOOD}*${PORTAGE_COLOR_NORMAL} $*" >&2
LAST_E_CMD="einfon"
return 0
}
@@ -308,7 +308,7 @@ ewarn() {
__elog_base WARN "$*"
[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2
echo -e "$@" | while read -r ; do
- echo " $WARN*$NORMAL $RC_INDENTATION$REPLY" >&2
+ echo " ${PORTAGE_COLOR_WARN}*${PORTAGE_COLOR_NORMAL} ${RC_INDENTATION}${REPLY}" >&2
done
LAST_E_CMD="ewarn"
return 0
@@ -318,7 +318,7 @@ eerror() {
__elog_base ERROR "$*"
[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo >&2
echo -e "$@" | while read -r ; do
- echo " $BAD*$NORMAL $RC_INDENTATION$REPLY" >&2
+ echo " ${PORTAGE_COLOR_BAD}*${PORTAGE_COLOR_NORMAL} ${RC_INDENTATION}${REPLY}" >&2
done
LAST_E_CMD="eerror"
return 0
@@ -345,12 +345,12 @@ __eend() {
shift 2
if [[ ${retval} == "0" ]] ; then
- msg="${BRACKET}[ ${GOOD}ok${BRACKET} ]${NORMAL}"
+ msg="${PORTAGE_COLOR_BRACKET}[ ${PORTAGE_COLOR_GOOD}ok${PORTAGE_COLOR_BRACKET} ]${PORTAGE_COLOR_NORMAL}"
else
if [[ -n $* ]] ; then
${efunc} "$*"
fi
- msg="${BRACKET}[ ${BAD}!!${BRACKET} ]${NORMAL}"
+ msg="${PORTAGE_COLOR_BRACKET}[ ${PORTAGE_COLOR_BAD}!!${PORTAGE_COLOR_BRACKET} ]${PORTAGE_COLOR_NORMAL}"
fi
if [[ ${RC_ENDCOL} == "yes" ]] ; then
@@ -378,12 +378,12 @@ __unset_colors() {
COLS=80
ENDCOL=
- GOOD=
- WARN=
- BAD=
- NORMAL=
- HILITE=
- BRACKET=
+ PORTAGE_COLOR_GOOD=
+ PORTAGE_COLOR_WARN=
+ PORTAGE_COLOR_BAD=
+ PORTAGE_COLOR_HILITE=
+ PORTAGE_COLOR_NORMAL=
+ PORTAGE_COLOR_BRACKET=
}
__set_colors() {
@@ -403,12 +403,12 @@ __set_colors() {
if [ -n "${PORTAGE_COLORMAP}" ] ; then
eval ${PORTAGE_COLORMAP}
else
- GOOD=$'\e[32;01m'
- WARN=$'\e[33;01m'
- BAD=$'\e[31;01m'
- HILITE=$'\e[36;01m'
- BRACKET=$'\e[34;01m'
- NORMAL=$'\e[0m'
+ PORTAGE_COLOR_GOOD=$'\e[32;01m'
+ PORTAGE_COLOR_WARN=$'\e[33;01m'
+ PORTAGE_COLOR_BAD=$'\e[31;01m'
+ PORTAGE_COLOR_HILITE=$'\e[36;01m'
+ PORTAGE_COLOR_BRACKET=$'\e[34;01m'
+ PORTAGE_COLOR_NORMAL=$'\e[0m'
fi
}
diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 947ac79d5..8d2ec67ed 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -1,5 +1,5 @@
#!/bin/bash
-# Copyright 1999-2018 Gentoo Foundation
+# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @FUNCTION: __save_ebuild_env
@@ -94,15 +94,17 @@ __save_ebuild_env() {
unset ${!___*}
# portage config variables and variables set directly by portage
- unset ACCEPT_LICENSE BAD BRACKET BUILD_PREFIX COLS \
+ unset ACCEPT_LICENSE BUILD_PREFIX COLS \
DISTDIR DOC_SYMLINKS_DIR \
EBUILD_FORCE_TEST EBUILD_MASTER_PID \
ECLASS_DEPTH ENDCOL FAKEROOTKEY \
- GOOD HILITE HOME \
+ HOME \
LAST_E_CMD LAST_E_LEN LD_PRELOAD MISC_FUNCTIONS_ARGS MOPREFIX \
- NOCOLOR NORMAL PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \
- PORTAGE_BASHRC_FILES PORTAGE_BASHRCS_SOURCED PORTAGE_COMPRESS \
- PORTAGE_COMPRESS_EXCLUDE_SUFFIXES \
+ NOCOLOR PKGDIR PKGUSE PKG_LOGDIR PKG_TMPDIR \
+ PORTAGE_BASHRC_FILES PORTAGE_BASHRCS_SOURCED \
+ PORTAGE_COLOR_BAD PORTAGE_COLOR_BRACKET PORTAGE_COLOR_GOOD \
+ PORTAGE_COLOR_HILITE PORTAGE_COLOR_NORMAL PORTAGE_COLOR_WARN \
+ PORTAGE_COMPRESS PORTAGE_COMPRESS_EXCLUDE_SUFFIXES \
PORTAGE_DOHTML_UNWARNED_SKIPPED_EXTENSIONS \
PORTAGE_DOHTML_UNWARNED_SKIPPED_FILES \
PORTAGE_DOHTML_WARN_ON_SKIPPED_FILES \
@@ -113,7 +115,7 @@ __save_ebuild_env() {
QA_INTERCEPTORS \
RC_DEFAULT_INDENT RC_DOT_PATTERN RC_ENDCOL RC_INDENTATION \
ROOT ROOTPATH RPMDIR TEMP TMP TMPDIR USE_EXPAND \
- WARN XARGS _RC_GET_KV_CACHE
+ XARGS _RC_GET_KV_CACHE
# user config variables
unset DOC_SYMLINKS_DIR INSTALL_MASK PKG_INSTALL_MASK
diff --git a/lib/portage/output.py b/lib/portage/output.py
index c1949717d..9d8601b24 100644
--- a/lib/portage/output.py
+++ b/lib/portage/output.py
@@ -1,4 +1,4 @@
-# Copyright 1998-2020 Gentoo Authors
+# Copyright 1998-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
__docformat__ = "epytext"
@@ -378,7 +378,7 @@ def style_to_ansi_code(style):
def colormap():
mycolors = []
for c in ("GOOD", "WARN", "BAD", "HILITE", "BRACKET", "NORMAL"):
- mycolors.append("%s=$'%s'" % (c, style_to_ansi_code(c)))
+ mycolors.append("PORTAGE_COLOR_{}=$'{}'".format(c, style_to_ansi_code(c)))
return "\n".join(mycolors)
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-10-04 7:28 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-10-04 7:28 [gentoo-commits] proj/portage:master commit in: lib/portage/, bin/install-qa-check.d/, bin/ Michał Górny
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox