1 |
Hi Patrice, |
2 |
|
3 |
No problem, thanks for looking at it. I'll get on the #gentoo-vim IRC |
4 |
channel to discuss things. |
5 |
|
6 |
I don't have any issues with the review, but I'm debating whether it's a |
7 |
better idea to use a USE_EXPAND for vim implementations or maybe a |
8 |
virtual?, and then iterate through those and install to the appropriate |
9 |
runtime directories -- this was just the simplest and least destructive |
10 |
implementation I could think of to get the packages in app-vim working |
11 |
on neovim. (and make it easy to replace |
12 |
`insinto /usr/share/vim/vimfiles` with `insinto $(vimfiles_directory)` |
13 |
for packages that include vim syntax.) |
14 |
|
15 |
On Sat, Sep 09, 2017 at 10:32:56PM +0200, Patrice Clement wrote: |
16 |
> Hi Aric |
17 |
> |
18 |
> Thanks a lot for your patch. |
19 |
> |
20 |
> We ran a quick survey the other day and found out the Gentoo Vim team is |
21 |
> basically just radhermit and myself at the moment. Please bear with us if it |
22 |
> takes some time to get back to you with clear answers. |
23 |
> |
24 |
> I have reviewed your code over at: |
25 |
> https://github.com/lluixhi/gentoo/commit/cf191a3df28b16a479c1670ce4a6c1dcdbe8846b |
26 |
> |
27 |
> Please have a look at my reviews and let me know. |
28 |
> |
29 |
> I have recently joined the #gentoo-vim IRC channel. Feel free to drop in and |
30 |
> talk to me and/or other people in the channel. IRC is in my opinion easier to |
31 |
> discuss and talk about code and you'll get feedback quicker than over email. |
32 |
> |
33 |
> Cheers |
34 |
> |
35 |
> Friday 08 Sep 2017 15:27:24, Aric Belsito wrote : |
36 |
> > This is really messy at the moment because I'm not sure whether the vim |
37 |
> > team is interested, and I didn't want to put in the effort if it's just |
38 |
> > going to be rejected, but I'm posting what I have here to start some |
39 |
> > kind of discussion. |
40 |
> > |
41 |
> > At the moment functions/other things need to be described, among other |
42 |
> > issues. I have not yet tested to see if everything is still working with |
43 |
> > vim, though I believe it works with neovim. |
44 |
> > |
45 |
> > I'm also adding a patch file for vim-plugin.eclass, vim-doc.eclass and |
46 |
> > vim-spell.eclass |
47 |
> > |
48 |
> > I have a bug open on the bugtracker as well: |
49 |
> > https://bugs.gentoo.org/612644 |
50 |
> > |
51 |
> > -- |
52 |
> > Aric Belsito |
53 |
> |
54 |
> > From 08411b7ade20df1138c28b9a70679b7acf350f87 Mon Sep 17 00:00:00 2001 |
55 |
> > From: Aric Belsito <lluixhi@×××××.com> |
56 |
> > Date: Tue, 5 Sep 2017 14:21:08 -0700 |
57 |
> > Subject: [PATCH] vim-runtime.eclass: new eclass |
58 |
> > |
59 |
> > Gentoo-Bug: https://bugs.gentoo.org/612644 |
60 |
> > --- |
61 |
> > eclass/vim-doc.eclass | 40 ++++++++++++++++++++++++---------------- |
62 |
> > eclass/vim-plugin.eclass | 31 +++++++++++++------------------ |
63 |
> > eclass/vim-spell.eclass | 8 ++------ |
64 |
> > 4 files changed, 39 insertions(+), 40 deletions(-) |
65 |
> > create mode 100644 eclass/vim-runtime.eclass |
66 |
> > |
67 |
> > diff --git a/eclass/vim-doc.eclass b/eclass/vim-doc.eclass |
68 |
> > index 5f281eba25f2..c4fa9ed22a44 100644 |
69 |
> > --- a/eclass/vim-doc.eclass |
70 |
> > +++ b/eclass/vim-doc.eclass |
71 |
> > @@ -1,4 +1,4 @@ |
72 |
> > -# Copyright 1999-2011 Gentoo Foundation |
73 |
> > +# Copyright 1999-2017 Gentoo Foundation |
74 |
> > # Distributed under the terms of the GNU General Public License v2 |
75 |
> > # |
76 |
> > # This eclass is used by vim.eclass and vim-plugin.eclass to update |
77 |
> > @@ -10,22 +10,28 @@ |
78 |
> > # DEPEND in vim-plugin or by whatever version of vim is being |
79 |
> > # installed by the eclass. |
80 |
> > |
81 |
> > +inherit vim-runtime |
82 |
> > + |
83 |
> > +run_helptags() { |
84 |
> > + # Update tags; need a vim binary for this |
85 |
> > + if [[ -n "$1" ]]; then |
86 |
> > + einfo "Updating documentation tags in $2" |
87 |
> > + DISPLAY= $1 -u NONE -n \ |
88 |
> > + '+set nobackup nomore' \ |
89 |
> > + "+helptags $2/doc" \ |
90 |
> > + '+qa!' </dev/null &>/dev/null |
91 |
> > + fi |
92 |
> > +} |
93 |
> > |
94 |
> > update_vim_helptags() { |
95 |
> > has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}" |
96 |
> > local vimfiles vim d s |
97 |
> > |
98 |
> > # This is where vim plugins are installed |
99 |
> > - vimfiles="${EROOT}"/usr/share/vim/vimfiles |
100 |
> > + vimfiles="${EPREFIX}$(vimfiles_directory)" |
101 |
> > |
102 |
> > if [[ $PN != vim-core ]]; then |
103 |
> > - # Find a suitable vim binary for updating tags :helptags |
104 |
> > - vim=$(type -P vim 2>/dev/null) |
105 |
> > - [[ -z "$vim" ]] && vim=$(type -P gvim 2>/dev/null) |
106 |
> > - [[ -z "$vim" ]] && vim=$(type -P kvim 2>/dev/null) |
107 |
> > - if [[ -z "$vim" ]]; then |
108 |
> > - ewarn "No suitable vim binary to rebuild documentation tags" |
109 |
> > - fi |
110 |
> > + vim="$(vim_binary)" |
111 |
> > fi |
112 |
> > |
113 |
> > # Make vim not try to connect to X. See :help gui-x11-start |
114 |
> > @@ -59,14 +65,16 @@ update_vim_helptags() { |
115 |
> > fi |
116 |
> > |
117 |
> > # Update tags; need a vim binary for this |
118 |
> > - if [[ -n "$vim" ]]; then |
119 |
> > - einfo "Updating documentation tags in $d" |
120 |
> > - DISPLAY= $vim -u NONE -U NONE -T xterm -X -n -f \ |
121 |
> > - '+set nobackup nomore' \ |
122 |
> > - "+helptags $d/doc" \ |
123 |
> > - '+qa!' </dev/null &>/dev/null |
124 |
> > - fi |
125 |
> > + run_helptags $vim $d |
126 |
> > done |
127 |
> > |
128 |
> > + # For neovim, just run :helptags on the tag directory |
129 |
> > + if use nvim ; then |
130 |
> > + [[ -d $vimfiles/doc ]] || break |
131 |
> > + |
132 |
> > + # Update tags; need a vim binary for this |
133 |
> > + run_helptags $vim $vimfiles |
134 |
> > + fi |
135 |
> > + |
136 |
> > [[ -n "${vim}" && -f "${vim}" ]] && rm "${vim}" |
137 |
> > } |
138 |
> > diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass |
139 |
> > index cdc24a15cf6f..f99693aeeb11 100644 |
140 |
> > --- a/eclass/vim-plugin.eclass |
141 |
> > +++ b/eclass/vim-plugin.eclass |
142 |
> > @@ -1,4 +1,4 @@ |
143 |
> > -# Copyright 1999-2016 Gentoo Foundation |
144 |
> > +# Copyright 1999-2017 Gentoo Foundation |
145 |
> > # Distributed under the terms of the GNU General Public License v2 |
146 |
> > |
147 |
> > # @ECLASS: vim-plugin.eclass |
148 |
> > @@ -7,18 +7,13 @@ |
149 |
> > # @BLURB: used for installing vim plugins |
150 |
> > # @DESCRIPTION: |
151 |
> > # This eclass simplifies installation of app-vim plugins into |
152 |
> > -# /usr/share/vim/vimfiles. This is a version-independent directory |
153 |
> > +# $(vimfiles_directory). This is a version-independent directory |
154 |
> > # which is read automatically by vim. The only exception is |
155 |
> > # documentation, for which we make a special case via vim-doc.eclass. |
156 |
> > |
157 |
> > -inherit vim-doc |
158 |
> > +inherit vim-doc vim-runtime |
159 |
> > EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm |
160 |
> > |
161 |
> > -VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}" |
162 |
> > - |
163 |
> > -DEPEND="|| ( >=app-editors/vim-${VIM_PLUGIN_VIM_VERSION} |
164 |
> > - >=app-editors/gvim-${VIM_PLUGIN_VIM_VERSION} )" |
165 |
> > -RDEPEND="${DEPEND}" |
166 |
> > if [[ ${PV} != 9999* ]] ; then |
167 |
> > SRC_URI="mirror://gentoo/${P}.tar.bz2 |
168 |
> > https://dev.gentoo.org/~radhermit/vim/${P}.tar.bz2" |
169 |
> > @@ -27,7 +22,7 @@ SLOT="0" |
170 |
> > |
171 |
> > vim-plugin_src_install() { |
172 |
> > has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" |
173 |
> > - local f |
174 |
> > + local f vimfiles="${EPREFIX}$(vimfiles_directory)" |
175 |
> > |
176 |
> > if use !prefix && [[ ${EUID} -eq 0 ]] ; then |
177 |
> > ebegin "Fixing file permissions" |
178 |
> > @@ -59,11 +54,11 @@ vim-plugin_src_install() { |
179 |
> > |
180 |
> > # Install remainder of plugin |
181 |
> > cd "${WORKDIR}" |
182 |
> > - dodir /usr/share/vim |
183 |
> > - mv "${S}" "${ED}"/usr/share/vim/vimfiles |
184 |
> > + dodir "$(dirname $vimfiles)" |
185 |
> > + mv "${S}" "${D%/}$vimfiles" |
186 |
> > |
187 |
> > # Fix remaining bad permissions |
188 |
> > - chmod -R -x+X "${ED}"/usr/share/vim/vimfiles/ || die "chmod failed" |
189 |
> > + chmod -R -x+X "${D%/}$vimfiles" || die "chmod failed" |
190 |
> > } |
191 |
> > |
192 |
> > vim-plugin_pkg_postinst() { |
193 |
> > @@ -79,21 +74,21 @@ vim-plugin_pkg_postrm() { |
194 |
> > |
195 |
> > # Remove empty dirs; this allows |
196 |
> > # /usr/share/vim to be removed if vim-core is unmerged |
197 |
> > - find "${EPREFIX}/usr/share/vim/vimfiles" -depth -type d -exec rmdir {} \; 2>/dev/null |
198 |
> > + find "${EPREFIX}$(vimfiles_directory)" -depth -type d -exec rmdir {} \; 2>/dev/null |
199 |
> > } |
200 |
> > |
201 |
> > # update_vim_afterscripts: create scripts in |
202 |
> > -# /usr/share/vim/vimfiles/after/* comprised of the snippets in |
203 |
> > -# /usr/share/vim/vimfiles/after/*/*.d |
204 |
> > +# $(vimfiles_directory)/after/* comprised of the snippets in |
205 |
> > +# $(vimfiles_directory)/after/*/*.d |
206 |
> > update_vim_afterscripts() { |
207 |
> > has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}" |
208 |
> > has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX= |
209 |
> > - local d f afterdir="${EROOT}"/usr/share/vim/vimfiles/after |
210 |
> > + local d f afterdir="${EPREFIX}$(vimfiles_directory)"/after |
211 |
> > |
212 |
> > # Nothing to do if the dir isn't there |
213 |
> > [ -d "${afterdir}" ] || return 0 |
214 |
> > |
215 |
> > - einfo "Updating scripts in ${EPREFIX}/usr/share/vim/vimfiles/after" |
216 |
> > + einfo "Updating scripts in ${afterdir}" |
217 |
> > find "${afterdir}" -type d -name \*.vim.d | \ |
218 |
> > while read d; do |
219 |
> > echo '" Generated by update_vim_afterscripts' > "${d%.d}" |
220 |
> > @@ -101,7 +96,7 @@ update_vim_afterscripts() { |
221 |
> > sort -z | xargs -0 cat >> "${d%.d}" |
222 |
> > done |
223 |
> > |
224 |
> > - einfo "Removing dead scripts in ${EPREFIX}/usr/share/vim/vimfiles/after" |
225 |
> > + einfo "Removing dead scripts in ${afterdir}" |
226 |
> > find "${afterdir}" -type f -name \*.vim | \ |
227 |
> > while read f; do |
228 |
> > [[ "$(head -n 1 ${f})" == '" Generated by update_vim_afterscripts' ]] \ |
229 |
> > diff --git a/eclass/vim-spell.eclass b/eclass/vim-spell.eclass |
230 |
> > index 2844ea9d995e..5126f8fa19ce 100644 |
231 |
> > --- a/eclass/vim-spell.eclass |
232 |
> > +++ b/eclass/vim-spell.eclass |
233 |
> > @@ -62,14 +62,10 @@ |
234 |
> > # spell files. It's best to let upstream know if you've generated spell files |
235 |
> > # for another language rather than keeping them Gentoo-specific. |
236 |
> > |
237 |
> > -inherit eutils |
238 |
> > +inherit eutils vim-runtime |
239 |
> > |
240 |
> > EXPORT_FUNCTIONS src_install pkg_postinst |
241 |
> > |
242 |
> > -IUSE="" |
243 |
> > -DEPEND="|| ( >=app-editors/vim-7_alpha |
244 |
> > - >=app-editors/gvim-7_alpha )" |
245 |
> > -RDEPEND="${DEPEND}" |
246 |
> > SRC_URI="mirror://gentoo/${P}.tar.bz2" |
247 |
> > SLOT="0" |
248 |
> > |
249 |
> > @@ -91,7 +87,7 @@ SLOT="0" |
250 |
> > # @INTERNAL |
251 |
> > # @DESCRIPTION: |
252 |
> > # This variable defines the path to Vim spell files. |
253 |
> > -: ${VIM_SPELL_DIRECTORY:="${EPREFIX}/usr/share/vim/vimfiles/spell/"} |
254 |
> > +: ${VIM_SPELL_DIRECTORY:="${EPREFIX}$(vimfiles_directory)/spell/"} |
255 |
> > |
256 |
> > # @ECLASS-VARIABLE: DESCRIPTION |
257 |
> > # @DESCRIPTION: |
258 |
> |
259 |
> > # Copyright 1999-2017 Gentoo Foundation |
260 |
> > # Distributed under the terms of the GNU General Public License v2 |
261 |
> > |
262 |
> > # @ECLASS: vim-runtime.eclass |
263 |
> > # @MAINTAINER: |
264 |
> > # vim@g.o |
265 |
> > # @BLURB: used for installing vim plugins |
266 |
> > # @DESCRIPTION: |
267 |
> > # This eclass simplifies installation of app-vim plugins into |
268 |
> > # $(vimfiles_directory). This is a version-independent directory |
269 |
> > # which is read automatically by vim. The only exception is |
270 |
> > # documentation, for which we make a special case via vim-doc.eclass. |
271 |
> > |
272 |
> > # @ECLASS-VARIABLE: VIM_PLUGIN_VIM_VERSION |
273 |
> > # @DESCRIPTION: |
274 |
> > # This variable defines the default vim version for a vim plugin. |
275 |
> > # The default value is "7.3". |
276 |
> > : ${VIM_PLUGIN_VIM_VERSION:=7.3} |
277 |
> > |
278 |
> > IUSE="nvim" |
279 |
> > DEPEND="|| ( |
280 |
> > >=app-editors/vim-${VIM_PLUGIN_VIM_VERSION} |
281 |
> > >=app-editors/gvim-${VIM_PLUGIN_VIM_VERSION} |
282 |
> > app-editors/neovim |
283 |
> > )" |
284 |
> > RDEPEND="${DEPEND}" |
285 |
> > |
286 |
> > vim_binary() { |
287 |
> > # Find a suitable vim binary |
288 |
> > local vim=$(type -P vim 2>/dev/null) |
289 |
> > [[ -z "$vim" ]] && vim=$(type -P gvim 2>/dev/null) |
290 |
> > [[ -z "$vim" ]] && vim=$(type -P nvim 2>/dev/null) |
291 |
> > if [[ -z "$vim" ]]; then |
292 |
> > ewarn "No suitable vim binary found" |
293 |
> > fi |
294 |
> > echo "$vim" |
295 |
> > } |
296 |
> > |
297 |
> > vimfiles_directory() { |
298 |
> > if use nvim ; then |
299 |
> > echo "/usr/share/nvim/runtime" |
300 |
> > else |
301 |
> > echo "/usr/share/vim/vimfiles" |
302 |
> > fi |
303 |
> > } |
304 |
> |
305 |
> |
306 |
> -- |
307 |
> Patrice Clement |
308 |
> Gentoo Linux developer |
309 |
> http://www.gentoo.org |
310 |
> |
311 |
|
312 |
Yeah, the DEPEND part and the `vim_binary` function are not pretty. I |
313 |
pulled them out of the vim-plugin, vim-spell, and vim-doc eclasses and |
314 |
didn't rewrite them. |
315 |
|
316 |
I do know about neovim-qt, but isn't that just a UI that communicates |
317 |
with RPC to a neovim binary? e.g. if you wanted to use a plugin with |
318 |
neovim-qt wouldn't you just install it for neovim? |
319 |
|
320 |
On Sat, Sep 09, 2017 at 06:44:16AM +0700, Vadim A. Misbakh-Soloviov wrote: |
321 |
> DEPENDS part and "binary" function makes me sad panda: |
322 |
> they assumes there are no "vims" exist, while there is at least `vim-qt` |
323 |
> (well, actually that one is dropped from gentoo) and `neovim-qt` (and that one |
324 |
> is in overlays, but anyway), and so on. |
325 |
> |
326 |
> I think, it'd be nice to somehow avoid exact binary names matching (just as |
327 |
> exact package names), or, uhm... make it extendable somehow? |
328 |
> |
329 |
|
330 |
-- |
331 |
Aric Belsito |