public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
From: Samuli Suominen <ssuominen@gentoo.org>
To: "Michał Górny" <mgorny@gentoo.org>, gentoo-dev@gentoo.org
Subject: [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)
Date: Thu, 13 Jun 2013 01:22:11 +0300	[thread overview]
Message-ID: <51B8F493.3000003@gentoo.org> (raw)

[-- 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 "${@}"
 	)
 }

             reply	other threads:[~2013-06-12 22:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-12 22:22 Samuli Suominen [this message]
2013-06-13  4:58 ` [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) 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=51B8F493.3000003@gentoo.org \
    --to=ssuominen@gentoo.org \
    --cc=gentoo-dev@gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    --cc=mgorny@gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox