Skip to content

Commit

Permalink
app-shells/bash-completion: Make eselect support optional
Browse files Browse the repository at this point in the history
Signed-off-by: Michał Górny <[email protected]>
  • Loading branch information
mgorny committed May 25, 2019
1 parent a1116ee commit bd78224
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
18 changes: 11 additions & 7 deletions app-shells/bash-completion/bash-completion-9999.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down Expand Up @@ -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() {
Expand Down
6 changes: 6 additions & 0 deletions app-shells/bash-completion/metadata.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
<email>[email protected]</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
Expand Down

0 comments on commit bd78224

Please sign in to comment.