/[gentoo-x86]/eclass/vim-doc.eclass
Gentoo

Contents of /eclass/vim-doc.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.15 - (hide annotations) (download)
Mon May 14 20:04:07 2007 UTC (7 years, 3 months ago) by pioto
Branch: MAIN
Changes since 1.14: +2 -2 lines
Fix the fix a bit.

1 vapier 1.5 # Copyright 1999-2004 Gentoo Foundation
2 agriffis 1.1 # Distributed under the terms of the GNU General Public License v2
3 pioto 1.15 # $Header: /var/cvsroot/gentoo-x86/eclass/vim-doc.eclass,v 1.14 2007/05/14 19:52:06 pioto Exp $
4 agriffis 1.1 #
5     # This eclass is used by vim.eclass and vim-plugin.eclass to update
6     # the documentation tags. This is necessary since vim doesn't look in
7     # /usr/share/vim/vimfiles/doc for documentation; it only uses the
8     # versioned directory, for example /usr/share/vim/vim62/doc
9     #
10     # We depend on vim being installed, which is satisfied by either the
11     # DEPEND in vim-plugin or by whatever version of vim is being
12     # installed by the eclass.
13    
14    
15     update_vim_helptags() {
16     local vimfiles vim d s
17    
18     # This is where vim plugins are installed
19 pioto 1.11 vimfiles="${ROOT}"/usr/share/vim/vimfiles
20 agriffis 1.1
21 agriffis 1.6 if [[ $PN != vim-core ]]; then
22 ciaranm 1.7 # Find a suitable vim binary for updating tags :helptags
23 pioto 1.13 vim=$(type -P vim 2>/dev/null)
24     [[ -z "$vim" ]] && vim=$(type -P gvim 2>/dev/null)
25     [[ -z "$vim" ]] && vim=$(type -P kvim 2>/dev/null)
26 agriffis 1.6 if [[ -z "$vim" ]]; then
27     ewarn "No suitable vim binary to rebuild documentation tags"
28     fi
29 agriffis 1.1 fi
30    
31 ciaranm 1.10 # Make vim not try to connect to X. See :help gui-x11-start
32     # in vim for how this evil trickery works.
33 pioto 1.14 if [[ -n "${vim}" ]] ; then
34 ciaranm 1.10 ln -s "${vim}" "${T}/tagvim"
35     vim="${T}/tagvim"
36     fi
37    
38 agriffis 1.1 # Install the documentation symlinks into the versioned vim
39     # directory and run :helptags
40 pioto 1.11 for d in "${ROOT}"/usr/share/vim/vim[0-9]*; do
41 agriffis 1.1 [[ -d "$d/doc" ]] || continue # catch a failed glob
42    
43     # Remove links, and possibly remove stale dirs
44     find $d/doc -name \*.txt -type l | while read s; do
45 agriffis 1.6 [[ $(readlink "$s") = $vimfiles/* ]] && rm -f "$s"
46 agriffis 1.1 done
47 agriffis 1.4 if [[ -f "$d/doc/tags" && $(find "$d" | wc -l | tr -d ' ') = 3 ]]; then
48 agriffis 1.1 # /usr/share/vim/vim61
49     # /usr/share/vim/vim61/doc
50     # /usr/share/vim/vim61/doc/tags
51     einfo "Removing $d"
52     rm -r "$d"
53     continue
54     fi
55    
56     # Re-create / install new links
57 agriffis 1.2 if [[ -d $vimfiles/doc ]]; then
58     ln -s $vimfiles/doc/*.txt $d/doc 2>/dev/null
59 agriffis 1.1 fi
60    
61     # Update tags; need a vim binary for this
62     if [[ -n "$vim" ]]; then
63     einfo "Updating documentation tags in $d"
64     DISPLAY= $vim -u NONE -U NONE -T xterm -X -n -f \
65     '+set nobackup nomore' \
66     "+helptags $d/doc" \
67     '+qa!' </dev/null &>/dev/null
68     fi
69     done
70 pioto 1.14
71 pioto 1.15 [[ -n "${vim}" && -f "${vim}" ]] && rm "${vim}"
72 agriffis 1.1 }

  ViewVC Help
Powered by ViewVC 1.1.20