* [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
* Re: [gentoo-dev] [PATCH bash-completion-r1] Introduce get_bashcompdir() to obtain bash-completion dir.
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
0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Mueller @ 2013-04-27 7:14 UTC (permalink / raw
To: gentoo-dev; +Cc: Michał Górny
>>>>> On Sat, 27 Apr 2013, Michał Górny wrote:
> 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.
Why?
Ulrich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-dev] [PATCH bash-completion-r1] Introduce get_bashcompdir() to obtain bash-completion dir.
2013-04-27 7:14 ` Ulrich Mueller
@ 2013-04-27 11:49 ` Michał Górny
2013-04-27 15:08 ` Ulrich Mueller
0 siblings, 1 reply; 5+ messages in thread
From: Michał Górny @ 2013-04-27 11:49 UTC (permalink / raw
To: gentoo-dev; +Cc: ulm
[-- Attachment #1: Type: text/plain, Size: 700 bytes --]
On Sat, 27 Apr 2013 09:14:17 +0200
Ulrich Mueller <ulm@gentoo.org> wrote:
> >>>>> On Sat, 27 Apr 2013, Michał Górny wrote:
>
> > 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.
>
> Why?
For better consistency, I'd say. Especially if we decide to fix Gentoo
and start using the standard path, we'd need only to modify the eclass
rather than all involved packages.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-dev] [PATCH bash-completion-r1] Introduce get_bashcompdir() to obtain bash-completion dir.
2013-04-27 11:49 ` Michał Górny
@ 2013-04-27 15:08 ` Ulrich Mueller
2013-04-27 15:12 ` Michał Górny
0 siblings, 1 reply; 5+ messages in thread
From: Ulrich Mueller @ 2013-04-27 15:08 UTC (permalink / raw
To: Michał Górny; +Cc: gentoo-dev
>>>>> On Sat, 27 Apr 2013, Michał Górny wrote:
>> > It's better to have a function to obtain that directory rather than for
>> > ebuilds to hardcode it.
>>
>> Why?
> For better consistency, I'd say. Especially if we decide to fix Gentoo
> and start using the standard path, we'd need only to modify the eclass
> rather than all involved packages.
But why should it be a function? Its return value is constant, so
a variable defined in the eclass seems more natural.
Ulrich
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [gentoo-dev] [PATCH bash-completion-r1] Introduce get_bashcompdir() to obtain bash-completion dir.
2013-04-27 15:08 ` Ulrich Mueller
@ 2013-04-27 15:12 ` Michał Górny
0 siblings, 0 replies; 5+ messages in thread
From: Michał Górny @ 2013-04-27 15:12 UTC (permalink / raw
To: gentoo-dev; +Cc: ulm
[-- Attachment #1: Type: text/plain, Size: 877 bytes --]
On Sat, 27 Apr 2013 17:08:02 +0200
Ulrich Mueller <ulm@gentoo.org> wrote:
> >>>>> On Sat, 27 Apr 2013, Michał Górny wrote:
>
> >> > It's better to have a function to obtain that directory rather than for
> >> > ebuilds to hardcode it.
> >>
> >> Why?
>
> > For better consistency, I'd say. Especially if we decide to fix Gentoo
> > and start using the standard path, we'd need only to modify the eclass
> > rather than all involved packages.
>
> But why should it be a function? Its return value is constant, so
> a variable defined in the eclass seems more natural.
To be honest, I was thinking the same thing when re-implementing
the remaining functions. I can think of two reasons:
1. consistency with other eclasses and functions like get_libdir,
2. possibility of using pkg-config if it becomes necessary.
--
Best regards,
Michał Górny
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]
^ permalink raw reply [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