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