1 |
commit: 3c7ff5b0a5a073956e153ce8a3eb8e1d80a1d44d |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Nov 29 12:27:05 2016 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Nov 29 12:37:01 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=3c7ff5b0 |
7 |
|
8 |
app-shells/bash-completion: Fix unquoted ~ in readline patch, #601194 |
9 |
|
10 |
.../bash-completion/bash-completion-2.4-r1.ebuild | 99 ++++++++++++++++++++++ |
11 |
.../bash-completion-2.1-escape-characters-r1.patch | 27 ++++++ |
12 |
2 files changed, 126 insertions(+) |
13 |
|
14 |
diff --git a/app-shells/bash-completion/bash-completion-2.4-r1.ebuild b/app-shells/bash-completion/bash-completion-2.4-r1.ebuild |
15 |
new file mode 100644 |
16 |
index 00000000..bb6f5ed |
17 |
--- /dev/null |
18 |
+++ b/app-shells/bash-completion/bash-completion-2.4-r1.ebuild |
19 |
@@ -0,0 +1,99 @@ |
20 |
+# Copyright 1999-2016 Gentoo Foundation |
21 |
+# Distributed under the terms of the GNU General Public License v2 |
22 |
+# $Id$ |
23 |
+ |
24 |
+EAPI=6 |
25 |
+ |
26 |
+BASHCOMP_P=bashcomp-2.0.2 |
27 |
+inherit versionator |
28 |
+ |
29 |
+DESCRIPTION="Programmable Completion for bash" |
30 |
+HOMEPAGE="https://github.com/scop/bash-completion" |
31 |
+SRC_URI="https://github.com/scop/bash-completion/releases/download/${PV}/${P}.tar.xz |
32 |
+ https://bitbucket.org/mgorny/bashcomp2/downloads/${BASHCOMP_P}.tar.gz" |
33 |
+ |
34 |
+LICENSE="GPL-2" |
35 |
+SLOT="0" |
36 |
+KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~s390 ~sh ~sparc ~x86 ~amd64-fbsd ~sparc-fbsd ~x86-fbsd ~x86-interix ~amd64-linux ~ia64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris" |
37 |
+IUSE="" |
38 |
+ |
39 |
+RDEPEND=">=app-shells/bash-4.3_p30-r1 |
40 |
+ sys-apps/miscfiles |
41 |
+ !app-eselect/eselect-bashcomp" |
42 |
+DEPEND="app-arch/xz-utils" |
43 |
+PDEPEND=">=app-shells/gentoo-bashcomp-20140911" |
44 |
+ |
45 |
+# Remove unwanted completions. |
46 |
+STRIP_COMPLETIONS=( |
47 |
+ # Slackware package stuff, quite generic names cause collisions |
48 |
+ # (e.g. with sys-apps/pacman) |
49 |
+ explodepkg installpkg makepkg pkgtool removepkg upgradepkg |
50 |
+ |
51 |
+ # Debian/Red Hat network stuff |
52 |
+ ifdown ifup ifstatus |
53 |
+ |
54 |
+ # Installed in app-editors/vim-core |
55 |
+ xxd |
56 |
+ |
57 |
+ # Now-dead symlinks to deprecated completions |
58 |
+ hd ncal |
59 |
+ |
60 |
+ # Installed by sys-apps/util-linux-2.28 |
61 |
+ mount umount mount.linux umount.linux |
62 |
+) |
63 |
+ |
64 |
+src_prepare() { |
65 |
+ eapply "${WORKDIR}/${BASHCOMP_P}/${PN}"-2.1_p*.patch |
66 |
+ # Bug 543100, update bug 601194 |
67 |
+ eapply "${FILESDIR}/${PN}-2.1-escape-characters-r1.patch" |
68 |
+ eapply_user |
69 |
+} |
70 |
+ |
71 |
+src_test() { :; } # Skip testsuite because of interactive shell wrt #477066 |
72 |
+ |
73 |
+src_install() { |
74 |
+ # work-around race conditions, bug #526996 |
75 |
+ mkdir -p "${ED}"/usr/share/bash-completion/{completions,helpers} || die |
76 |
+ |
77 |
+ emake DESTDIR="${D}" profiledir="${EPREFIX}"/etc/bash/bashrc.d install |
78 |
+ |
79 |
+ local file |
80 |
+ for file in "${STRIP_COMPLETIONS[@]}"; do |
81 |
+ rm "${ED}"/usr/share/bash-completion/completions/${file} || die |
82 |
+ done |
83 |
+ # remove deprecated completions (moved to other packages) |
84 |
+ rm "${ED}"/usr/share/bash-completion/completions/_* || die |
85 |
+ |
86 |
+ dodoc AUTHORS CHANGES CONTRIBUTING.md README.md |
87 |
+ |
88 |
+ # install the eselect module |
89 |
+ insinto /usr/share/eselect/modules |
90 |
+ doins "${WORKDIR}/${BASHCOMP_P}/bashcomp.eselect" |
91 |
+ doman "${WORKDIR}/${BASHCOMP_P}/bashcomp.eselect.5" |
92 |
+} |
93 |
+ |
94 |
+pkg_postinst() { |
95 |
+ local v |
96 |
+ for v in ${REPLACING_VERSIONS}; do |
97 |
+ if ! version_is_at_least 2.1-r90 ${v}; then |
98 |
+ ewarn "For bash-completion autoloader to work, all completions need to" |
99 |
+ ewarn "be installed in /usr/share/bash-completion/completions. You may" |
100 |
+ ewarn "need to rebuild packages that installed completions in the old" |
101 |
+ ewarn "location. You can do this using:" |
102 |
+ ewarn |
103 |
+ ewarn "$ find ${EPREFIX}/usr/share/bash-completion -maxdepth 1 -type f '!' -name 'bash_completion' -exec emerge -1v {} +" |
104 |
+ ewarn |
105 |
+ ewarn "After the rebuild, you should remove the old setup symlinks:" |
106 |
+ ewarn |
107 |
+ ewarn "$ find ${EPREFIX}/etc/bash_completion.d -type l -delete" |
108 |
+ fi |
109 |
+ done |
110 |
+ |
111 |
+ if has_version 'app-shells/zsh'; then |
112 |
+ elog |
113 |
+ elog "If you are interested in using the provided bash completion functions with" |
114 |
+ elog "zsh, valuable tips on the effective use of bashcompinit are available:" |
115 |
+ elog " http://www.zsh.org/mla/workers/2003/msg00046.html" |
116 |
+ elog |
117 |
+ fi |
118 |
+} |
119 |
|
120 |
diff --git a/app-shells/bash-completion/files/bash-completion-2.1-escape-characters-r1.patch b/app-shells/bash-completion/files/bash-completion-2.1-escape-characters-r1.patch |
121 |
new file mode 100644 |
122 |
index 00000000..27a8550 |
123 |
--- /dev/null |
124 |
+++ b/app-shells/bash-completion/files/bash-completion-2.1-escape-characters-r1.patch |
125 |
@@ -0,0 +1,27 @@ |
126 |
+--- bash-completion-2.1/bash_completion.orig 2014-03-09 17:38:14 +0000 |
127 |
++++ bash-completion-2.1/bash_completion 2014-03-13 23:26:44 +0000 |
128 |
+@@ -536,13 +536,23 @@ |
129 |
+ # @param $2 Name of variable to return result to |
130 |
+ _quote_readline_by_ref() |
131 |
+ { |
132 |
+- if [[ $1 == \'* ]]; then |
133 |
++ if [ -z "$1" ]; then |
134 |
++ # avoid quoting if empty |
135 |
++ printf -v $2 %s "$1" |
136 |
++ elif [[ $1 == \'* ]]; then |
137 |
+ # Leave out first character |
138 |
+ printf -v $2 %s "${1:1}" |
139 |
++ elif [[ $1 == \~* ]]; then |
140 |
++ # avoid escaping first ~ |
141 |
++ printf -v $2 \~%q "${1:1}" |
142 |
+ else |
143 |
+ printf -v $2 %q "$1" |
144 |
+ fi |
145 |
+ |
146 |
++ # Replace double escaping ( \\ ) by single ( \ ) |
147 |
++ # This happens always when argument is already escaped at cmdline, |
148 |
++ # and passed to this function as e.g.: file\ with\ spaces |
149 |
++ [[ ${!2} == *\\* ]] && printf -v $2 %s "${1//\\\\/\\}" |
150 |
+ # If result becomes quoted like this: $'string', re-evaluate in order to |
151 |
+ # drop the additional quoting. See also: http://www.mail-archive.com/ |
152 |
+ # bash-completion-devel@×××××××××××××××××××.org/msg01942.html |