aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMichael Palimaka <kensington@gentoo.org>2014-10-27 02:12:08 +1100
committerZac Medico <zmedico@gentoo.org>2014-10-27 12:21:28 -0700
commitab43c1944f0cb6bf43d5b40cceb2e8186645d347 (patch)
tree2bfebb4e2dee8c82a4b2627c33a2b1d5145ad724 /bin
parentbin/bashrc-functions.sh: remove portageq function (diff)
downloadportage-ab43c1944f0cb6bf43d5b40cceb2e8186645d347.tar.gz
portage-ab43c1944f0cb6bf43d5b40cceb2e8186645d347.tar.bz2
portage-ab43c1944f0cb6bf43d5b40cceb2e8186645d347.zip
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@gentoo.org> Acked-by: Alexander Berntsen <bernalex@gentoo.org>
Diffstat (limited to 'bin')
-rw-r--r--bin/isolated-functions.sh23
-rw-r--r--bin/save-ebuild-env.sh1
2 files changed, 24 insertions, 0 deletions
diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh
index a22af574a..4992d773f 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 775c02cc5..dd233a9af 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