Gentoo Archives: gentoo-dev

From: Anna Vyalkova <cyber+gentoo@×××××.in>
To: gentoo-dev@l.g.o
Cc: vim@g.o, Thomas Bracht Laumann Jespersen <t@×××××××.xyz>
Subject: [gentoo-dev] [PATCH v4 1/9] vim-doc.eclass: support EAPI 8
Date: Thu, 07 Apr 2022 12:02:00
Message-Id: 20220407120116.12893-2-cyber+gentoo@sysrq.in
In Reply to: [gentoo-dev] [PATCH v4 0/9] Vim eclasses by Anna Vyalkova
1 From: Thomas Bracht Laumann Jespersen <t@×××××××.xyz>
2
3 Signed-off-by: Thomas Bracht Laumann Jespersen <t@×××××××.xyz>
4 Signed-off-by: Anna Vyalkova <cyber+gentoo@×××××.in>
5 ---
6 eclass/vim-doc.eclass | 48 ++++++++++++++++++++++---------------------
7 1 file changed, 25 insertions(+), 23 deletions(-)
8
9 diff --git a/eclass/vim-doc.eclass b/eclass/vim-doc.eclass
10 index ba9d00f4f5..be66d6159a 100644
11 --- a/eclass/vim-doc.eclass
12 +++ b/eclass/vim-doc.eclass
13 @@ -1,10 +1,10 @@
14 -# Copyright 1999-2021 Gentoo Authors
15 +# Copyright 1999-2022 Gentoo Authors
16 # Distributed under the terms of the GNU General Public License v2
17
18 # @ECLASS: vim-doc.eclass
19 # @MAINTAINER:
20 # vim@g.o
21 -# @SUPPORTED_EAPIS: 6 7
22 +# @SUPPORTED_EAPIS: 6 7 8
23 # @BLURB: Eclass for vim{,-plugin}.eclass to update documentation tags.
24 # @DESCRIPTION:
25 # This eclass is used by vim.eclass and vim-plugin.eclass to update
26 @@ -16,13 +16,12 @@
27 # DEPEND in vim-plugin or by whatever version of vim is being
28 # installed by the eclass.
29
30 -case ${EAPI:-0} in
31 - [67]) ;;
32 +case ${EAPI} in
33 + 6|7|8) ;;
34 *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
35 esac
36
37 -if [[ -z ${_VIM_DOC_ECLASS} ]] ; then
38 -_VIM_DOC_ECLASS=1
39 +if [[ ! ${_VIM_DOC_ECLASS} ]] ; then
40
41 update_vim_helptags() {
42 local vimfiles vim d s
43 @@ -30,12 +29,12 @@ update_vim_helptags() {
44 # This is where vim plugins are installed
45 vimfiles="${EROOT}"/usr/share/vim/vimfiles
46
47 - if [[ $PN != vim-core ]]; then
48 + if [[ ${PN} != vim-core ]]; then
49 # Find a suitable vim binary for updating tags :helptags
50 vim=$(type -P vim 2>/dev/null)
51 - [[ -z "$vim" ]] && vim=$(type -P gvim 2>/dev/null)
52 - [[ -z "$vim" ]] && vim=$(type -P kvim 2>/dev/null)
53 - if [[ -z "$vim" ]]; then
54 + [[ -z "${vim}" ]] && vim=$(type -P gvim 2>/dev/null)
55 + [[ -z "${vim}" ]] && vim=$(type -P kvim 2>/dev/null)
56 + if [[ -z "${vim}" ]]; then
57 ewarn "No suitable vim binary to rebuild documentation tags"
58 fi
59 fi
60 @@ -43,39 +42,41 @@ update_vim_helptags() {
61 # Make vim not try to connect to X. See :help gui-x11-start
62 # in vim for how this evil trickery works.
63 if [[ -n "${vim}" ]] ; then
64 - ln -s "${vim}" "${T}/tagvim"
65 + ln -s "${vim}" "${T}/tagvim" || die
66 vim="${T}/tagvim"
67 fi
68
69 # Install the documentation symlinks into the versioned vim
70 # directory and run :helptags
71 for d in "${EROOT%/}"/usr/share/vim/vim[0-9]*; do
72 - [[ -d "$d/doc" ]] || continue # catch a failed glob
73 + [[ -d "${d}/doc" ]] || continue # catch a failed glob
74
75 # Remove links, and possibly remove stale dirs
76 - find $d/doc -name \*.txt -type l | while read s; do
77 - [[ $(readlink "$s") = $vimfiles/* ]] && rm -f "$s"
78 + find ${d}/doc -name \*.txt -type l | while read s; do
79 + if [[ $(readlink "${s}") = $vimfiles/* ]]; then
80 + rm -f "${s}" || die
81 + fi
82 done
83 - if [[ -f "$d/doc/tags" && $(find "$d" | wc -l | tr -d ' ') = 3 ]]; then
84 + if [[ -f "${d}/doc/tags" && $(find "${d}" | wc -l | tr -d ' ') = 3 ]]; then
85 # /usr/share/vim/vim61
86 # /usr/share/vim/vim61/doc
87 # /usr/share/vim/vim61/doc/tags
88 - einfo "Removing $d"
89 - rm -r "$d"
90 + einfo "Removing ${d}"
91 + rm -r "${d}" || die
92 continue
93 fi
94
95 # Re-create / install new links
96 - if [[ -d $vimfiles/doc ]]; then
97 - ln -s $vimfiles/doc/*.txt $d/doc 2>/dev/null
98 + if [[ -d "${vimfiles}"/doc ]]; then
99 + ln -s "${vimfiles}"/doc/*.txt "${d}/doc" 2>/dev/null
100 fi
101
102 # Update tags; need a vim binary for this
103 - if [[ -n "$vim" ]]; then
104 - einfo "Updating documentation tags in $d"
105 - DISPLAY= $vim -u NONE -U NONE -T xterm -X -n -f \
106 + if [[ -n "${vim}" ]]; then
107 + einfo "Updating documentation tags in ${d}"
108 + DISPLAY= "${vim}" -u NONE -U NONE -T xterm -X -n -f \
109 '+set nobackup nomore' \
110 - "+helptags $d/doc" \
111 + "+helptags ${d}/doc" \
112 '+qa!' </dev/null &>/dev/null
113 fi
114 done
115 @@ -83,4 +84,5 @@ update_vim_helptags() {
116 [[ -n "${vim}" && -f "${vim}" ]] && rm "${vim}"
117 }
118
119 +_VIM_DOC_ECLASS=1
120 fi
121 --
122 2.35.1