[prev in list] [next in list] [prev in thread] [next in thread] 

List:       gentoo-portage-dev
Subject:    [gentoo-portage-dev] [PATCH 04/13] Add tentative support for EAPI6 einstalldocs function
From:       Michał Górny <mgorny () gentoo ! org>
Date:       2014-08-18 17:56:43
Message-ID: 1408384612-14713-5-git-send-email-mgorny () gentoo ! org
[Download RAW message or body]

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 | 22 ++++++++++++++++++++++
 2 files changed, 26 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 8edbc07..6ccf4f4 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -853,6 +853,28 @@ if ___eapi_has_get_libdir; then
 	}
 fi
 
+if ___eapi_has_einstalldocs; then
+	einstalldocs() {
+		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
+
+		if [[ $(declare -p HTML_DOCS 2>/dev/null) == "declare -a"* ]] ; then
+			[[ ${HTML_DOCS[@]} ]] && dohtml -r "${HTML_DOCS[@]}"
+		else
+			[[ ${HTML_DOCS} ]] && dohtml -r ${HTML_DOCS}
+		fi
+	}
+fi
+
 if ___eapi_has_master_repositories; then
 	master_repositories() {
 		local output repository=$1 retval
-- 
2.0.4



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic