public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH bash-completion-r1] Introduce get_bashcompdir() to obtain bash-completion dir.
@ 2013-04-27  5:45 Michał Górny
  2013-04-27  7:14 ` Ulrich Mueller
  0 siblings, 1 reply; 5+ messages in thread
From: Michał Górny @ 2013-04-27  5:45 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny

Some ebuilds need to explicitly override bash-completion directory in
build system due to build systems having default non-matching Gentoo (or
rather Gentoo having bash-completion dir not matching anything else).

It's better to have a function to obtain that directory rather than for
ebuilds to hardcode it.
---
 gx86/eclass/bash-completion-r1.eclass | 23 +++++++++++++++++++++--
 1 file changed, 21 insertions(+), 2 deletions(-)

diff --git a/gx86/eclass/bash-completion-r1.eclass b/gx86/eclass/bash-completion-r1.eclass
index 8af46ee..5d23931 100644
--- a/gx86/eclass/bash-completion-r1.eclass
+++ b/gx86/eclass/bash-completion-r1.eclass
@@ -23,6 +23,25 @@ case ${EAPI:-0} in
 	*) die "EAPI ${EAPI} unsupported (yet)."
 esac
 
+# @FUNCTION: _bash-completion-r1_get_bashcompdir
+# @INTERNAL
+# @DESCRIPTION:
+# Get unprefixed bash-completion directory.
+_bash-completion-r1_get_bashcompdir() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	echo /usr/share/bash-completion
+}
+
+# @FUNCTION: get_bashcompdir
+# @DESCRIPTION:
+# Get the bash-completion directory.
+get_bashcompdir() {
+	debug-print-function ${FUNCNAME} "${@}"
+
+	echo "${EPREFIX}$(_bash-completion-r1_get_bashcompdir)"
+}
+
 # @FUNCTION: dobashcomp
 # @USAGE: file [...]
 # @DESCRIPTION:
@@ -32,7 +51,7 @@ dobashcomp() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	(
-		insinto /usr/share/bash-completion
+		insinto "$(_bash-completion-r1_get_bashcompdir)"
 		doins "${@}"
 	)
 }
@@ -46,7 +65,7 @@ newbashcomp() {
 	debug-print-function ${FUNCNAME} "${@}"
 
 	(
-		insinto /usr/share/bash-completion
+		insinto "$(_bash-completion-r1_get_bashcompdir)"
 		newins "${@}"
 	)
 }
-- 
1.8.2.1



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-27 15:12 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-27  5:45 [gentoo-dev] [PATCH bash-completion-r1] Introduce get_bashcompdir() to obtain bash-completion dir Michał Górny
2013-04-27  7:14 ` Ulrich Mueller
2013-04-27 11:49   ` Michał Górny
2013-04-27 15:08     ` Ulrich Mueller
2013-04-27 15:12       ` Michał Górny

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox