commit:     b5f6752aab9664d4672c476065467039b73b2f7b
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Jun  7 12:44:00 2015 +0000
Commit:     Göktürk Yüksek <gokturk <AT> gentoo <DOT> org>
CommitDate: Mon Sep 25 04:25:12 2017 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=b5f6752a

ebuild-writing/eapi: Replace nonfatal example with something correct

Replace the nonfatal example from a poor programming practice (nonfatal
dodoc) to a code collecting logs for test failures. Based on an old
version of sys-apps/paludis.

Closes: https://bugs.gentoo.org/551190

 ebuild-writing/eapi/text.xml | 26 +++++++++++++++++++-------
 1 file changed, 19 insertions(+), 7 deletions(-)

diff --git a/ebuild-writing/eapi/text.xml b/ebuild-writing/eapi/text.xml
index a02b5a6..68f27b0 100644
--- a/ebuild-writing/eapi/text.xml
+++ b/ebuild-writing/eapi/text.xml
@@ -369,19 +369,31 @@ src_compile() {
                </p>
                <p>Example:</p>
                <codesample lang="ebuild">
-EAPI=1
+EAPI=2
 ...
-src_install() {
-       emake DESTDIR="${D}" install || die "make install failed"
-       dodoc ChangeLog README
+src_test() {
+       if ! emake check ; then
+               local a
+               eerror "Tests failed. Looking for files for you to add to your 
bug report..."
+               while IFS='' read -r -d $'\0' a ; do
+                       eerror "    ${a}"
+               done &lt; &lt;(find "${S}" -type f '(' -name '*.epicfail' -o 
-name '*.log' ')' -print0)
+               die "Make check failed"
+       fi
 }
                </codesample>
                <codesample lang="ebuild">
 EAPI=4
 ...
-src_install() {
-       emake DESTDIR="${D}" install
-       nonfatal dodoc ChangeLog README
+src_test() {
+       if ! nonfatal emake check ; then
+               local a
+               eerror "Tests failed. Looking for files for you to add to your 
bug report..."
+               while IFS='' read -r -d $'\0' a ; do
+                       eerror "    ${a}"
+               done &lt; &lt;(find "${S}" -type f '(' -name '*.epicfail' -o 
-name '*.log' ')' -print0)
+               die "Make check failed"
+       fi
 }
                </codesample>
        </li>

Reply via email to