app-shells/bash-completion: Make eselect support optional
authorMichał Górny <mgorny@gentoo.org>
Sat, 25 May 2019 21:03:25 +0000 (23:03 +0200)
committerMichał Górny <mgorny@gentoo.org>
Sat, 25 May 2019 21:11:32 +0000 (23:11 +0200)
Signed-off-by: Michał Górny <mgorny@gentoo.org>
app-shells/bash-completion/bash-completion-9999.ebuild
app-shells/bash-completion/metadata.xml

index 5c0bff2495fe3b5c998d215764db159ea546fcbb..ee27e7fcf8fe40034940223a34a472d0e6074f16 100644 (file)
@@ -13,7 +13,7 @@ EGIT_REPO_URI="https://github.com/scop/bash-completion"
 LICENSE="GPL-2+"
 SLOT="0"
 KEYWORDS=""
-IUSE="test"
+IUSE="+eselect test"
 RESTRICT="!test? ( test )"
 
 # completion collision with net-fs/mc
@@ -77,19 +77,21 @@ pkg_setup() {
 }
 
 src_unpack() {
-       git-r3_fetch https://github.com/mgorny/bashcomp2
+       use eselect && git-r3_fetch https://github.com/mgorny/bashcomp2
        git-r3_fetch
 
-       git-r3_checkout https://github.com/mgorny/bashcomp2 \
+       use eselect && git-r3_checkout https://github.com/mgorny/bashcomp2 \
                "${WORKDIR}"/bashcomp2
        git-r3_checkout
 }
 
 src_prepare() {
        eapply_user
-       # generate and apply patch
-       emake -C "${WORKDIR}"/bashcomp2 bash-completion-blacklist-support.patch
-       eapply "${WORKDIR}"/bashcomp2/bash-completion-blacklist-support.patch
+       if use eselect; then
+               # generate and apply patch
+               emake -C "${WORKDIR}"/bashcomp2 bash-completion-blacklist-support.patch
+               eapply "${WORKDIR}"/bashcomp2/bash-completion-blacklist-support.patch
+       fi
 
        eautoreconf
 }
@@ -128,7 +130,9 @@ src_install() {
        dodoc AUTHORS CHANGES CONTRIBUTING.md README.md
 
        # install the eselect module
-       emake -C "${WORKDIR}"/bashcomp2 DESTDIR="${D}" PREFIX="${EPREFIX}/usr" install
+       use eselect &&
+               emake -C "${WORKDIR}"/bashcomp2 DESTDIR="${D}" \
+                       PREFIX="${EPREFIX}/usr" install
 }
 
 pkg_postinst() {
index 2bb3ef2362422c7d837fc6626ce2468c8f6694c4..159d6c88d62d9651daefc3e13f6d69bccbf0b6ee 100644 (file)
@@ -9,6 +9,12 @@
                <email>shell-tools@gentoo.org</email>
                <name>Gentoo Shell Tools Project</name>
        </maintainer>
+       <use>
+               <flag name='eselect'>
+                       Support blacklisting of completions via 'eselect bash-completion'.
+                       This enables custom Gentoo patching of upstream completion loader.
+               </flag>
+       </use>
        <longdescription>
                Since v2.04, bash has allowed you to intelligently program and extend its
                standard completion behavior to achieve complex command lines with just a