Gentoo Archives: gentoo-commits

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