commit:     7e79e1c7415935d306e6c548e9068fc659837ac9
Author:     Amadeusz Żołnowski <aidecoe <AT> gentoo <DOT> org>
AuthorDate: Tue Mar 28 22:40:24 2017 +0000
Commit:     Amadeusz Piotr Żołnowski <aidecoe <AT> gentoo <DOT> org>
CommitDate: Tue Mar 28 22:40:24 2017 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7e79e1c7

rebar.eclass: Disable coverage in test phase

This is a workaround for failing coverage. Coverage is not relevant in
this context, so there's no harm to disable it, although the issue
should be fixed.

 eclass/rebar.eclass | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)

diff --git a/eclass/rebar.eclass b/eclass/rebar.eclass
index 3ffe5630d77..c1dc609b128 100644
--- a/eclass/rebar.eclass
+++ b/eclass/rebar.eclass
@@ -78,6 +78,22 @@ _rebar_find_dep() {
        echo "${result}"
 }
 
+# @FUNCTION: rebar_disable_coverage
+# @USAGE: [<rebar_config>]
+# @DESCRIPTION:
+# Disable coverage in rebar.config. This is a workaround for failing coverage.
+# Coverage is not relevant in this context, so there's no harm to disable it,
+# although the issue should be fixed.
+rebar_disable_coverage() {
+       debug-print-function ${FUNCNAME} "${@}"
+
+       local rebar_config="${1:-rebar.config}"
+
+       sed -e 's/{cover_enabled, true}./{cover_enabled, false}./' \
+               -i "${rebar_config}" \
+               || die "failed to disable coverage in ${rebar_config}"
+}
+
 # @FUNCTION: erebar
 # @USAGE: <targets>
 # @DESCRIPTION:
@@ -183,7 +199,10 @@ rebar_src_prepare() {
 
        default
        rebar_set_vsn
-       [[ -f rebar.config ]] && rebar_remove_deps
+       if [[ -f rebar.config ]]; then
+               rebar_disable_coverage
+               rebar_remove_deps
+       fi
 }
 
 # @FUNCTION: rebar_src_configure

Reply via email to