public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] rfc: [patch]  bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938)
@ 2013-06-12 22:22 Samuli Suominen
  2013-06-13  4:58 ` Michał Górny
  2013-06-13 16:29 ` Michał Górny
  0 siblings, 2 replies; 10+ messages in thread
From: Samuli Suominen @ 2013-06-12 22:22 UTC (permalink / raw
  To: Michał Górny, gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 300 bytes --]

what $subject says,

"add support for pkg-config for migration to the new upstream defined 
bash-completion directories (prereq for bug 472938)"

http://bugs.gentoo.org/472938

ie. the pkg-config file shipped *now* in portage is a hack from me to 
postpone this

pretty tired so more eyes is cool ;)

[-- Attachment #2: bash-completion-r1.eclass.patch --]
[-- Type: text/x-patch, Size: 2007 bytes --]

--- bash-completion-r1.eclass	2013-06-13 01:09:24.933961265 +0300
+++ /tmp/bash-completion-r1.eclass	2013-06-13 01:08:51.846963274 +0300
@@ -9,7 +9,7 @@
 # @EXAMPLE:
 #
 # @CODE
-# EAPI=4
+# EAPI=5
 #
 # src_install() {
 # 	default
@@ -17,12 +17,55 @@
 # 	newbashcomp contrib/${PN}.bash-completion ${PN}
 # }
 # @CODE
+#
+# @CODE
+# EAPI=5
+#
+# src_configure() {
+# econf \
+#	--with-udevdir="$(get_bashcompdir)"
+# }
+# @CODE
+
+inherit toolchain-funcs
 
 case ${EAPI:-0} in
 	0|1|2|3|4|5) ;;
 	*) die "EAPI ${EAPI} unsupported (yet)."
 esac
 
+_get_bashdir() {
+	if $($(tc-getPKG_CONFIG) --exists bash-completion); then
+	echo "$($(tc-getPKG_CONFIG) --variable=$1 bash-completion)"
+	else
+		echo $2
+	fi
+}
+
+# @FUNCTION: get_bashcompdir
+# @RETURN: completionsdir value from bash-completion.pc if it's available
+# @DESCRIPTION:
+# If bash-completion.pc pkg-config file is available, query the correct
+# "completionsdir=" value and return it
+# Otherwise fallback to /usr/share/bash-completion/completions
+get_bashcompdir() {
+	if has_version '<app-shells/bash-completion-2.1-r1'; then
+		_get_bashdir completionsdir /usr/share/bash-completion
+	else
+		_get_bashdir completionsdir /usr/share/bash-completion/completions
+	fi
+}
+
+# @FUNCTION: get_bashhelpersdir
+# @RETURN: helpersdir value from bash-completion.pc if it's available
+# @DESCRIPTION:
+# If bash-completion.pc pkg-config file is available, query the correct
+# "helpersdir=" value and return it
+# Otherwise fallback to /usr/share/bash-completion/completions
+get_bashhelpersdir() {
+	_get_bashdir helpersdir /usr/share/bash-completion/helpers
+}
+
 # @FUNCTION: dobashcomp
 # @USAGE: file [...]
 # @DESCRIPTION:
@@ -32,7 +75,7 @@
 	debug-print-function ${FUNCNAME} "${@}"
 
 	(
-		insinto /usr/share/bash-completion
+		insinto "$(get_bashcompdir)"
 		doins "${@}"
 	)
 }
@@ -46,7 +89,7 @@
 	debug-print-function ${FUNCNAME} "${@}"
 
 	(
-		insinto /usr/share/bash-completion
+		insinto "$(get_bashcompdir)"
 		newins "${@}"
 	)
 }

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

* Re: [gentoo-dev] rfc: [patch]  bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938)
  2013-06-12 22:22 [gentoo-dev] rfc: [patch] bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938) Samuli Suominen
@ 2013-06-13  4:58 ` Michał Górny
  2013-06-13  6:23   ` Samuli Suominen
  2013-06-13 16:29 ` Michał Górny
  1 sibling, 1 reply; 10+ messages in thread
From: Michał Górny @ 2013-06-13  4:58 UTC (permalink / raw
  To: gentoo-dev; +Cc: ssuominen, gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 588 bytes --]

Dnia 2013-06-13, o godz. 01:22:11
Samuli Suominen <ssuominen@gentoo.org> napisał(a):

> what $subject says,
> 
> "add support for pkg-config for migration to the new upstream defined 
> bash-completion directories (prereq for bug 472938)"
> 
> http://bugs.gentoo.org/472938
> 
> ie. the pkg-config file shipped *now* in portage is a hack from me to 
> postpone this
> 
> pretty tired so more eyes is cool ;)

You mean http://thread.gmane.org/gmane.linux.gentoo.devel/85258 ?

I think you've got to convince ulm in the first place.

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]

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

* Re: [gentoo-dev] rfc: [patch]  bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938)
  2013-06-13  4:58 ` Michał Górny
