commit: ab43c1944f0cb6bf43d5b40cceb2e8186645d347
Author: Michael Palimaka <kensington <AT> gentoo <DOT> org>
AuthorDate: Sun Oct 26 15:12:08 2014 +0000
Commit: Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Mon Oct 27 19:21:28 2014 +0000
URL:
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=ab43c194
Introduce eqalog and eqawarnlog functions.
These functions are to be used for creating a log of QA violations in a
machine-readable format.
Stored in ${T]/qa.log, the log consists of one entry per line in the
following format: violation-tag data
For example:
deprecated-directory /usr/man
deprecated-directory /usr/info
world-writable /var/db/foo/bar
Signed-off-by: Zac Medico <zmedico <AT> gentoo.org>
Acked-by: Alexander Berntsen <bernalex <AT> gentoo.org>
---
bin/isolated-functions.sh | 23 +++++++++++++++++++++++
bin/save-ebuild-env.sh | 1 +
2 files changed, 24 insertions(+)
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index a22af57..4992d77 100644
--- a/bin/isolated-functions.sh
+++ b/bin/isolated-functions.sh
@@ -256,6 +256,29 @@ __elog_base() {
return 0
}
+__eqalog() {
+ local tag=$1 x
+ shift
+ for x in "$@" ; do
+ echo "${tag}" "${x}"| (
+ escape=""
+ while read -r ; do
+ echo -n "${escape}${REPLY}"
+ escape="\\n"
+ done
+ echo
+ ) >> "${T}"/qa.log
+ done
+}
+
+__eqawarnlog() {
+ __eqalog "$@"
+ shift
+ for x in "$@" ; do
+ eqawarn " ${x}"
+ done
+}
+
eqawarn() {
__elog_base QA "$*"
[[ ${RC_ENDCOL} != "yes" && ${LAST_E_CMD} == "ebegin" ]] && echo
diff --git a/bin/save-ebuild-env.sh b/bin/save-ebuild-env.sh
index 775c02c..dd233a9 100644
--- a/bin/save-ebuild-env.sh
+++ b/bin/save-ebuild-env.sh
@@ -76,6 +76,7 @@ __save_ebuild_env() {
__ebuild_arg_to_phase __ebuild_phase_funcs default \
__unpack_tar __unset_colors \
__source_env_files __try_source \
+ __eqalog __eqawarnlog \
${QA_INTERCEPTORS}
___eapi_has_usex && unset -f usex