bash-completion-2.3-r2.ebuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. # Copyright 1999-2017 Gentoo Foundation
  2. # Distributed under the terms of the GNU General Public License v2
  3. EAPI=6
  4. BASHCOMP_P=bashcomp-2.0.2
  5. inherit versionator
  6. DESCRIPTION="Programmable Completion for bash"
  7. HOMEPAGE="https://github.com/scop/bash-completion"
  8. SRC_URI="https://github.com/scop/bash-completion/releases/download/${PV}/${P}.tar.xz
  9. https://bitbucket.org/mgorny/bashcomp2/downloads/${BASHCOMP_P}.tar.gz"
  10. LICENSE="GPL-2"
  11. SLOT="0"
  12. KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris"
  13. IUSE=""
  14. RDEPEND=">=app-shells/bash-4.3_p30-r1
  15. sys-apps/miscfiles
  16. !app-eselect/eselect-bashcomp"
  17. DEPEND="app-arch/xz-utils"
  18. PDEPEND=">=app-shells/gentoo-bashcomp-20140911"
  19. # Remove unwanted completions.
  20. STRIP_COMPLETIONS=(
  21. # Slackware package stuff, quite generic names cause collisions
  22. # (e.g. with sys-apps/pacman)
  23. explodepkg installpkg makepkg pkgtool removepkg upgradepkg
  24. # Debian/Red Hat network stuff
  25. ifdown ifup ifstatus
  26. # Installed in app-editors/vim-core
  27. xxd
  28. # Now-dead symlinks to deprecated completions
  29. hd ncal
  30. # Installed by sys-apps/util-linux-2.28
  31. mount umount mount.linux umount.linux
  32. # Dumb symlink to mplayer, removed upstream in git
  33. mpv
  34. )
  35. src_prepare() {
  36. eapply "${WORKDIR}/${BASHCOMP_P}/${PN}"-2.1_p*.patch
  37. # Bug 543100
  38. eapply "${FILESDIR}/${PN}-2.1-escape-characters.patch"
  39. eapply_user
  40. }
  41. src_test() { :; } # Skip testsuite because of interactive shell wrt #477066
  42. src_install() {
  43. # work-around race conditions, bug #526996
  44. mkdir -p "${ED}"/usr/share/bash-completion/{completions,helpers} || die
  45. emake DESTDIR="${D}" profiledir="${EPREFIX}"/etc/bash/bashrc.d install
  46. local file
  47. for file in "${STRIP_COMPLETIONS[@]}"; do
  48. rm "${ED}"/usr/share/bash-completion/completions/${file} || die
  49. done
  50. # remove deprecated completions (moved to other packages)
  51. rm "${ED}"/usr/share/bash-completion/completions/_* || die
  52. dodoc AUTHORS CHANGES CONTRIBUTING.md README.md
  53. # install the eselect module
  54. insinto /usr/share/eselect/modules
  55. doins "${WORKDIR}/${BASHCOMP_P}/bashcomp.eselect"
  56. doman "${WORKDIR}/${BASHCOMP_P}/bashcomp.eselect.5"
  57. }
  58. pkg_postinst() {
  59. local v
  60. for v in ${REPLACING_VERSIONS}; do
  61. if ! version_is_at_least 2.1-r90 ${v}; then
  62. ewarn "For bash-completion autoloader to work, all completions need to"
  63. ewarn "be installed in /usr/share/bash-completion/completions. You may"
  64. ewarn "need to rebuild packages that installed completions in the old"
  65. ewarn "location. You can do this using:"
  66. ewarn
  67. ewarn "$ find ${EPREFIX}/usr/share/bash-completion -maxdepth 1 -type f '!' -name 'bash_completion' -exec emerge -1v {} +"
  68. ewarn
  69. ewarn "After the rebuild, you should remove the old setup symlinks:"
  70. ewarn
  71. ewarn "$ find ${EPREFIX}/etc/bash_completion.d -type l -delete"
  72. fi
  73. done
  74. if has_version 'app-shells/zsh'; then
  75. elog
  76. elog "If you are interested in using the provided bash completion functions with"
  77. elog "zsh, valuable tips on the effective use of bashcompinit are available:"
  78. elog " http://www.zsh.org/mla/workers/2003/msg00046.html"
  79. elog
  80. fi
  81. }