Gentoo Archives: gentoo-dev

From: Anna Vyalkova <cyber+gentoo@×××××.in>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: support EAPI 8
Date: Thu, 07 Apr 2022 23:09:04
Message-Id: Yk9vAbhTci1g9Hvg@sysrq.in
In Reply to: Re: [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: support EAPI 8 by Sam James
1 On 2022-04-07 23:51, Sam James wrote:
2 > > On 7 Apr 2022, at 13:01, Anna Vyalkova <cyber+gentoo@×××××.in> wrote:
3 > >
4 > > From: Thomas Bracht Laumann Jespersen <t@×××××××.xyz>
5 > >
6 > > * Drop EAPI 0, 1, 2 workarounds
7 > > * Move EXPORT_FUNCTIONS to end of file
8 > > * Add required @USAGE on functions
9 > > * Add _VIM_PLUGIN_ECLASS guard
10 > >
11 > > Bug: https://bugs.gentoo.org/830867
12 > > Bug: https://bugs.gentoo.org/830866
13 > > Signed-off-by: Thomas Bracht Laumann Jespersen <t@×××××××.xyz>
14 > > Signed-off-by: Anna Vyalkova <cyber+gentoo@×××××.in>
15 > > ---
16 > > eclass/vim-plugin.eclass | 28 +++++++++++++++++-----------
17 > > 1 file changed, 17 insertions(+), 11 deletions(-)
18 > >
19 > > diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
20 > > index 50e727e98f..0ee4ebe374 100644
21 > > --- a/eclass/vim-plugin.eclass
22 > > +++ b/eclass/vim-plugin.eclass
23 > > @@ -1,10 +1,10 @@
24 > > -# Copyright 1999-2021 Gentoo Authors
25 > > +# Copyright 1999-2022 Gentoo Authors
26 > > # Distributed under the terms of the GNU General Public License v2
27 > >
28 > > # @ECLASS: vim-plugin.eclass
29 > > # @MAINTAINER:
30 > > # vim@g.o
31 > > -# @SUPPORTED_EAPIS: 6 7
32 > > +# @SUPPORTED_EAPIS: 6 7 8
33 > > # @BLURB: used for installing vim plugins
34 > > # @DESCRIPTION:
35 > > # This eclass simplifies installation of app-vim plugins into
36 > > @@ -13,12 +13,13 @@
37 > > # documentation, for which we make a special case via vim-doc.eclass.
38 > >
39 > > case ${EAPI} in
40 > > - 6|7);;
41 > > - *) die "EAPI ${EAPI:-0} unsupported (too old)";;
42 > > + 6|7|8);;
43 > > + *) die "${ECLASS}: EAPI ${EAPI:-0} unsupported (too old)";;
44 > > esac
45 > >
46 > > +if [[ ! ${_VIM_PLUGIN_ECLASS} ]]; then
47 > > +
48 > > inherit vim-doc
49 > > -EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
50 > >
51 > > VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}"
52 > >
53 > > @@ -32,13 +33,13 @@ fi
54 > > SLOT="0"
55 > >
56 > > # @FUNCTION: vim-plugin_src_install
57 > > +# @USAGE:
58 > > # @DESCRIPTION:
59 > > # Overrides the default src_install phase. In order, this function:
60 > > # * fixes file permission across all files in ${S}.
61 > > # * installs help and documentation files.
62 > > # * installs all files in "${ED}"/usr/share/vim/vimfiles.
63 > > vim-plugin_src_install() {
64 > > - has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
65 > >
66 > > # Install non-vim-help-docs
67 > > einstalldocs
68 > > @@ -53,6 +54,7 @@ vim-plugin_src_install() {
69 > > }
70 > >
71 >
72 > Drop the now-blank line at start of function.
73 >
74 > > # @FUNCTION: vim-plugin_pkg_postinst
75 > > +# @USAGE:
76 > > # @DESCRIPTION:
77 > > # Overrides the pkg_postinst phase for this eclass.
78 > > # The following functions are called:
79 > > @@ -71,7 +73,6 @@ vim-plugin_pkg_postinst() {
80 > > # This function calls the update_vim_helptags and update_vim_afterscripts
81 > > # functions and eventually removes a bunch of empty directories.
82 > > vim-plugin_pkg_postrm() {
83 > > - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
84 > > update_vim_helptags # from vim-doc
85 > > update_vim_afterscripts # see below
86 > >
87 >
88 > I'd fix the indentation (i.e. don't, just use a space) on the comment, but not a big deal.
89 >
90 > > @@ -82,25 +83,24 @@ vim-plugin_pkg_postrm() {
91 > > }
92 > >
93 > > # @FUNCTION: update_vim_afterscripts
94 > > +# @USAGE:
95 > > # @DESCRIPTION:
96 > > # Creates scripts in /usr/share/vim/vimfiles/after/*
97 > > # comprised of the snippets in /usr/share/vim/vimfiles/after/*/*.d
98 > > update_vim_afterscripts() {
99 > > - has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
100 > > - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
101 > > local d f afterdir="${EROOT}"/usr/share/vim/vimfiles/after
102 > >
103 > > # Nothing to do if the dir isn't there
104 > > [ -d "${afterdir}" ] || return 0
105 >
106 > Bash tests.
107 >
108 > >
109 > > - einfo "Updating scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
110 > > + einfo "Updating scripts in ${afterdir}"
111 > > find "${afterdir}" -type d -name \*.vim.d | while read d; do
112 > > echo '" Generated by update_vim_afterscripts' > "${d%.d}" || die
113 > > find "${d}" -name \*.vim -type f -maxdepth 1 -print0 | sort -z | \
114 > > xargs -0 cat >> "${d%.d}" || die "update_vim_afterscripts failed"
115 > > done
116 > >
117 > > - einfo "Removing dead scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
118 > > + einfo "Removing dead scripts in ${afterdir}"
119 > > find "${afterdir}" -type f -name \*.vim | \
120 > > while read f; do
121 > > [[ "$(head -n 1 ${f})" == '" Generated by update_vim_afterscripts' ]] \
122 > > @@ -115,6 +115,7 @@ update_vim_afterscripts() {
123 > > }
124 > >
125 > > # @FUNCTION: display_vim_plugin_help
126 > > +# @USAGE:
127 > > # @DESCRIPTION:
128 > > # Displays a message with the plugin's help file if one is available. Uses the
129 > > # VIM_PLUGIN_HELPFILES env var. If multiple help files are available, they
130 > > @@ -160,3 +161,8 @@ display_vim_plugin_help() {
131 > > fi
132 > > fi
133 > > }
134 > > +
135 > > +_VIM_PLUGIN_ECLASS=1
136 > > +fi
137 > > +
138 > > +EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
139 > > --
140 > > 2.35.1
141
142 Thanks for the feedback, fixed in the PR. Should I send v5?