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