@ 2013-06-13  6:23   ` Samuli Suominen
  2013-06-13  6:59     ` Ulrich Mueller
  0 siblings, 1 reply; 10+ messages in thread
From: Samuli Suominen @ 2013-06-13  6:23 UTC (permalink / raw
  To: Michał Górny; +Cc: gentoo-dev

On 13/06/13 07:58, Michał Górny wrote:
> Dnia 2013-06-13, o godz. 01:22:11
> Samuli Suominen <ssuominen@gentoo.org> napisał(a):
>
>> what $subject says,
>>
>> "add support for pkg-config for migration to the new upstream defined
>> bash-completion directories (prereq for bug 472938)"
>>
>> http://bugs.gentoo.org/472938
>>
>> ie. the pkg-config file shipped *now* in portage is a hack from me to
>> postpone this
>>
>> pretty tired so more eyes is cool ;)
>
> You mean http://thread.gmane.org/gmane.linux.gentoo.devel/85258 ?
>
> I think you've got to convince ulm in the first place.
>

His concerns was actually already covered by the first post and the 
linked bug:

This is required for smooth migration path from old to new directories.
Back when the old thread happened, there was only one possible value for 
completions dir, now there is two. And nothing prevents upstream 
adding/changing the values in the .pc file yet again for next release,
this should be dynamic -- just like $(get_udevdir), $(get_libdir) etc.


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

* Re: [gentoo-dev] rfc: [patch]  bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938)
  2013-06-13  6:23   ` Samuli Suominen
@ 2013-06-13  6:59     ` Ulrich Mueller
  2013-06-13  6:59       ` Ulrich Mueller
  2013-06-13  9:05       ` Samuli Suominen
  0 siblings, 2 replies; 10+ messages in thread
From: Ulrich Mueller @ 2013-06-13  6:59 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny, gentoo-dev

>>>>> On Thu, 13 Jun 2013, Samuli Suominen wrote:

> On 13/06/13 07:58, Michał Górny wrote:
>> Dnia 2013-06-13, o godz. 01:22:11 Samuli Suominen
>> <ssuominen@gentoo.org> napisał(a):
>> 
>>> what $subject says,
>>> 
>>> "add support for pkg-config for migration to the new upstream
>>> defined bash-completion directories (prereq for bug 472938)"
>>> 
>>> http://bugs.gentoo.org/472938
>>> 
>>> ie. the pkg-config file shipped *now* in portage is a hack from me
>>> to postpone this
>>> 
>>> pretty tired so more eyes is cool ;)
>> 
>> You mean http://thread.gmane.org/gmane.linux.gentoo.devel/85258 ?
>> 
>> I think you've got to convince ulm in the first place.

> His concerns was actually already covered by the first post and the
> linked bug:

> This is required for smooth migration path from old to new
> directories. Back when the old thread happened, there was only one
> possible value for completions dir, now there is two. And nothing
> prevents upstream adding/changing the values in the .pc file yet
> again for next release, this should be dynamic -- just like
> $(get_udevdir), $(get_libdir) etc.

Nothing is covered. If you change the installation dir for the
completion modules, then eselect bashcomp won't be able to find them
any more. So you need a transition plan.

Ulrich


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

