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

Contents of /eclass/vim-doc.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (show annotations) (download)
Thu Jul 31 00:20:55 2003 UTC (11 years, 4 months ago) by agriffis
Branch: MAIN
Changes since 1.3: +2 -3 lines
exchange awk for tr

1 # Copyright 1999-2003 Gentoo Technologies, Inc.
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /home/cvsroot/gentoo-x86/eclass/vim-doc.eclass,v 1.3 2003/07/30 21:42:57 agriffis Exp $
4 #
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 ECLASS=vim-doc
15 INHERITED="$INHERITED $ECLASS"
16
17 update_vim_helptags() {
18 local vimfiles vim d s
19
20 # This is where vim plugins are installed
21 vimfiles=/usr/share/vim/vimfiles
22
23 # Find a suitable vim binary
24 local vim=`which vim 2>/dev/null`
25 [[ -z "$vim" ]] && vim=`which gvim 2>/dev/null`
26 [[ -z "$vim" ]] && vim=`which kvim 2>/dev/null`
27 if [[ -z "$vim" && $PN != vim-core ]]; then
28 ewarn "No suitable vim binary to rebuild documentation tags"
29 fi
30
31 # Install the documentation symlinks into the versioned vim
32 # directory and run :helptags
33 for d in /usr/share/vim/vim[0-9]*; do
34 [[ -d "$d/doc" ]] || continue # catch a failed glob
35
36 # Remove links, and possibly remove stale dirs
37 find $d/doc -name \*.txt -type l | while read s; do
38 [[ `readlink "$s"` = $vimfiles/* ]] && rm -f "$s"
39 done
40 if [[ -f "$d/doc/tags" && $(find "$d" | wc -l | tr -d ' ') = 3 ]]; then
41 # /usr/share/vim/vim61
42 # /usr/share/vim/vim61/doc
43 # /usr/share/vim/vim61/doc/tags
44 einfo "Removing $d"
45 rm -r "$d"
46 continue
47 fi
48
49 # Re-create / install new links
50 if [[ -d $vimfiles/doc ]]; then
51 ln -s $vimfiles/doc/*.txt $d/doc 2>/dev/null
52 fi
53
54 # Update tags; need a vim binary for this
55 if [[ -n "$vim" ]]; then
56 einfo "Updating documentation tags in $d"
57 DISPLAY= $vim -u NONE -U NONE -T xterm -X -n -f \
58 '+set nobackup nomore' \
59 "+helptags $d/doc" \
60 '+qa!' </dev/null &>/dev/null
61 fi
62 done
63 }

  ViewVC Help
Powered by ViewVC 1.1.20