• [gentoo-dev] [PATCH v4 2/9] vim-plugin.eclass: support EAPI 8

    From Anna Vyalkova@21:1/5 to All on Thu Apr 7 14:10:01 2022
    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
    -
  • From Ulrich Mueller@21:1/5 to All on Thu Apr 7 14:40:01 2022
    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

    --=-=-Content-Type: application/pgp-signature; name="signature.asc"

    -----BEGIN PGP SIGNATURE-----

    iQFDBAEBCAAtFiEEtDnZ1O9xIP68rzDbUYgzUIhBXi4FAmJO24APHHVsbUBnZW50 b28ub3JnAAoJEFGIM1CIQV4uK9UIALPRNwhWBStNAtRLl9AW6erV7xjz7pW22/r3 mvp8Yd9iMoh4PwYZLn9ygrN1Ypi2CIvanw9Fei5N6xfxpnWoOs6K9U8jKqlLfuNy zpQh8Pe1Hgkfna99pAsfnYgcIqbGDIt+hVZzcAiuvz/Ol0MGIm0sqDaTKEw6c3YS PzZITAEaCp2bN/HYeN6Dm0UEandJ0NyEJCPrB/Lb834E0LBH47k0JauCSlW74/HL CKCyEPCDJFJTDrBN9yhgy3stXtTbLugxTTvFpwbtzFTlHGNOK3UeEHomzHkp5HBw L6GIWsg9DasfiJ1Pi9Hv6JJ8/qr9ZwXPLpqf7z1Dmj8aGcuIS1g=Z6PS
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anna Vyalkova@21:1/5 to Ulrich Mueller on Thu Apr 7 14:50:01 2022
    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.

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Anna Vyalkova@21:1/5 to Sam James on Fri Apr 8 01:10:01 2022
    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?

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)
  • From Sam James@21:1/5 to All on Fri Apr 8 01:00:01 2022
    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




    -----BEGIN PGP SIGNATURE-----

    iQGTBAEBCgB9FiEEYOpPv/uDUzOcqtTy9JIoEO6gSDsFAmJPav5fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldDYw RUE0RkJGRkI4MzUzMzM5Q0FBRDRGMkY0OTIyODEwRUVBMDQ4M0IACgkQ9JIoEO6g SDtA+wgAuGaP4BGu6DvDgPlPoWmsfBLSiGwy02CVvTuQwuEYuE91JtgUHQjTmKWI ilRab+wUqKhPdUT8oLe4mFSWPoqKK4dLbLZ1IwydBAkDpDcsydYj/o0t+8XvdeoJ Sjli5KxDoYdzLc0/UTclDTvQeBjiEyzpa98LKRiHDK35emsuIztJdRpfqhBFa5I6 +QR8zOn/w14scC1MghdVZ9irVVbTqjjiyBVy3b/rLeh38HUzRkVrz4/rqYfT8cJt 9vqqDRMWRRCtC6120IsA1A6hnZ3bvypO+AN8G+IoT40UCnzABq+HCFBKkRlYv/aF pkqc97iuW+Jz/Rq9WqUiDH7TIWL7FQ==
    =D7Nb
    -----END PGP SIGNATURE-----

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)