commit:     6bedf0ae0fdd59123a9b16cc195dfb22cb293fa9
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Aug 17 18:20:28 2014 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Dec  4 14:01:34 2014 +0000
URL:        
http://sources.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=6bedf0ae

Add tentative support for EAPI6 einstalldocs function

Add the einstalldocs function to conveniently install documentation
using the default patterns or DOCS and HTML_DOCS variables.

---
 bin/eapi.sh          |  4 ++++
 bin/phase-helpers.sh | 28 ++++++++++++++++++++++++++++
 2 files changed, 32 insertions(+)

diff --git a/bin/eapi.sh b/bin/eapi.sh
index 6ace20d..978a410 100644
--- a/bin/eapi.sh
+++ b/bin/eapi.sh
@@ -68,6 +68,10 @@ ___eapi_has_get_libdir() {
        [[ ! ${1-${EAPI}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
 }
 
+___eapi_has_einstalldocs() {
+       [[ ! ${1-${EAPI}} =~ 
^(0|1|2|3|4|4-python|4-slot-abi|5|5-hdepend|5-progress)$ ]]
+}
+
 ___eapi_has_master_repositories() {
        [[ ${1-${EAPI}} =~ ^(5-progress)$ ]]
 }

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 764b968..e401676 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -896,6 +896,34 @@ if ___eapi_has_get_libdir; then
        }
 fi
 
+if ___eapi_has_einstalldocs; then
+       einstalldocs() {
+               (
+                       docinto .
+                       if ! declare -p DOCS &>/dev/null ; then
+                               local d
+                               for d in README* ChangeLog AUTHORS NEWS TODO 
CHANGES \
+                                               THANKS BUGS FAQ CREDITS 
CHANGELOG ; do
+                                       [[ -s ${d} ]] && dodoc "${d}"
+                               done
+                       elif [[ $(declare -p DOCS) == "declare -a"* ]] ; then
+                               [[ ${DOCS[@]} ]] && dodoc -r "${DOCS[@]}"
+                       else
+                               [[ ${DOCS} ]] && dodoc -r ${DOCS}
+                       fi
+               )
+
+               (
+                       docinto html
+                       if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare 
-a"* ]] ; then
+                               [[ ${HTML_DOCS[@]} ]] && dodoc -r 
"${HTML_DOCS[@]}"
+                       else
+                               [[ ${HTML_DOCS} ]] && dodoc -r ${HTML_DOCS}
+                       fi
+               )
+       }
+fi
+
 if ___eapi_has_master_repositories; then
        master_repositories() {
                local output repository=$1 retval

Reply via email to