commit:     353f6addd6f45cefb2d316ebbfb0fd6f031ed9d6
Author:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 16 15:57:16 2020 +0000
Commit:     Ulrich Müller <ulm <AT> gentoo <DOT> org>
CommitDate: Thu Feb 20 19:06:49 2020 +0000
URL:        https://gitweb.gentoo.org/proj/devmanual.git/commit/?id=353f6add

Sync example phase functions from PMS.

This follows the recent PMS update:
https://gitweb.gentoo.org/proj/pms.git/commit/?id=0d4ffd51d3dc86782dae2db9fe632f45af7eec87

Signed-off-by: Ulrich Müller <ulm <AT> gentoo.org>

 ebuild-writing/eapi/text.xml                  |  2 +-
 ebuild-writing/functions/src_install/text.xml |  2 +-
 ebuild-writing/functions/src_prepare/text.xml | 12 ++++++------
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/ebuild-writing/eapi/text.xml b/ebuild-writing/eapi/text.xml
index 57c899e..9a2de35 100644
--- a/ebuild-writing/eapi/text.xml
+++ b/ebuild-writing/eapi/text.xml
@@ -272,7 +272,7 @@ If USE flag is set, echo [true output][true suffix] 
(defaults to "yes"),
                </p>
 <codesample lang="ebuild">
 src_prepare() {
-       if declare -p PATCHES | grep -q "^declare -a "; then
+       if [[ $(declare -p PATCHES 2&gt;/dev/null) == "declare -a"* ]]; then
                [[ -n ${PATCHES[@]} ]] &amp;&amp; eapply "${PATCHES[@]}"
        else
                [[ -n ${PATCHES} ]] &amp;&amp; eapply ${PATCHES}

diff --git a/ebuild-writing/functions/src_install/text.xml 
b/ebuild-writing/functions/src_install/text.xml
index 1dd1bac..6ad3412 100644
--- a/ebuild-writing/functions/src_install/text.xml
+++ b/ebuild-writing/functions/src_install/text.xml
@@ -47,7 +47,7 @@ src_install() {
                                FAQ CREDITS CHANGELOG ; do
                        [[ -s "${d}" ]] &amp;&amp; dodoc "${d}"
                done
-       elif declare -p DOCS | grep -q "^declare -a " ; then
+       elif [[ $(declare -p DOCS) == "declare -a"* ]] ; then
                dodoc "${DOCS[@]}"
        else
                dodoc ${DOCS}

diff --git a/ebuild-writing/functions/src_prepare/text.xml 
b/ebuild-writing/functions/src_prepare/text.xml
index 5cbfcf1..d62f2fd 100644
--- a/ebuild-writing/functions/src_prepare/text.xml
+++ b/ebuild-writing/functions/src_prepare/text.xml
@@ -49,12 +49,12 @@ implementation:
 
 <codesample lang="ebuild">
 src_prepare() {
-    if declare -p PATCHES | grep -q "^declare -a "; then
-        [[ -n ${PATCHES[@]} ]] &amp;&amp; eapply "${PATCHES[@]}"
-    else
-        [[ -n ${PATCHES} ]] &amp;&amp; eapply ${PATCHES}
-    fi
-    eapply_user
+       if [[ $(declare -p PATCHES 2&gt;/dev/null) == "declare -a"* ]]; then
+               [[ -n ${PATCHES[@]} ]] &amp;&amp; eapply "${PATCHES[@]}"
+       else
+               [[ -n ${PATCHES} ]] &amp;&amp; eapply ${PATCHES}
+       fi
+       eapply_user
 }
 </codesample>
 

Reply via email to