From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id B4C881387D3 for ; Sun, 26 Oct 2014 15:12:52 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E8A85E08BF; Sun, 26 Oct 2014 15:12:49 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 7C507E08AD for ; Sun, 26 Oct 2014 15:12:47 +0000 (UTC) Received: from semaphore.home.gateway (ppp118-209-36-119.lns20.mel4.internode.on.net [118.209.36.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: kensington) by smtp.gentoo.org (Postfix) with ESMTPSA id 3D90834043D; Sun, 26 Oct 2014 15:12:45 +0000 (UTC) From: Michael Palimaka To: gentoo-portage-dev@lists.gentoo.org Cc: Michael Palimaka Subject: [gentoo-portage-dev] [PATCH 1/3] Introduce eqalog and eqawarnlog functions. Date: Mon, 27 Oct 2014 02:12:08 +1100 Message-Id: <1414336328-15513-1-git-send-email-kensington@gentoo.org> X-Mailer: git-send-email 2.0.4 In-Reply-To: <1414253761-6310-1-git-send-email-kensington@gentoo.org> References: <1414253761-6310-1-git-send-email-kensington@gentoo.org> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-portage-dev@lists.gentoo.org Reply-to: gentoo-portage-dev@lists.gentoo.org X-Archives-Salt: 10c6d14b-2b5b-4e14-bbe0-078e20903508 X-Archives-Hash: 7402b4bcde29a7fe45dbf8994d5977f2 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 --- bin/isolated-functions.sh | 16 ++++++++++++++++ bin/save-ebuild-env.sh | 1 + 2 files changed, 17 insertions(+) diff --git a/bin/isolated-functions.sh b/bin/isolated-functions.sh index a22af57..ad44e2a 100644 --- a/bin/isolated-functions.sh +++ b/bin/isolated-functions.sh @@ -256,6 +256,22 @@ __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 -- 2.0.4