summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobin H. Johnson <robbat2@gentoo.org>2015-08-08 13:49:04 -0700
committerRobin H. Johnson <robbat2@gentoo.org>2015-08-08 17:38:18 -0700
commit56bd759df1d0c750a065b8c845e93d5dfa6b549d (patch)
tree3f91093cdb475e565ae857f1c5a7fd339e2d781e /eclass/vim-plugin.eclass
downloadgentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.gz
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.tar.bz2
gentoo-56bd759df1d0c750a065b8c845e93d5dfa6b549d.zip
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
Diffstat (limited to 'eclass/vim-plugin.eclass')
-rw-r--r--eclass/vim-plugin.eclass157
1 files changed, 157 insertions, 0 deletions
diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
new file mode 100644
index 000000000000..4da8bd3c9978
--- /dev/null
+++ b/eclass/vim-plugin.eclass
@@ -0,0 +1,157 @@
+# Copyright 1999-2013 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+#
+# This eclass simplifies installation of app-vim plugins into
+# /usr/share/vim/vimfiles. This is a version-independent directory
+# which is read automatically by vim. The only exception is
+# documentation, for which we make a special case via vim-doc.eclass
+
+inherit vim-doc
+EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
+
+VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}"
+
+DEPEND="|| ( >=app-editors/vim-${VIM_PLUGIN_VIM_VERSION}
+ >=app-editors/gvim-${VIM_PLUGIN_VIM_VERSION} )"
+RDEPEND="${DEPEND}"
+if [[ ${PV} != 9999* ]] ; then
+ SRC_URI="mirror://gentoo/${P}.tar.bz2
+ http://dev.gentoo.org/~radhermit/vim/${P}.tar.bz2"
+fi
+SLOT="0"
+
+vim-plugin_src_install() {
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
+ local f
+
+ if use !prefix && [[ ${EUID} -eq 0 ]] ; then
+ ebegin "Fixing file permissions"
+ # Make sure perms are good
+ chmod -R a+rX "${S}" || die "chmod failed"
+ find "${S}" -user 'portage' -exec chown root '{}' \; || die "chown failed"
+ if use userland_BSD || [[ ${CHOST} == *-darwin* ]] ; then
+ find "${S}" -group 'portage' -exec chgrp wheel '{}' \; || die "chgrp failed"
+ else
+ find "${S}" -group 'portage' -exec chgrp root '{}' \; || die "chgrp failed"
+ fi
+ eend $?
+ fi
+
+ # Remove unwanted files that may exist
+ rm -rf .[^.] .??* Makefile*
+
+ # Install non-vim-help-docs
+ cd "${S}"
+ for f in *; do
+ [[ -f "${f}" ]] || continue
+ if [[ "${f}" = *.html ]]; then
+ dohtml "${f}"
+ else
+ dodoc "${f}"
+ fi
+ rm -f "${f}"
+ done
+
+ # Install remainder of plugin
+ cd "${WORKDIR}"
+ dodir /usr/share/vim
+ mv "${S}" "${ED}"/usr/share/vim/vimfiles
+
+ # Fix remaining bad permissions
+ chmod -R -x+X "${ED}"/usr/share/vim/vimfiles/ || die "chmod failed"
+}
+
+vim-plugin_pkg_postinst() {
+ update_vim_helptags # from vim-doc
+ update_vim_afterscripts # see below
+ display_vim_plugin_help # see below
+}
+
+vim-plugin_pkg_postrm() {
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+ update_vim_helptags # from vim-doc
+ update_vim_afterscripts # see below
+
+ # Remove empty dirs; this allows
+ # /usr/share/vim to be removed if vim-core is unmerged
+ find "${EPREFIX}/usr/share/vim/vimfiles" -depth -type d -exec rmdir {} \; 2>/dev/null
+}
+
+# update_vim_afterscripts: create scripts in
+# /usr/share/vim/vimfiles/after/* comprised of the snippets in
+# /usr/share/vim/vimfiles/after/*/*.d
+update_vim_afterscripts() {
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EROOT="${ROOT}"
+ has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
+ local d f afterdir="${EROOT}"/usr/share/vim/vimfiles/after
+
+ # Nothing to do if the dir isn't there
+ [ -d "${afterdir}" ] || return 0
+
+ einfo "Updating scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
+ find "${afterdir}" -type d -name \*.vim.d | \
+ while read d; do
+ echo '" Generated by update_vim_afterscripts' > "${d%.d}"
+ find "${d}" -name \*.vim -type f -maxdepth 1 -print0 | \
+ sort -z | xargs -0 cat >> "${d%.d}"
+ done
+
+ einfo "Removing dead scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
+ find "${afterdir}" -type f -name \*.vim | \
+ while read f; do
+ [[ "$(head -n 1 ${f})" == '" Generated by update_vim_afterscripts' ]] \
+ || continue
+ # This is a generated file, but might be abandoned. Check
+ # if there's no corresponding .d directory, or if the
+ # file's effectively empty
+ if [[ ! -d "${f}.d" || -z "$(grep -v '^"' "${f}")" ]]; then
+ rm -f "${f}"
+ fi
+ done
+}
+
+# Display a message with the plugin's help file if one is available. Uses the
+# VIM_PLUGIN_HELPFILES env var. If multiple help files are available, they
+# should be separated by spaces. If no help files are available, but the env
+# var VIM_PLUGIN_HELPTEXT is set, that is displayed instead. Finally, if we
+# have nothing else, display a link to VIM_PLUGIN_HELPURI. An extra message
+# regarding enabling filetype plugins is displayed if VIM_PLUGIN_MESSAGES
+# includes the word "filetype".
+display_vim_plugin_help() {
+ local h
+
+ if ! has_version ${CATEGORY}/${PN} ; then
+ if [[ -n "${VIM_PLUGIN_HELPFILES}" ]] ; then
+ elog " "
+ elog "This plugin provides documentation via vim's help system. To"
+ elog "view it, use:"
+ for h in ${VIM_PLUGIN_HELPFILES} ; do
+ elog " :help ${h}"
+ done
+ elog " "
+
+ elif [[ -n "${VIM_PLUGIN_HELPTEXT}" ]] ; then
+ elog " "
+ while read h ; do
+ elog "$h"
+ done <<<"${VIM_PLUGIN_HELPTEXT}"
+ elog " "
+
+ elif [[ -n "${VIM_PLUGIN_HELPURI}" ]] ; then
+ elog " "
+ elog "Documentation for this plugin is available online at:"
+ elog " ${VIM_PLUGIN_HELPURI}"
+ elog " "
+ fi
+
+ if has "filetype" "${VIM_PLUGIN_MESSAGES}" ; then
+ elog "This plugin makes use of filetype settings. To enable these,"
+ elog "add lines like:"
+ elog " filetype plugin on"
+ elog " filetype indent on"
+ elog "to your ~/.vimrc file."
+ elog " "
+ fi
+ fi
+}