Gentoo Archives: gentoo-dev

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

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies

Subject Author
Re: [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: support EAPI 8 Anna Vyalkova <cyber+gentoo@×××××.in>