* [gentoo-dev] [PATCH v4 1/9] vim-doc.eclass: support EAPI 8
2022-04-07 12:01 [gentoo-dev] [PATCH v4 0/9] Vim eclasses Anna Vyalkova
@ 2022-04-07 12:01 ` Anna Vyalkova
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: " Anna Vyalkova
` (7 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-04-07 12:01 UTC (permalink / raw
To: gentoo-dev; +Cc: vim, Thomas Bracht Laumann Jespersen
From: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
---
eclass/vim-doc.eclass | 48 ++++++++++++++++++++++---------------------
1 file changed, 25 insertions(+), 23 deletions(-)
diff --git a/eclass/vim-doc.eclass b/eclass/vim-doc.eclass
index ba9d00f4f5..be66d6159a 100644
--- a/eclass/vim-doc.eclass
+++ b/eclass/vim-doc.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: vim-doc.eclass
# @MAINTAINER:
# vim@gentoo.org
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 6 7 8
# @BLURB: Eclass for vim{,-plugin}.eclass to update documentation tags.
# @DESCRIPTION:
# This eclass is used by vim.eclass and vim-plugin.eclass to update
@@ -16,13 +16,12 @@
# DEPEND in vim-plugin or by whatever version of vim is being
# installed by the eclass.
-case ${EAPI:-0} in
- [67]) ;;
+case ${EAPI} in
+ 6|7|8) ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
esac
-if [[ -z ${_VIM_DOC_ECLASS} ]] ; then
-_VIM_DOC_ECLASS=1
+if [[ ! ${_VIM_DOC_ECLASS} ]] ; then
update_vim_helptags() {
local vimfiles vim d s
@@ -30,12 +29,12 @@ update_vim_helptags() {
# This is where vim plugins are installed
vimfiles="${EROOT}"/usr/share/vim/vimfiles
- if [[ $PN != vim-core ]]; then
+ 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
+ [[ -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
@@ -43,39 +42,41 @@ update_vim_helptags() {
# 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"
+ ln -s "${vim}" "${T}/tagvim" || die
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
+ [[ -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"
+ find ${d}/doc -name \*.txt -type l | while read s; do
+ if [[ $(readlink "${s}") = $vimfiles/* ]]; then
+ rm -f "${s}" || die
+ fi
done
- if [[ -f "$d/doc/tags" && $(find "$d" | wc -l | tr -d ' ') = 3 ]]; then
+ 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"
+ einfo "Removing ${d}"
+ rm -r "${d}" || die
continue
fi
# Re-create / install new links
- if [[ -d $vimfiles/doc ]]; then
- ln -s $vimfiles/doc/*.txt $d/doc 2>/dev/null
+ 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 \
+ 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" \
+ "+helptags ${d}/doc" \
'+qa!' </dev/null &>/dev/null
fi
done
@@ -83,4 +84,5 @@ update_vim_helptags() {
[[ -n "${vim}" && -f "${vim}" ]] && rm "${vim}"
}
+_VIM_DOC_ECLASS=1
fi
--
2.35.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: support EAPI 8
2022-04-07 12:01 [gentoo-dev] [PATCH v4 0/9] Vim eclasses Anna Vyalkova
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 1/9] vim-doc.eclass: support EAPI 8 Anna Vyalkova
@ 2022-04-07 12:01 ` Anna Vyalkova
2022-04-07 12:39 ` Ulrich Mueller
2022-04-07 22:51 ` Sam James
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 3/9] vim-plugin.eclass: EAPI 8: install allowed dirs only Anna Vyalkova
` (6 subsequent siblings)
8 siblings, 2 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-04-07 12:01 UTC (permalink / raw
To: gentoo-dev; +Cc: vim, Thomas Bracht Laumann Jespersen
From: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
* Drop EAPI 0, 1, 2 workarounds
* Move EXPORT_FUNCTIONS to end of file
* Add required @USAGE on functions
* Add _VIM_PLUGIN_ECLASS guard
Bug: https://bugs.gentoo.org/830867
Bug: https://bugs.gentoo.org/830866
Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
---
eclass/vim-plugin.eclass | 28 +++++++++++++++++-----------
1 file changed, 17 insertions(+), 11 deletions(-)
diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
index 50e727e98f..0ee4ebe374 100644
--- a/eclass/vim-plugin.eclass
+++ b/eclass/vim-plugin.eclass
@@ -1,10 +1,10 @@
-# Copyright 1999-2021 Gentoo Authors
+# Copyright 1999-2022 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
# @ECLASS: vim-plugin.eclass
# @MAINTAINER:
# vim@gentoo.org
-# @SUPPORTED_EAPIS: 6 7
+# @SUPPORTED_EAPIS: 6 7 8
# @BLURB: used for installing vim plugins
# @DESCRIPTION:
# This eclass simplifies installation of app-vim plugins into
@@ -13,12 +13,13 @@
# documentation, for which we make a special case via vim-doc.eclass.
case ${EAPI} in
- 6|7);;
- *) die "EAPI ${EAPI:-0} unsupported (too old)";;
+ 6|7|8);;
+ *) die "${ECLASS}: EAPI ${EAPI:-0} unsupported (too old)";;
esac
+if [[ ! ${_VIM_PLUGIN_ECLASS} ]]; then
+
inherit vim-doc
-EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}"
@@ -32,13 +33,13 @@ fi
SLOT="0"
# @FUNCTION: vim-plugin_src_install
+# @USAGE:
# @DESCRIPTION:
# Overrides the default src_install phase. In order, this function:
# * fixes file permission across all files in ${S}.
# * installs help and documentation files.
# * installs all files in "${ED}"/usr/share/vim/vimfiles.
vim-plugin_src_install() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
# Install non-vim-help-docs
einstalldocs
@@ -53,6 +54,7 @@ vim-plugin_src_install() {
}
# @FUNCTION: vim-plugin_pkg_postinst
+# @USAGE:
# @DESCRIPTION:
# Overrides the pkg_postinst phase for this eclass.
# The following functions are called:
@@ -71,7 +73,6 @@ vim-plugin_pkg_postinst() {
# This function calls the update_vim_helptags and update_vim_afterscripts
# functions and eventually removes a bunch of empty directories.
vim-plugin_pkg_postrm() {
- has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
update_vim_helptags # from vim-doc
update_vim_afterscripts # see below
@@ -82,25 +83,24 @@ vim-plugin_pkg_postrm() {
}
# @FUNCTION: update_vim_afterscripts
+# @USAGE:
# @DESCRIPTION:
# Creates 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"
+ einfo "Updating scripts in ${afterdir}"
find "${afterdir}" -type d -name \*.vim.d | while read d; do
echo '" Generated by update_vim_afterscripts' > "${d%.d}" || die
find "${d}" -name \*.vim -type f -maxdepth 1 -print0 | sort -z | \
xargs -0 cat >> "${d%.d}" || die "update_vim_afterscripts failed"
done
- einfo "Removing dead scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
+ einfo "Removing dead scripts in ${afterdir}"
find "${afterdir}" -type f -name \*.vim | \
while read f; do
[[ "$(head -n 1 ${f})" == '" Generated by update_vim_afterscripts' ]] \
@@ -115,6 +115,7 @@ update_vim_afterscripts() {
}
# @FUNCTION: display_vim_plugin_help
+# @USAGE:
# @DESCRIPTION:
# Displays 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
@@ -160,3 +161,8 @@ display_vim_plugin_help() {
fi
fi
}
+
+_VIM_PLUGIN_ECLASS=1
+fi
+
+EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
--
2.35.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: support EAPI 8
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: " Anna Vyalkova
@ 2022-04-07 12:39 ` Ulrich Mueller
2022-04-07 12:48 ` Anna Vyalkova
2022-04-07 22:51 ` Sam James
1 sibling, 1 reply; 14+ messages in thread
From: Ulrich Mueller @ 2022-04-07 12:39 UTC (permalink / raw
To: Anna Vyalkova; +Cc: gentoo-dev, vim, Thomas Bracht Laumann Jespersen
[-- Attachment #1: Type: text/plain, Size: 317 bytes --]
>>>>> On Thu, 07 Apr 2022, Anna Vyalkova wrote:
> case ${EAPI} in
> - 6|7);;
> - *) die "EAPI ${EAPI:-0} unsupported (too old)";;
> + 6|7|8);;
> + *) die "${ECLASS}: EAPI ${EAPI:-0} unsupported (too old)";;
The "(too old)" part will look strange with EAPI 9. Just say that it's
not supported.
Ulrich
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 507 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: support EAPI 8
2022-04-07 12:39 ` Ulrich Mueller
@ 2022-04-07 12:48 ` Anna Vyalkova
0 siblings, 0 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-04-07 12:48 UTC (permalink / raw
To: gentoo-dev
On 2022-04-07 14:39, Ulrich Mueller wrote:
> >>>>> On Thu, 07 Apr 2022, Anna Vyalkova wrote:
>
> > case ${EAPI} in
> > - 6|7);;
> > - *) die "EAPI ${EAPI:-0} unsupported (too old)";;
> > + 6|7|8);;
> > + *) die "${ECLASS}: EAPI ${EAPI:-0} unsupported (too old)";;
>
> The "(too old)" part will look strange with EAPI 9. Just say that it's
> not supported.
Fixed in PR.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: support EAPI 8
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: " Anna Vyalkova
2022-04-07 12:39 ` Ulrich Mueller
@ 2022-04-07 22:51 ` Sam James
2022-04-07 23:08 ` Anna Vyalkova
1 sibling, 1 reply; 14+ messages in thread
From: Sam James @ 2022-04-07 22:51 UTC (permalink / raw
To: gentoo-dev; +Cc: vim, Thomas Bracht Laumann Jespersen
[-- Attachment #1: Type: text/plain, Size: 4668 bytes --]
> On 7 Apr 2022, at 13:01, Anna Vyalkova <cyber+gentoo@sysrq.in> wrote:
>
> From: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
>
> * Drop EAPI 0, 1, 2 workarounds
> * Move EXPORT_FUNCTIONS to end of file
> * Add required @USAGE on functions
> * Add _VIM_PLUGIN_ECLASS guard
>
> Bug: https://bugs.gentoo.org/830867
> Bug: https://bugs.gentoo.org/830866
> Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
> Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
> ---
> eclass/vim-plugin.eclass | 28 +++++++++++++++++-----------
> 1 file changed, 17 insertions(+), 11 deletions(-)
>
> diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
> index 50e727e98f..0ee4ebe374 100644
> --- a/eclass/vim-plugin.eclass
> +++ b/eclass/vim-plugin.eclass
> @@ -1,10 +1,10 @@
> -# Copyright 1999-2021 Gentoo Authors
> +# Copyright 1999-2022 Gentoo Authors
> # Distributed under the terms of the GNU General Public License v2
>
> # @ECLASS: vim-plugin.eclass
> # @MAINTAINER:
> # vim@gentoo.org
> -# @SUPPORTED_EAPIS: 6 7
> +# @SUPPORTED_EAPIS: 6 7 8
> # @BLURB: used for installing vim plugins
> # @DESCRIPTION:
> # This eclass simplifies installation of app-vim plugins into
> @@ -13,12 +13,13 @@
> # documentation, for which we make a special case via vim-doc.eclass.
>
> case ${EAPI} in
> - 6|7);;
> - *) die "EAPI ${EAPI:-0} unsupported (too old)";;
> + 6|7|8);;
> + *) die "${ECLASS}: EAPI ${EAPI:-0} unsupported (too old)";;
> esac
>
> +if [[ ! ${_VIM_PLUGIN_ECLASS} ]]; then
> +
> inherit vim-doc
> -EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
>
> VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}"
>
> @@ -32,13 +33,13 @@ fi
> SLOT="0"
>
> # @FUNCTION: vim-plugin_src_install
> +# @USAGE:
> # @DESCRIPTION:
> # Overrides the default src_install phase. In order, this function:
> # * fixes file permission across all files in ${S}.
> # * installs help and documentation files.
> # * installs all files in "${ED}"/usr/share/vim/vimfiles.
> vim-plugin_src_install() {
> - has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
>
> # Install non-vim-help-docs
> einstalldocs
> @@ -53,6 +54,7 @@ vim-plugin_src_install() {
> }
>
Drop the now-blank line at start of function.
> # @FUNCTION: vim-plugin_pkg_postinst
> +# @USAGE:
> # @DESCRIPTION:
> # Overrides the pkg_postinst phase for this eclass.
> # The following functions are called:
> @@ -71,7 +73,6 @@ vim-plugin_pkg_postinst() {
> # This function calls the update_vim_helptags and update_vim_afterscripts
> # functions and eventually removes a bunch of empty directories.
> vim-plugin_pkg_postrm() {
> - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
> update_vim_helptags # from vim-doc
> update_vim_afterscripts # see below
>
I'd fix the indentation (i.e. don't, just use a space) on the comment, but not a big deal.
> @@ -82,25 +83,24 @@ vim-plugin_pkg_postrm() {
> }
>
> # @FUNCTION: update_vim_afterscripts
> +# @USAGE:
> # @DESCRIPTION:
> # Creates 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
Bash tests.
>
> - einfo "Updating scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
> + einfo "Updating scripts in ${afterdir}"
> find "${afterdir}" -type d -name \*.vim.d | while read d; do
> echo '" Generated by update_vim_afterscripts' > "${d%.d}" || die
> find "${d}" -name \*.vim -type f -maxdepth 1 -print0 | sort -z | \
> xargs -0 cat >> "${d%.d}" || die "update_vim_afterscripts failed"
> done
>
> - einfo "Removing dead scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
> + einfo "Removing dead scripts in ${afterdir}"
> find "${afterdir}" -type f -name \*.vim | \
> while read f; do
> [[ "$(head -n 1 ${f})" == '" Generated by update_vim_afterscripts' ]] \
> @@ -115,6 +115,7 @@ update_vim_afterscripts() {
> }
>
> # @FUNCTION: display_vim_plugin_help
> +# @USAGE:
> # @DESCRIPTION:
> # Displays 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
> @@ -160,3 +161,8 @@ display_vim_plugin_help() {
> fi
> fi
> }
> +
> +_VIM_PLUGIN_ECLASS=1
> +fi
> +
> +EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
> --
> 2.35.1
>
>
[-- Attachment #2: Message signed with OpenPGP --]
[-- Type: application/pgp-signature, Size: 618 bytes --]
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: support EAPI 8
2022-04-07 22:51 ` Sam James
@ 2022-04-07 23:08 ` Anna Vyalkova
0 siblings, 0 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-04-07 23:08 UTC (permalink / raw
To: gentoo-dev
On 2022-04-07 23:51, Sam James wrote:
> > On 7 Apr 2022, at 13:01, Anna Vyalkova <cyber+gentoo@sysrq.in> wrote:
> >
> > From: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
> >
> > * Drop EAPI 0, 1, 2 workarounds
> > * Move EXPORT_FUNCTIONS to end of file
> > * Add required @USAGE on functions
> > * Add _VIM_PLUGIN_ECLASS guard
> >
> > Bug: https://bugs.gentoo.org/830867
> > Bug: https://bugs.gentoo.org/830866
> > Signed-off-by: Thomas Bracht Laumann Jespersen <t@laumann.xyz>
> > Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
> > ---
> > eclass/vim-plugin.eclass | 28 +++++++++++++++++-----------
> > 1 file changed, 17 insertions(+), 11 deletions(-)
> >
> > diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
> > index 50e727e98f..0ee4ebe374 100644
> > --- a/eclass/vim-plugin.eclass
> > +++ b/eclass/vim-plugin.eclass
> > @@ -1,10 +1,10 @@
> > -# Copyright 1999-2021 Gentoo Authors
> > +# Copyright 1999-2022 Gentoo Authors
> > # Distributed under the terms of the GNU General Public License v2
> >
> > # @ECLASS: vim-plugin.eclass
> > # @MAINTAINER:
> > # vim@gentoo.org
> > -# @SUPPORTED_EAPIS: 6 7
> > +# @SUPPORTED_EAPIS: 6 7 8
> > # @BLURB: used for installing vim plugins
> > # @DESCRIPTION:
> > # This eclass simplifies installation of app-vim plugins into
> > @@ -13,12 +13,13 @@
> > # documentation, for which we make a special case via vim-doc.eclass.
> >
> > case ${EAPI} in
> > - 6|7);;
> > - *) die "EAPI ${EAPI:-0} unsupported (too old)";;
> > + 6|7|8);;
> > + *) die "${ECLASS}: EAPI ${EAPI:-0} unsupported (too old)";;
> > esac
> >
> > +if [[ ! ${_VIM_PLUGIN_ECLASS} ]]; then
> > +
> > inherit vim-doc
> > -EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
> >
> > VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}"
> >
> > @@ -32,13 +33,13 @@ fi
> > SLOT="0"
> >
> > # @FUNCTION: vim-plugin_src_install
> > +# @USAGE:
> > # @DESCRIPTION:
> > # Overrides the default src_install phase. In order, this function:
> > # * fixes file permission across all files in ${S}.
> > # * installs help and documentation files.
> > # * installs all files in "${ED}"/usr/share/vim/vimfiles.
> > vim-plugin_src_install() {
> > - has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}"
> >
> > # Install non-vim-help-docs
> > einstalldocs
> > @@ -53,6 +54,7 @@ vim-plugin_src_install() {
> > }
> >
>
> Drop the now-blank line at start of function.
>
> > # @FUNCTION: vim-plugin_pkg_postinst
> > +# @USAGE:
> > # @DESCRIPTION:
> > # Overrides the pkg_postinst phase for this eclass.
> > # The following functions are called:
> > @@ -71,7 +73,6 @@ vim-plugin_pkg_postinst() {
> > # This function calls the update_vim_helptags and update_vim_afterscripts
> > # functions and eventually removes a bunch of empty directories.
> > vim-plugin_pkg_postrm() {
> > - has "${EAPI:-0}" 0 1 2 && ! use prefix && EPREFIX=
> > update_vim_helptags # from vim-doc
> > update_vim_afterscripts # see below
> >
>
> I'd fix the indentation (i.e. don't, just use a space) on the comment, but not a big deal.
>
> > @@ -82,25 +83,24 @@ vim-plugin_pkg_postrm() {
> > }
> >
> > # @FUNCTION: update_vim_afterscripts
> > +# @USAGE:
> > # @DESCRIPTION:
> > # Creates 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
>
> Bash tests.
>
> >
> > - einfo "Updating scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
> > + einfo "Updating scripts in ${afterdir}"
> > find "${afterdir}" -type d -name \*.vim.d | while read d; do
> > echo '" Generated by update_vim_afterscripts' > "${d%.d}" || die
> > find "${d}" -name \*.vim -type f -maxdepth 1 -print0 | sort -z | \
> > xargs -0 cat >> "${d%.d}" || die "update_vim_afterscripts failed"
> > done
> >
> > - einfo "Removing dead scripts in ${EPREFIX}/usr/share/vim/vimfiles/after"
> > + einfo "Removing dead scripts in ${afterdir}"
> > find "${afterdir}" -type f -name \*.vim | \
> > while read f; do
> > [[ "$(head -n 1 ${f})" == '" Generated by update_vim_afterscripts' ]] \
> > @@ -115,6 +115,7 @@ update_vim_afterscripts() {
> > }
> >
> > # @FUNCTION: display_vim_plugin_help
> > +# @USAGE:
> > # @DESCRIPTION:
> > # Displays 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
> > @@ -160,3 +161,8 @@ display_vim_plugin_help() {
> > fi
> > fi
> > }
> > +
> > +_VIM_PLUGIN_ECLASS=1
> > +fi
> > +
> > +EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
> > --
> > 2.35.1
Thanks for the feedback, fixed in the PR. Should I send v5?
^ permalink raw reply [flat|nested] 14+ messages in thread
* [gentoo-dev] [PATCH v4 3/9] vim-plugin.eclass: EAPI 8: install allowed dirs only
2022-04-07 12:01 [gentoo-dev] [PATCH v4 0/9] Vim eclasses Anna Vyalkova
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 1/9] vim-doc.eclass: support EAPI 8 Anna Vyalkova
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: " Anna Vyalkova
@ 2022-04-07 12:01 ` Anna Vyalkova
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 4/9] vim-plugin.eclass: EAPI 8: add src_prepare Anna Vyalkova
` (5 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-04-07 12:01 UTC (permalink / raw
To: gentoo-dev; +Cc: vim
Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
---
eclass/vim-plugin.eclass | 39 ++++++++++++++++++++++++++++++++-------
1 file changed, 32 insertions(+), 7 deletions(-)
diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
index 0ee4ebe374..8a6a02f2d2 100644
--- a/eclass/vim-plugin.eclass
+++ b/eclass/vim-plugin.eclass
@@ -32,13 +32,30 @@ if [[ ${PV} != 9999* ]] ; then
fi
SLOT="0"
+# @ECLASS_VARIABLE: _VIM_PLUGIN_ALLOWED_DIRS
+# @INTERNAL
+# @DESCRIPTION:
+# Vanilla Vim dirs.
+# See /usr/share/vim/vim* for reference.
+_VIM_PLUGIN_ALLOWED_DIRS=(
+ after autoload colors compiler doc ftdetect ftplugin indent keymap
+ macros plugin spell syntax
+)
+
# @FUNCTION: vim-plugin_src_install
-# @USAGE:
+# @USAGE: [<dir>...]
# @DESCRIPTION:
# Overrides the default src_install phase. In order, this function:
-# * fixes file permission across all files in ${S}.
# * installs help and documentation files.
-# * installs all files in "${ED}"/usr/share/vim/vimfiles.
+# * installs all files recognized by default Vim installation and directories
+# passed to this function as arguments in "${ED}"/usr/share/vim/vimfiles.
+#
+# Example use:
+# @CODE
+# src_install() {
+# vim-plugin_src_install syntax_checkers
+# }
+# @CODE
vim-plugin_src_install() {
# Install non-vim-help-docs
@@ -47,10 +64,18 @@ vim-plugin_src_install() {
# Install remainder of plugin
insinto /usr/share/vim/vimfiles/
local d
- for d in *; do
- [[ -d "${d}" ]] || continue
- doins -r "${d}"
- done
+ case ${EAPI:-0} in
+ 6|7)
+ for d in *; do
+ [[ -d "${d}" ]] || continue
+ doins -r "${d}"
+ done ;;
+ *)
+ for d in "${_VIM_PLUGIN_ALLOWED_DIRS[@]}" "${@}"; do
+ [[ -d "${d}" ]] || continue
+ doins -r "${d}"
+ done ;;
+ esac
}
# @FUNCTION: vim-plugin_pkg_postinst
--
2.35.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-dev] [PATCH v4 4/9] vim-plugin.eclass: EAPI 8: add src_prepare
2022-04-07 12:01 [gentoo-dev] [PATCH v4 0/9] Vim eclasses Anna Vyalkova
` (2 preceding siblings ...)
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 3/9] vim-plugin.eclass: EAPI 8: install allowed dirs only Anna Vyalkova
@ 2022-04-07 12:01 ` Anna Vyalkova
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 5/9] vim-plugin.eclass: document VIM_PLUGIN_VIM_VERSION Anna Vyalkova
` (4 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-04-07 12:01 UTC (permalink / raw
To: gentoo-dev; +Cc: vim
Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
---
eclass/vim-plugin.eclass | 39 ++++++++++++++++++++++++++++++++++++---
1 file changed, 36 insertions(+), 3 deletions(-)
diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
index 8a6a02f2d2..722f906c65 100644
--- a/eclass/vim-plugin.eclass
+++ b/eclass/vim-plugin.eclass
@@ -13,7 +13,8 @@
# documentation, for which we make a special case via vim-doc.eclass.
case ${EAPI} in
- 6|7|8);;
+ 6|7) ;;
+ 8) _DEFINE_VIM_PLUGIN_SRC_PREPARE=true ;;
*) die "${ECLASS}: EAPI ${EAPI:-0} unsupported (too old)";;
esac
@@ -21,6 +22,17 @@ if [[ ! ${_VIM_PLUGIN_ECLASS} ]]; then
inherit vim-doc
+fi
+
+EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
+
+# src_prepare is only exported in EAPI >= 8
+case ${EAPI:-0} in
+ 6|7) ;;
+ 8) EXPORT_FUNCTIONS src_prepare ;;
+esac
+
+if [[ ! ${_VIM_PLUGIN_ECLASS} ]]; then
VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}"
DEPEND="|| ( >=app-editors/vim-${VIM_PLUGIN_VIM_VERSION}
@@ -32,6 +44,29 @@ if [[ ${PV} != 9999* ]] ; then
fi
SLOT="0"
+if ${_DEFINE_VIM_PLUGIN_SRC_PREPARE}; then
+# @FUNCTION: vim-plugin_src_prepare
+# @USAGE:
+# @DESCRIPTION:
+# Moves "after/syntax" plugins to directories to avoid file collisions with
+# other packages.
+# Note that this function is only defined and exported in EAPIs >= 8.
+vim-plugin_src_prepare() {
+ default_src_prepare
+
+ # return if there's nothing to do
+ [[ -d after/syntax ]] || return
+
+ pushd after/syntax >/dev/null || die
+ for file in *.vim; do
+ [[ -f "${file}" ]] || continue
+ mkdir "${file%.vim}" || die
+ mv "${file}" "${file%.vim}/${PN}.vim" || die
+ done
+ popd >/dev/null || die
+}
+fi
+
# @ECLASS_VARIABLE: _VIM_PLUGIN_ALLOWED_DIRS
# @INTERNAL
# @DESCRIPTION:
@@ -189,5 +224,3 @@ display_vim_plugin_help() {
_VIM_PLUGIN_ECLASS=1
fi
-
-EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
--
2.35.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-dev] [PATCH v4 5/9] vim-plugin.eclass: document VIM_PLUGIN_VIM_VERSION
2022-04-07 12:01 [gentoo-dev] [PATCH v4 0/9] Vim eclasses Anna Vyalkova
` (3 preceding siblings ...)
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 4/9] vim-plugin.eclass: EAPI 8: add src_prepare Anna Vyalkova
@ 2022-04-07 12:01 ` Anna Vyalkova
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 6/9] vim-doc.eclass: add debug-print-function call Anna Vyalkova
` (3 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-04-07 12:01 UTC (permalink / raw
To: gentoo-dev; +Cc: vim
Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
---
eclass/vim-plugin.eclass | 3 +++
1 file changed, 3 insertions(+)
diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
index 722f906c65..243f9107be 100644
--- a/eclass/vim-plugin.eclass
+++ b/eclass/vim-plugin.eclass
@@ -33,6 +33,9 @@ case ${EAPI:-0} in
esac
if [[ ! ${_VIM_PLUGIN_ECLASS} ]]; then
+# @ECLASS_VARIABLE: VIM_PLUGIN_VIM_VERSION
+# @DESCRIPTION:
+# Minimum Vim version the plugin supports.
VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}"
DEPEND="|| ( >=app-editors/vim-${VIM_PLUGIN_VIM_VERSION}
--
2.35.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-dev] [PATCH v4 6/9] vim-doc.eclass: add debug-print-function call
2022-04-07 12:01 [gentoo-dev] [PATCH v4 0/9] Vim eclasses Anna Vyalkova
` (4 preceding siblings ...)
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 5/9] vim-plugin.eclass: document VIM_PLUGIN_VIM_VERSION Anna Vyalkova
@ 2022-04-07 12:01 ` Anna Vyalkova
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 7/9] vim-doc.eclass: document update_vim_helptags Anna Vyalkova
` (2 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-04-07 12:01 UTC (permalink / raw
To: gentoo-dev; +Cc: vim
Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
---
eclass/vim-doc.eclass | 2 ++
1 file changed, 2 insertions(+)
diff --git a/eclass/vim-doc.eclass b/eclass/vim-doc.eclass
index be66d6159a..7485a33512 100644
--- a/eclass/vim-doc.eclass
+++ b/eclass/vim-doc.eclass
@@ -24,6 +24,8 @@ esac
if [[ ! ${_VIM_DOC_ECLASS} ]] ; then
update_vim_helptags() {
+ debug-print-function ${FUNCNAME} "${@}"
+
local vimfiles vim d s
# This is where vim plugins are installed
--
2.35.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-dev] [PATCH v4 7/9] vim-doc.eclass: document update_vim_helptags
2022-04-07 12:01 [gentoo-dev] [PATCH v4 0/9] Vim eclasses Anna Vyalkova
` (5 preceding siblings ...)
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 6/9] vim-doc.eclass: add debug-print-function call Anna Vyalkova
@ 2022-04-07 12:01 ` Anna Vyalkova
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 8/9] vim-plugin.eclass: add debug-print-function calls Anna Vyalkova
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 9/9] vim-plugin.eclass: fix manpage formatting Anna Vyalkova
8 siblings, 0 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-04-07 12:01 UTC (permalink / raw
To: gentoo-dev; +Cc: vim
Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
---
eclass/vim-doc.eclass | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/eclass/vim-doc.eclass b/eclass/vim-doc.eclass
index 7485a33512..f4f268c38b 100644
--- a/eclass/vim-doc.eclass
+++ b/eclass/vim-doc.eclass
@@ -23,6 +23,10 @@ esac
if [[ ! ${_VIM_DOC_ECLASS} ]] ; then
+# @FUNCTION: update_vim_helptags
+# @USAGE:
+# @DESCRIPTION:
+# Update the documentation tags in the versioned Vim directory.
update_vim_helptags() {
debug-print-function ${FUNCNAME} "${@}"
--
2.35.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-dev] [PATCH v4 8/9] vim-plugin.eclass: add debug-print-function calls
2022-04-07 12:01 [gentoo-dev] [PATCH v4 0/9] Vim eclasses Anna Vyalkova
` (6 preceding siblings ...)
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 7/9] vim-doc.eclass: document update_vim_helptags Anna Vyalkova
@ 2022-04-07 12:01 ` Anna Vyalkova
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 9/9] vim-plugin.eclass: fix manpage formatting Anna Vyalkova
8 siblings, 0 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-04-07 12:01 UTC (permalink / raw
To: gentoo-dev; +Cc: vim
Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
---
eclass/vim-plugin.eclass | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
index 243f9107be..92db412adc 100644
--- a/eclass/vim-plugin.eclass
+++ b/eclass/vim-plugin.eclass
@@ -55,6 +55,8 @@ if ${_DEFINE_VIM_PLUGIN_SRC_PREPARE}; then
# other packages.
# Note that this function is only defined and exported in EAPIs >= 8.
vim-plugin_src_prepare() {
+ debug-print-function ${FUNCNAME} "${@}"
+
default_src_prepare
# return if there's nothing to do
@@ -95,6 +97,7 @@ _VIM_PLUGIN_ALLOWED_DIRS=(
# }
# @CODE
vim-plugin_src_install() {
+ debug-print-function ${FUNCNAME} "${@}"
# Install non-vim-help-docs
einstalldocs
@@ -125,6 +128,8 @@ vim-plugin_src_install() {
# * update_vim_afterscripts
# * display_vim_plugin_help
vim-plugin_pkg_postinst() {
+ debug-print-function ${FUNCNAME} "${@}"
+
update_vim_helptags # from vim-doc
update_vim_afterscripts # see below
display_vim_plugin_help # see below
@@ -136,6 +141,8 @@ vim-plugin_pkg_postinst() {
# This function calls the update_vim_helptags and update_vim_afterscripts
# functions and eventually removes a bunch of empty directories.
vim-plugin_pkg_postrm() {
+ debug-print-function ${FUNCNAME} "${@}"
+
update_vim_helptags # from vim-doc
update_vim_afterscripts # see below
@@ -151,6 +158,8 @@ vim-plugin_pkg_postrm() {
# Creates scripts in /usr/share/vim/vimfiles/after/*
# comprised of the snippets in /usr/share/vim/vimfiles/after/*/*.d
update_vim_afterscripts() {
+ debug-print-function ${FUNCNAME} "${@}"
+
local d f afterdir="${EROOT}"/usr/share/vim/vimfiles/after
# Nothing to do if the dir isn't there
@@ -188,6 +197,8 @@ update_vim_afterscripts() {
# extra message regarding enabling filetype plugins is displayed if
# VIM_PLUGIN_MESSAGES includes the word "filetype".
display_vim_plugin_help() {
+ debug-print-function ${FUNCNAME} "${@}"
+
local h
if [[ -z ${REPLACING_VERSIONS} ]]; then
--
2.35.1
^ permalink raw reply related [flat|nested] 14+ messages in thread
* [gentoo-dev] [PATCH v4 9/9] vim-plugin.eclass: fix manpage formatting
2022-04-07 12:01 [gentoo-dev] [PATCH v4 0/9] Vim eclasses Anna Vyalkova
` (7 preceding siblings ...)
2022-04-07 12:01 ` [gentoo-dev] [PATCH v4 8/9] vim-plugin.eclass: add debug-print-function calls Anna Vyalkova
@ 2022-04-07 12:01 ` Anna Vyalkova
8 siblings, 0 replies; 14+ messages in thread
From: Anna Vyalkova @ 2022-04-07 12:01 UTC (permalink / raw
To: gentoo-dev; +Cc: vim
Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in>
---
eclass/vim-plugin.eclass | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
index 92db412adc..271758a230 100644
--- a/eclass/vim-plugin.eclass
+++ b/eclass/vim-plugin.eclass
@@ -86,7 +86,9 @@ _VIM_PLUGIN_ALLOWED_DIRS=(
# @USAGE: [<dir>...]
# @DESCRIPTION:
# Overrides the default src_install phase. In order, this function:
+#
# * installs help and documentation files.
+#
# * installs all files recognized by default Vim installation and directories
# passed to this function as arguments in "${ED}"/usr/share/vim/vimfiles.
#
@@ -124,8 +126,11 @@ vim-plugin_src_install() {
# @DESCRIPTION:
# Overrides the pkg_postinst phase for this eclass.
# The following functions are called:
+#
# * update_vim_helptags
+#
# * update_vim_afterscripts
+#
# * display_vim_plugin_help
vim-plugin_pkg_postinst() {
debug-print-function ${FUNCNAME} "${@}"
--
2.35.1
^ permalink raw reply related [flat|nested] 14+ messages in thread