1 |
Signed-off-by: Anna Vyalkova <cyber+gentoo@×××××.in> |
2 |
--- |
3 |
eclass/vim-doc.eclass | 2 ++ |
4 |
1 file changed, 2 insertions(+) |
5 |
|
6 |
diff --git a/eclass/vim-doc.eclass b/eclass/vim-doc.eclass |
7 |
index f0c5c6edc6..968f4657b6 100644 |
8 |
--- a/eclass/vim-doc.eclass |
9 |
+++ b/eclass/vim-doc.eclass |
10 |
@@ -1,98 +1,100 @@ |
11 |
# Copyright 1999-2022 Gentoo Authors |
12 |
# Distributed under the terms of the GNU General Public License v2 |
13 |
|
14 |
# @ECLASS: vim-doc.eclass |
15 |
# @MAINTAINER: |
16 |
# vim@g.o |
17 |
# @SUPPORTED_EAPIS: 6 7 8 |
18 |
# @BLURB: Eclass for vim{,-plugin}.eclass to update documentation tags. |
19 |
# @DESCRIPTION: |
20 |
# This eclass is used by vim.eclass and vim-plugin.eclass to update |
21 |
# the documentation tags. This is necessary since vim doesn't look in |
22 |
# /usr/share/vim/vimfiles/doc for documentation; it only uses the |
23 |
# versioned directory, for example /usr/share/vim/vim62/doc |
24 |
# |
25 |
# We depend on vim being installed, which is satisfied by either the |
26 |
# DEPEND in vim-plugin or by whatever version of vim is being |
27 |
# installed by the eclass. |
28 |
|
29 |
case ${EAPI} in |
30 |
6|7|8) ;; |
31 |
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; |
32 |
esac |
33 |
|
34 |
if [[ ! ${_VIM_DOC_ECLASS} ]] ; then |
35 |
|
36 |
update_vim_helptags() { |
37 |
+ debug-print-function ${FUNCNAME} "${@}" |
38 |
+ |
39 |
local vimfiles helpfile files vim d |
40 |
|
41 |
# This is where vim plugins are installed |
42 |
vimfiles="${EROOT}"/usr/share/vim/vimfiles |
43 |
|
44 |
if [[ ${PN} != vim-core ]]; then |
45 |
# Find a suitable vim binary for updating tags :helptags |
46 |
vim=$(type -P vim 2>/dev/null) |
47 |
[[ -z "${vim}" ]] && vim=$(type -P gvim 2>/dev/null) |
48 |
[[ -z "${vim}" ]] && vim=$(type -P kvim 2>/dev/null) |
49 |
if [[ -z "${vim}" ]]; then |
50 |
ewarn "No suitable vim binary to rebuild documentation tags" |
51 |
fi |
52 |
fi |
53 |
|
54 |
# Make vim not try to connect to X. See :help gui-x11-start |
55 |
# in vim for how this evil trickery works. |
56 |
if [[ -n "${vim}" ]] ; then |
57 |
ln -s "${vim}" "${T}/tagvim" || die |
58 |
vim="${T}/tagvim" |
59 |
fi |
60 |
|
61 |
# Install the documentation symlinks into the versioned vim |
62 |
# directory and run :helptags |
63 |
for d in "${EROOT%/}"/usr/share/vim/vim[0-9]*; do |
64 |
[[ -d "${d}/doc" ]] || continue # catch a failed glob |
65 |
|
66 |
# Remove links |
67 |
readarray -d '' files < <(find "${d}"/doc -name "*.txt" -type l -print0 || die "cannot traverse ${d}/doc" ) |
68 |
for helpfile in "${files[@]}"; do |
69 |
if [[ $(readlink -f "${helpfile}") == "${vimfiles}"/* ]]; then |
70 |
rm "${helpfile}" || die |
71 |
fi |
72 |
done |
73 |
|
74 |
# Remove stale dirs, if possible |
75 |
readarray -d '' files < <(find "${d}" -print0 || die "cannot traverse ${d}") |
76 |
if [[ -f "${d}/doc/tags" && ${#files[@]} -eq 3 ]]; then |
77 |
# /usr/share/vim/vim61 |
78 |
# /usr/share/vim/vim61/doc |
79 |
# /usr/share/vim/vim61/doc/tags |
80 |
einfo "Removing ${d}" |
81 |
rm -r "${d}" || die |
82 |
continue |
83 |
fi |
84 |
|
85 |
# Re-create / install new links |
86 |
if [[ -d "${vimfiles}"/doc ]]; then |
87 |
for helpfile in "${vimfiles}"/doc/*.txt; do |
88 |
if [[ ! -e "${d}/doc/$(basename "${helpfile}")" ]]; then |
89 |
ln -s "${helpfile}" "${d}/doc" || die |
90 |
fi |
91 |
done |
92 |
fi |
93 |
|
94 |
# Update tags; need a vim binary for this |
95 |
if [[ -n "${vim}" ]]; then |
96 |
einfo "Updating documentation tags in ${d}" |
97 |
DISPLAY= "${vim}" -u NONE -U NONE -T xterm -X -n -f \ |
98 |
'+set nobackup nomore' \ |
99 |
"+helptags ${d}/doc" \ |
100 |
'+qa!' </dev/null &>/dev/null || die |
101 |
fi |
102 |
done |
103 |
|
104 |
if [[ -n "${vim}" && -f "${vim}" ]]; then |
105 |
rm "${vim}" || die |
106 |
fi |
107 |
} |
108 |
|
109 |
_VIM_DOC_ECLASS=1 |
110 |
fi |
111 |
-- |
112 |
2.35.1 |