* Re: [gentoo-dev] rfc: [patch]  bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938)
  2013-06-13  6:59     ` Ulrich Mueller
@ 2013-06-13  6:59       ` Ulrich Mueller
  2013-06-13  9:05       ` Samuli Suominen
  1 sibling, 0 replies; 10+ messages in thread
From: Ulrich Mueller @ 2013-06-13  6:59 UTC (permalink / raw
  To: gentoo-dev; +Cc: Michał Górny, gentoo-dev

>>>>> On Thu, 13 Jun 2013, Samuli Suominen wrote:

> On 13/06/13 07:58, Michał Górny wrote:
>> Dnia 2013-06-13, o godz. 01:22:11 Samuli Suominen
>> <ssuominen@gentoo.org> napisał(a):
>> 
>>> what $subject says,
>>> 
>>> "add support for pkg-config for migration to the new upstream
>>> defined bash-completion directories (prereq for bug 472938)"
>>> 
>>> http://bugs.gentoo.org/472938
>>> 
>>> ie. the pkg-config file shipped *now* in portage is a hack from me
>>> to postpone this
>>> 
>>> pretty tired so more eyes is cool ;)
>> 
>> You mean http://thread.gmane.org/gmane.linux.gentoo.devel/85258 ?
>> 
>> I think you've got to convince ulm in the first place.

> His concerns was actually already covered by the first post and the
> linked bug:

> This is required for smooth migration path from old to new
> directories. Back when the old thread happened, there was only one
> possible value for completions dir, now there is two. And nothing
> prevents upstream adding/changing the values in the .pc file yet
> again for next release, this should be dynamic -- just like
> $(get_udevdir), $(get_libdir) etc.

Nothing is covered. If you change the installation dir for the
completion modules, then eselect bashcomp won't be able to find them
any more. So you need a transition plan.

Ulrich


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

* Re: [gentoo-dev] rfc: [patch]  bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938)
  2013-06-13  6:59     ` Ulrich Mueller
  2013-06-13  6:59       ` Ulrich Mueller
@ 2013-06-13  9:05       ` Samuli Suominen
  2013-06-13  9:14         ` Ulrich Mueller
  2013-06-13 15:25         ` Michał Górny
  1 sibling, 2 replies; 10+ messages in thread
From: Samuli Suominen @ 2013-06-13  9:05 UTC (permalink / raw
  To: gentoo-dev

On 13/06/13 09:59, Ulrich Mueller wrote:
>>>>>> On Thu, 13 Jun 2013, Samuli Suominen wrote:
>
>> On 13/06/13 07:58, Michał Górny wrote:
>>> Dnia 2013-06-13, o godz. 01:22:11 Samuli Suominen
>>> <ssuominen@gentoo.org> napisał(a):
>>>
>>>> what $subject says,
>>>>
>>>> "add support for pkg-config for migration to the new upstream
>>>> defined bash-completion directories (prereq for bug 472938)"
>>>>
>>>> http://bugs.gentoo.org/472938
>>>>
>>>> ie. the pkg-config file shipped *now* in portage is a hack from me
>>>> to postpone this
>>>>
>>>> pretty tired so more eyes is cool ;)
>>>
>>> You mean http://thread.gmane.org/gmane.linux.gentoo.devel/85258 ?
>>>
>>> I think you've got to convince ulm in the first place.
>
>> His concerns was actually already covered by the first post and the
>> linked bug:
>
>> This is required for smooth migration path from old to new
>> directories. Back when the old thread happened, there was only one
>> possible value for completions dir, now there is two. And nothing
>> prevents upstream adding/changing the values in the .pc file yet
>> again for next release, this should be dynamic -- just like
>> $(get_udevdir), $(get_libdir) etc.
>
> Nothing is covered. If you change the installation dir for the
> completion modules, then eselect bashcomp won't be able to find them
> any more. So you need a transition plan.

Sorry if I wasn't clear:

http://bugs.gentoo.org/show_bug.cgi?id=472938#c1

"I think we should eventually get rid of the eselect module and load 
everything dynamically."

So what is left, after committing those posted diff's:

- Removal of bash-completion specific snippets from app-admin/eselect as 
it's no-op with the new way. This is more of a matter of cleanup after 
rest of the work is done. Although, if you want something more complex, 
then by all means...

- Postinstallation instructions to the new bash-completion to run qfile 
combination with emerge to re-emerge packages to move files to correct 
directory. Trivial to accomplish. Dunno why I didn't already put it to 
the diff.

As in, there is a complete transition plan in place far as I can see. I 
succesfully migrated already locally.


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

* Re: [gentoo-dev] rfc: [patch]  bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938)
  2013-06-13  9:05       ` Samuli Suominen
@ 2013-06-13  9:14         ` Ulrich Mueller
  2013-06-13  9:30           ` Samuli Suominen
  2013-06-13 15:25         ` Michał Górny
  1 sibling, 1 reply; 10+ messages in thread
From: Ulrich Mueller @ 2013-06-13  9:14 UTC (permalink / raw
  To: gentoo-dev

>>>>> On Thu, 13 Jun 2013, Samuli Suominen wrote:

> http://bugs.gentoo.org/show_bug.cgi?id=472938#c1

> "I think we should eventually get rid of the eselect module and load
> everything dynamically."

How do you enable and disable completion modules without the eselect
module?

Ulrich


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

* Re: [gentoo-dev] rfc: [patch]  bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938)
  2013-06-13  9:14         ` Ulrich Mueller
@ 2013-06-13  9:30           ` Samuli Suominen
  0 siblings, 0 replies; 10+ messages in thread
