mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-16 01:16:59 +02:00
eclass/vim-plugin: Sync with gentoo
It's from gentoo commit d2194b951c8a8fbdce77ccafae4356d44c2a29c7.
This commit is contained in:
parent
c9b5f89903
commit
dd467b2fc1
@ -1,9 +1,10 @@
|
|||||||
# Copyright 1999-2017 Gentoo Foundation
|
# Copyright 1999-2021 Gentoo Authors
|
||||||
# Distributed under the terms of the GNU General Public License v2
|
# Distributed under the terms of the GNU General Public License v2
|
||||||
|
|
||||||
# @ECLASS: vim-plugin.eclass
|
# @ECLASS: vim-plugin.eclass
|
||||||
# @MAINTAINER:
|
# @MAINTAINER:
|
||||||
# vim@gentoo.org
|
# vim@gentoo.org
|
||||||
|
# @SUPPORTED_EAPIS: 6 7
|
||||||
# @BLURB: used for installing vim plugins
|
# @BLURB: used for installing vim plugins
|
||||||
# @DESCRIPTION:
|
# @DESCRIPTION:
|
||||||
# This eclass simplifies installation of app-vim plugins into
|
# This eclass simplifies installation of app-vim plugins into
|
||||||
@ -11,7 +12,12 @@
|
|||||||
# which is read automatically by vim. The only exception is
|
# which is read automatically by vim. The only exception is
|
||||||
# documentation, for which we make a special case via vim-doc.eclass.
|
# documentation, for which we make a special case via vim-doc.eclass.
|
||||||
|
|
||||||
inherit estack vim-doc
|
case ${EAPI} in
|
||||||
|
6|7);;
|
||||||
|
*) die "EAPI ${EAPI:-0} unsupported (too old)";;
|
||||||
|
esac
|
||||||
|
|
||||||
|
inherit vim-doc
|
||||||
EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
|
EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
|
||||||
|
|
||||||
VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}"
|
VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}"
|
||||||
@ -33,47 +39,17 @@ SLOT="0"
|
|||||||
# * installs all files in "${ED}"/usr/share/vim/vimfiles.
|
# * installs all files in "${ED}"/usr/share/vim/vimfiles.
|
||||||
vim-plugin_src_install() {
|
vim-plugin_src_install() {
|
||||||
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
|
has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
|
||||||
local f
|
|
||||||
|
|
||||||
# When globbing, if nothing exists, the shell literally returns the glob
|
|
||||||
# pattern. So turn on nullglob and extglob options to avoid this.
|
|
||||||
eshopts_push -s extglob
|
|
||||||
eshopts_push -s nullglob
|
|
||||||
|
|
||||||
ebegin "Cleaning up unwanted files and directories"
|
|
||||||
# We're looking for dotfiles, dotdirectories and Makefiles here.
|
|
||||||
local obj
|
|
||||||
eval "local matches=(@(.[^.]|.??*|Makefile*))"
|
|
||||||
for obj in "${matches[@]}"; do
|
|
||||||
rm -rv "${obj}" || die "cannot remove ${obj}"
|
|
||||||
done
|
|
||||||
eend $?
|
|
||||||
|
|
||||||
# Turn those options back off.
|
|
||||||
eshopts_pop
|
|
||||||
eshopts_pop
|
|
||||||
|
|
||||||
# Install non-vim-help-docs
|
# Install non-vim-help-docs
|
||||||
cd "${S}" || die "couldn't cd in ${S}"
|
einstalldocs
|
||||||
local f
|
|
||||||
for f in *; do
|
|
||||||
[[ -f "${f}" ]] || continue
|
|
||||||
if [[ "${f}" = *.html ]]; then
|
|
||||||
dohtml "${f}"
|
|
||||||
else
|
|
||||||
dodoc "${f}"
|
|
||||||
fi
|
|
||||||
rm "${f}" || die
|
|
||||||
done
|
|
||||||
|
|
||||||
# Install remainder of plugin
|
# Install remainder of plugin
|
||||||
cd "${WORKDIR}" || die "couldn't cd in ${WORKDIR}"
|
insinto /usr/share/vim/vimfiles/
|
||||||
dodir /usr/share/vim
|
local d
|
||||||
mv "${S}" "${ED}"/usr/share/vim/vimfiles || die \
|
for d in *; do
|
||||||
"couldn't move ${S} to ${ED}/usr/share/vim/vimfiles"
|
[[ -d "${d}" ]] || continue
|
||||||
|
doins -r "${d}"
|
||||||
# Set permissions
|
done
|
||||||
fperms -R a+rX /usr/share/vim/vimfiles
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# @FUNCTION: vim-plugin_pkg_postinst
|
# @FUNCTION: vim-plugin_pkg_postinst
|
||||||
@ -150,31 +126,31 @@ update_vim_afterscripts() {
|
|||||||
display_vim_plugin_help() {
|
display_vim_plugin_help() {
|
||||||
local h
|
local h
|
||||||
|
|
||||||
if ! has_version ${CATEGORY}/${PN} ; then
|
if [[ -z ${REPLACING_VERSIONS} ]]; then
|
||||||
if [[ -n "${VIM_PLUGIN_HELPFILES}" ]] ; then
|
if [[ -n ${VIM_PLUGIN_HELPFILES} ]]; then
|
||||||
elog " "
|
elog " "
|
||||||
elog "This plugin provides documentation via vim's help system. To"
|
elog "This plugin provides documentation via vim's help system. To"
|
||||||
elog "view it, use:"
|
elog "view it, use:"
|
||||||
for h in ${VIM_PLUGIN_HELPFILES} ; do
|
for h in ${VIM_PLUGIN_HELPFILES}; do
|
||||||
elog " :help ${h}"
|
elog " :help ${h}"
|
||||||
done
|
done
|
||||||
elog " "
|
elog " "
|
||||||
|
|
||||||
elif [[ -n "${VIM_PLUGIN_HELPTEXT}" ]] ; then
|
elif [[ -n ${VIM_PLUGIN_HELPTEXT} ]]; then
|
||||||
elog " "
|
elog " "
|
||||||
while read h ; do
|
while read h ; do
|
||||||
elog "$h"
|
elog "$h"
|
||||||
done <<<"${VIM_PLUGIN_HELPTEXT}"
|
done <<<"${VIM_PLUGIN_HELPTEXT}"
|
||||||
elog " "
|
elog " "
|
||||||
|
|
||||||
elif [[ -n "${VIM_PLUGIN_HELPURI}" ]] ; then
|
elif [[ -n ${VIM_PLUGIN_HELPURI} ]]; then
|
||||||
elog " "
|
elog " "
|
||||||
elog "Documentation for this plugin is available online at:"
|
elog "Documentation for this plugin is available online at:"
|
||||||
elog " ${VIM_PLUGIN_HELPURI}"
|
elog " ${VIM_PLUGIN_HELPURI}"
|
||||||
elog " "
|
elog " "
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if has "filetype" "${VIM_PLUGIN_MESSAGES}" ; then
|
if has filetype ${VIM_PLUGIN_MESSAGES}; then
|
||||||
elog "This plugin makes use of filetype settings. To enable these,"
|
elog "This plugin makes use of filetype settings. To enable these,"
|
||||||
elog "add lines like:"
|
elog "add lines like:"
|
||||||
elog " filetype plugin on"
|
elog " filetype plugin on"
|
||||||
|
Loading…
Reference in New Issue
Block a user