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

Contents of /eclass/vim-doc.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download)
Wed Jul 30 18:53:54 2003 UTC (11 years, 3 months ago) by agriffis
Branch: MAIN
Changes since 1.1: +5 -5 lines
prevent warning on first install of vim-core

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.1 2003/07/30 18:47:06 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" -a $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" &&
41 $(find "$d" | wc -l | awk '{print $1}') = 3 ]]; then
42 # /usr/share/vim/vim61
43 # /usr/share/vim/vim61/doc
44 # /usr/share/vim/vim61/doc/tags
45 einfo "Removing $d"
46 rm -r "$d"
47 continue
48 fi
49
50 # Re-create / install new links
51 if [[ -d $vimfiles/doc ]]; then
52 ln -s $vimfiles/doc/*.txt $d/doc 2>/dev/null
53 fi
54
55 # Update tags; need a vim binary for this
56 if [[ -n "$vim" ]]; then
57 einfo "Updating documentation tags in $d"
58 DISPLAY= $vim -u NONE -U NONE -T xterm -X -n -f \
59 '+set nobackup nomore' \
60 "+helptags $d/doc" \
61 '+qa!' </dev/null &>/dev/null
62 fi
63 done
64 }

  ViewVC Help
Powered by ViewVC 1.1.20