From: Samuli Suominen @ 2013-06-13  9:30 UTC (permalink / raw
  To: gentoo-dev

On 13/06/13 12:14, Ulrich Mueller wrote:
>>>>>> On Thu, 13 Jun 2013, Samuli Suominen wrote:
>
>> http://bugs.gentoo.org/show_bug.cgi?id=472938#c1
>
>> "I think we should eventually get rid of the eselect module and load
>> everything dynamically."
>
> How do you enable and disable completion modules without the eselect
> module?
>
> Ulrich
>

The upstream way...

To disable sys-fs/udisks:2 bash-completion file 'udisksctl' from 
completing, user would add:

complete -r udisksctl

to eg. his ~/.bashrc

Like for example here,

https://mknowles.com.au/wordpress/2012/09/22/how-to-stop-bash-from-completing-mount-dev-commands/


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

* Re: [gentoo-dev] rfc: [patch]  bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938)
  2013-06-13  9:05       ` Samuli Suominen
  2013-06-13  9:14         ` Ulrich Mueller
@ 2013-06-13 15:25         ` Michał Górny
  1 sibling, 0 replies; 10+ messages in thread
From: Michał Górny @ 2013-06-13 15:25 UTC (permalink / raw
  To: gentoo-dev; +Cc: ssuominen

[-- Attachment #1: Type: text/plain, Size: 561 bytes --]

Dnia 2013-06-13, o godz. 12:05:08
Samuli Suominen <ssuominen@gentoo.org> napisał(a):

> - Postinstallation instructions to the new bash-completion to run qfile 
> combination with emerge to re-emerge packages to move files to correct 
> directory. Trivial to accomplish. Dunno why I didn't already put it to 
> the diff.

With new enough portage, you can simply do:

  emerge -1 /usr/share/bash-completion

I think that should be the way suggested to users. But that's just
a side note, so we don't miss it.

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]

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

* Re: [gentoo-dev] rfc: [patch]  bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938)
  2013-06-12 22:22 [gentoo-dev] rfc: [patch] bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938) Samuli Suominen
  2013-06-13  4:58 ` Michał Górny
@ 2013-06-13 16:29 ` Michał Górny
  1 sibling, 0 replies; 10+ messages in thread
From: Michał Górny @ 2013-06-13 16:29 UTC (permalink / raw
  To: gentoo-dev; +Cc: ssuominen, gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1041 bytes --]

Dnia 2013-06-13, o godz. 01:22:11
Samuli Suominen <ssuominen@gentoo.org> napisał(a):

> what $subject says,
> 
> "add support for pkg-config for migration to the new upstream defined 
> bash-completion directories (prereq for bug 472938)"
> 
> http://bugs.gentoo.org/472938
> 
> ie. the pkg-config file shipped *now* in portage is a hack from me to 
> postpone this
> 
> pretty tired so more eyes is cool ;)

I've talked with ulm and got an agreement to commit the initial
get_bashcompdir(). I've used the patch that I once submitted to the ml
as its minimal change.

I'll get to committing parts of your patch in a week or so, after more
eyes see them. If you'd like, please split it into functional parts
(like 1. pkg-config, 2. helpersdir, etc.) and rebase on top of current
code.

In any case, we can already start moving packages to use
$(get_bashcompdir), so they're prepared for the eventual migration.
But the actual details need to be discussed, as was pointed out.

-- 
Best regards,
Michał Górny

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 966 bytes --]

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

end of thread, other threads:[~2013-06-13 16:29 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-12 22:22 [gentoo-dev] rfc: [patch] bash-completion-r1.eclass: add support for pkg-config for migration to the new upstream defined bash-completion directories (prereq for bug 472938) Samuli Suominen
2013-06-13  4:58 ` Michał Górny
2013-06-13  6:23   ` Samuli Suominen
2013-06-13  6:59     ` Ulrich Mueller
2013-06-13  6:59       ` Ulrich Mueller
2013-06-13  9:05       ` Samuli Suominen
2013-06-13  9:14         ` Ulrich Mueller
2013-06-13  9:30           ` Samuli Suominen
2013-06-13 15:25         ` Michał Górny
2013-06-13 16:29 ` 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