bash-completion-2.4.ebuild 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  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. )
  33. src_prepare() {
  34. eapply "${WORKDIR}/${BASHCOMP_P}/${PN}"-2.1_p*.patch
  35. # Bug 543100
  36. eapply "${FILESDIR}/${PN}-2.1-escape-characters.patch"
  37. eapply_user
  38. }
  39. src_test() { :; } # Skip testsuite because of interactive shell wrt #477066
  40. src_install() {
  41. # work-around race conditions, bug #526996
  42. mkdir -p "${ED}"/usr/share/bash-completion/{completions,helpers} || die
  43. emake DESTDIR="${D}" profiledir="${EPREFIX}"/etc/bash/bashrc.d install
  44. local file
  45. for file in "${STRIP_COMPLETIONS[@]}"; do
  46. rm "${ED}"/usr/share/bash-completion/completions/${file} || die
  47. done
  48. # remove deprecated completions (moved to other packages)
  49. rm "${ED}"/usr/share/bash-completion/completions/_* || die
  50. dodoc AUTHORS CHANGES CONTRIBUTING.md README.md
  51. # install the eselect module
  52. insinto /usr/share/eselect/modules
  53. doins "${WORKDIR}/${BASHCOMP_P}/bashcomp.eselect"
  54. doman "${WORKDIR}/${BASHCOMP_P}/bashcomp.eselect.5"
  55. }
  56. pkg_postinst() {
  57. local v
  58. for v in ${REPLACING_VERSIONS}; do
  59. if ! version_is_at_least 2.1-r90 ${v}; then
  60. ewarn "For bash-completion autoloader to work, all completions need to"
  61. ewarn "be installed in /usr/share/bash-completion/completions. You may"
  62. ewarn "need to rebuild packages that installed completions in the old"
  63. ewarn "location. You can do this using:"
  64. ewarn
  65. ewarn "$ find ${EPREFIX}/usr/share/bash-completion -maxdepth 1 -type f '!' -name 'bash_completion' -exec emerge -1v {} +"
  66. ewarn
  67. ewarn "After the rebuild, you should remove the old setup symlinks:"
  68. ewarn
  69. ewarn "$ find ${EPREFIX}/etc/bash_completion.d -type l -delete"
  70. fi
  71. done
  72. if has_version 'app-shells/zsh'; then
  73. elog
  74. elog "If you are interested in using the provided bash completion functions with"
  75. elog "zsh, valuable tips on the effective use of bashcompinit are available:"
  76. elog " http://www.zsh.org/mla/workers/2003/msg00046.html"
  77. elog
  78. fi
  79. }