Files
gentoo/eclass/vim-doc.eclass
Robin H. Johnson 56bd759df1 proj/gentoo: Initial commit
This commit represents a new era for Gentoo:
Storing the gentoo-x86 tree in Git, as converted from CVS.

This commit is the start of the NEW history.
Any historical data is intended to be grafted onto this point.

Creation process:
1. Take final CVS checkout snapshot
2. Remove ALL ChangeLog* files
3. Transform all Manifests to thin
4. Remove empty Manifests
5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$
5.1. Do not touch files with -kb/-ko keyword flags.

Signed-off-by: Robin H. Johnson <robbat2@gentoo.org>
X-Thanks: Alec Warner <antarus@gentoo.org> - did the GSoC 2006 migration tests
X-Thanks: Robin H. Johnson <robbat2@gentoo.org> - infra guy, herding this project
X-Thanks: Nguyen Thai Ngoc Duy <pclouds@gentoo.org> - Former Gentoo developer, wrote Git features for the migration
X-Thanks: Brian Harring <ferringb@gentoo.org> - wrote much python to improve cvs2svn
X-Thanks: Rich Freeman <rich0@gentoo.org> - validation scripts
X-Thanks: Patrick Lauer <patrick@gentoo.org> - Gentoo dev, running new 2014 work in migration
X-Thanks: Michał Górny <mgorny@gentoo.org> - scripts, QA, nagging
X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed
2015-08-08 17:38:18 -07:00

74 lines
2.2 KiB
Bash

# Copyright 1999-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$
#
# This eclass is used by vim.eclass and vim-plugin.eclass to update
# the documentation tags. This is necessary since vim doesn't look in
# /usr/share/vim/vimfiles/doc for documentation; it only uses the
# versioned directory, for example /usr/share/vim/vim62/doc
#
# We depend on vim being installed, which is satisfied by either the
# DEPEND in vim-plugin or by whatever version of vim is being
# installed by the eclass.
update_vim_helptags() {
has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
local vimfiles vim d s
# This is where vim plugins are installed
vimfiles="${EROOT}"/usr/share/vim/vimfiles
if [[ $PN != vim-core ]]; then
# Find a suitable vim binary for updating tags :helptags
vim=$(type -P vim 2>/dev/null)
[[ -z "$vim" ]] && vim=$(type -P gvim 2>/dev/null)
[[ -z "$vim" ]] && vim=$(type -P kvim 2>/dev/null)
if [[ -z "$vim" ]]; then
ewarn "No suitable vim binary to rebuild documentation tags"
fi
fi
# Make vim not try to connect to X. See :help gui-x11-start
# in vim for how this evil trickery works.
if [[ -n "${vim}" ]] ; then
ln -s "${vim}" "${T}/tagvim"
vim="${T}/tagvim"
fi
# Install the documentation symlinks into the versioned vim
# directory and run :helptags
for d in "${EROOT%/}"/usr/share/vim/vim[0-9]*; do
[[ -d "$d/doc" ]] || continue # catch a failed glob
# Remove links, and possibly remove stale dirs
find $d/doc -name \*.txt -type l | while read s; do
[[ $(readlink "$s") = $vimfiles/* ]] && rm -f "$s"
done
if [[ -f "$d/doc/tags" && $(find "$d" | wc -l | tr -d ' ') = 3 ]]; then
# /usr/share/vim/vim61
# /usr/share/vim/vim61/doc
# /usr/share/vim/vim61/doc/tags
einfo "Removing $d"
rm -r "$d"
continue
fi
# Re-create / install new links
if [[ -d $vimfiles/doc ]]; then
ln -s $vimfiles/doc/*.txt $d/doc 2>/dev/null
fi
# Update tags; need a vim binary for this
if [[ -n "$vim" ]]; then
einfo "Updating documentation tags in $d"
DISPLAY= $vim -u NONE -U NONE -T xterm -X -n -f \
'+set nobackup nomore' \
"+helptags $d/doc" \
'+qa!' </dev/null &>/dev/null
fi
done
[[ -n "${vim}" && -f "${vim}" ]] && rm "${vim}"
}