commit:     60a9373d446c87fd2f3bbd7f4084cb1250065175
Author:     Michał Górny <mgorny <AT> gentoo <DOT> org>
AuthorDate: Sun Apr 28 06:08:59 2019 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Sun Apr 28 08:41:58 2019 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=60a9373d

app-shells/bash-completion: Refactor completion removal into a func

Signed-off-by: Michał Górny <mgorny <AT> gentoo.org>

 .../bash-completion/bash-completion-9999.ebuild    | 45 +++++++++++-----------
 1 file changed, 22 insertions(+), 23 deletions(-)

diff --git a/app-shells/bash-completion/bash-completion-9999.ebuild 
b/app-shells/bash-completion/bash-completion-9999.ebuild
index 73e814b9881..73e95569c3b 100644
--- a/app-shells/bash-completion/bash-completion-9999.ebuild
+++ b/app-shells/bash-completion/bash-completion-9999.ebuild
@@ -36,27 +36,32 @@ DEPEND="app-arch/xz-utils
        )"
 PDEPEND=">=app-shells/gentoo-bashcomp-20140911"
 
-# Remove unwanted completions.
-STRIP_COMPLETIONS=(
-       # Slackware package stuff, quite generic names cause collisions
-       # (e.g. with sys-apps/pacman)
-       explodepkg installpkg makepkg pkgtool removepkg upgradepkg
+strip_completions() {
+       # Remove unwanted completions.
+       local strip_completions=(
+               # Slackware package stuff, quite generic names cause collisions
+               # (e.g. with sys-apps/pacman)
+               explodepkg installpkg makepkg pkgtool removepkg upgradepkg
 
-       # Debian/Red Hat network stuff
-       ifdown ifup ifstatus
+               # Debian/Red Hat network stuff
+               ifdown ifup ifstatus
 
-       # Installed in app-editors/vim-core
-       xxd
+               # Installed in app-editors/vim-core
+               xxd
 
-       # Now-dead symlinks to deprecated completions
-       hd ncal
+               # Now-dead symlinks to deprecated completions
+               hd ncal
+       )
 
-       # Installed by sys-apps/util-linux-2.28 (and now deprecated)
-       _mount _umount _mount.linux _umount.linux
+       local file
+       for file in "${strip_completions[@]}"; do
+               rm "${ED}"/usr/share/bash-completion/completions/${file} ||
+                       die "stripping ${file} failed"
+       done
 
-       # Deprecated in favor of sys-apps/util-linux-2.31
-       _rfkill
-)
+       # remove deprecated completions (moved to other packages)
+       rm "${ED}"/usr/share/bash-completion/completions/_* || die
+}
 
 python_check_deps() {
        has_version "dev-python/pexpect[${PYTHON_USEDEP}]" &&
@@ -104,13 +109,7 @@ src_install() {
 
        emake DESTDIR="${D}" profiledir="${EPREFIX}"/etc/bash/bashrc.d install
 
-       local file
-       for file in "${STRIP_COMPLETIONS[@]}"; do
-               rm "${ED}"/usr/share/bash-completion/completions/${file} ||
-                       die "stripping ${file} failed"
-       done
-       # remove deprecated completions (moved to other packages)
-       rm "${ED}"/usr/share/bash-completion/completions/_* || die
+       strip_completions
 
        dodoc AUTHORS CHANGES CONTRIBUTING.md README.md
 

Reply via email to