From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E29081396D0 for ; Fri, 8 Sep 2017 22:27:35 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 4D9A51FC10F; Fri, 8 Sep 2017 22:27:30 +0000 (UTC) Received: from mail-pg0-x230.google.com (mail-pg0-x230.google.com [IPv6:2607:f8b0:400e:c05::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id E3B7C1FC06A for ; Fri, 8 Sep 2017 22:27:29 +0000 (UTC) Received: by mail-pg0-x230.google.com with SMTP id 188so6903614pgb.2 for ; Fri, 08 Sep 2017 15:27:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=hIVBeQW2HdJvYo/3mD8TPQG0Uh3SS/tBF8ICJOKj44c=; b=YRlVf8eR95g/yHWP57Jqk3k79eegrI+v+5cN9xSnSNFcZIJ111OnOR2vywrkbxsC4V z3w+/0jhiVzuV3wMv4jbJjB3RjvRk+O7xbbe1ZDpTPHbYOAGcy31qJUNHbrcygzHKQsv aVEtAfj6LbOd48aif+eA9e558y4z3IjtNLY4YnACJ+xi+RinmD504l78snu5C9aCXX+8 LUCxZEA0beOgm0qUBmHuIxlsBLAVaqKD2Gcmgioj4nL8MyQ0eB2yzoTV6eVkgaUlDDaA BDngGpEx+lPRO8XzOmwHRb4BfJ4fceSyQDHN67RvSj2GvRkvcR9Ykbtj7pAGkWCZ7v/M 99xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:subject:message-id:mime-version :content-disposition:user-agent; bh=hIVBeQW2HdJvYo/3mD8TPQG0Uh3SS/tBF8ICJOKj44c=; b=cUmF0/Ix6Mt46h1X6GxVQIVMfpD2cpw9pkSKlMJTmB36pRr5dCfz5t3NZvrWxEe/CO sJdPN4WysNAjDBHHN7AeKp35M8MtYvMA79zbWBJdocfSmhkGvaZABftsUHTpdyXZUrfB MCTNKrc33a97ea7dKbCNRxiqiEoGlz9Q3bDupx7A0XVaNaXPbJkBzX7tana3+ELqLEa3 hUSMoz0oEcUbNLJV1N3KNsJP164yma+veD5B7uuLSIAhOW8AfwTrl+7pMJBqaqSpFlHz PMEYdzci82yBbvNsXpiHS2vsVrxdQRVpxoJUsotgLXkXp1FkijvXRqXbvufWJwmaa1fP qILw== X-Gm-Message-State: AHPjjUjNZ3/c7N/vZxufjSi9yZBx1ImZzlkVPUg3rowGx7BKm+20ESKB zH7fSdxZ+cMbDQk4 X-Google-Smtp-Source: ADKCNb5hBuGVENfW/tYDnyjRDX53U07sRKQ/jO/BThWoTiUZm6Od8AjX+aPWAAt8l7ejzJIba1bytQ== X-Received: by 10.84.253.2 with SMTP id z2mr5210761pll.384.1504909648875; Fri, 08 Sep 2017 15:27:28 -0700 (PDT) Received: from gmail.com ([2607:f140:400:a011:47de:bccd:2bdb:f91e]) by smtp.gmail.com with ESMTPSA id j83sm5350298pfe.133.2017.09.08.15.27.27 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 08 Sep 2017 15:27:28 -0700 (PDT) Date: Fri, 8 Sep 2017 15:27:24 -0700 From: Aric Belsito To: gentoo-dev@lists.gentoo.org Subject: [gentoo-dev] [RFC] New eclass vim-runtime Message-ID: <20170908222724.GA20930@gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="X1bOJ3K7DJ5YkBrT" Content-Disposition: inline User-Agent: Mutt/1.8.3 (2017-05-23) X-Archives-Salt: 0e26d29f-33e4-439a-acbb-0b9284c42f1b X-Archives-Hash: 0bee8a5813e0f63324e5691dc29921f3 --X1bOJ3K7DJ5YkBrT Content-Type: text/plain; charset=us-ascii Content-Disposition: inline This is really messy at the moment because I'm not sure whether the vim team is interested, and I didn't want to put in the effort if it's just going to be rejected, but I'm posting what I have here to start some kind of discussion. At the moment functions/other things need to be described, among other issues. I have not yet tested to see if everything is still working with vim, though I believe it works with neovim. I'm also adding a patch file for vim-plugin.eclass, vim-doc.eclass and vim-spell.eclass I have a bug open on the bugtracker as well: https://bugs.gentoo.org/612644 -- Aric Belsito --X1bOJ3K7DJ5YkBrT Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="vim_eclasses.patch" >From 08411b7ade20df1138c28b9a70679b7acf350f87 Mon Sep 17 00:00:00 2001 From: Aric Belsito Date: Tue, 5 Sep 2017 14:21:08 -0700 Subject: [PATCH] vim-runtime.eclass: new eclass Gentoo-Bug: https://bugs.gentoo.org/612644 --- eclass/vim-doc.eclass | 40 ++++++++++++++++++++++++---------------- eclass/vim-plugin.eclass | 31 +++++++++++++------------------ eclass/vim-spell.eclass | 8 ++------ 4 files changed, 39 insertions(+), 40 deletions(-) create mode 100644 eclass/vim-runtime.eclass diff --git a/eclass/vim-doc.eclass b/eclass/vim-doc.eclass index 5f281eba25f2..c4fa9ed22a44 100644 --- a/eclass/vim-doc.eclass +++ b/eclass/vim-doc.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2011 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # # This eclass is used by vim.eclass and vim-plugin.eclass to update @@ -10,22 +10,28 @@ # DEPEND in vim-plugin or by whatever version of vim is being # installed by the eclass. +inherit vim-runtime + +run_helptags() { + # Update tags; need a vim binary for this + if [[ -n "$1" ]]; then + einfo "Updating documentation tags in $2" + DISPLAY= $1 -u NONE -n \ + '+set nobackup nomore' \ + "+helptags $2/doc" \ + '+qa!' /dev/null + fi +} 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 + vimfiles="${EPREFIX}$(vimfiles_directory)" 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 + vim="$(vim_binary)" fi # Make vim not try to connect to X. See :help gui-x11-start @@ -59,14 +65,16 @@ update_vim_helptags() { 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 - fi + run_helptags $vim $d done + # For neovim, just run :helptags on the tag directory + if use nvim ; then + [[ -d $vimfiles/doc ]] || break + + # Update tags; need a vim binary for this + run_helptags $vim $vimfiles + fi + [[ -n "${vim}" && -f "${vim}" ]] && rm "${vim}" } diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass index cdc24a15cf6f..f99693aeeb11 100644 --- a/eclass/vim-plugin.eclass +++ b/eclass/vim-plugin.eclass @@ -1,4 +1,4 @@ -# Copyright 1999-2016 Gentoo Foundation +# Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # @ECLASS: vim-plugin.eclass @@ -7,18 +7,13 @@ # @BLURB: used for installing vim plugins # @DESCRIPTION: # This eclass simplifies installation of app-vim plugins into -# /usr/share/vim/vimfiles. This is a version-independent directory +# $(vimfiles_directory). 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 +inherit vim-doc vim-runtime 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 https://dev.gentoo.org/~radhermit/vim/${P}.tar.bz2" @@ -27,7 +22,7 @@ SLOT="0" vim-plugin_src_install() { has "${EAPI:-0}" 0 1 2 && ! use prefix && ED="${D}" - local f + local f vimfiles="${EPREFIX}$(vimfiles_directory)" if use !prefix && [[ ${EUID} -eq 0 ]] ; then ebegin "Fixing file permissions" @@ -59,11 +54,11 @@ vim-plugin_src_install() { # Install remainder of plugin cd "${WORKDIR}" - dodir /usr/share/vim - mv "${S}" "${ED}"/usr/share/vim/vimfiles + dodir "$(dirname $vimfiles)" + mv "${S}" "${D%/}$vimfiles" # Fix remaining bad permissions - chmod -R -x+X "${ED}"/usr/share/vim/vimfiles/ || die "chmod failed" + chmod -R -x+X "${D%/}$vimfiles" || die "chmod failed" } vim-plugin_pkg_postinst() { @@ -79,21 +74,21 @@ vim-plugin_pkg_postrm() { # 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 + find "${EPREFIX}$(vimfiles_directory)" -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 +# $(vimfiles_directory)/after/* comprised of the snippets in +# $(vimfiles_directory)/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 + local d f afterdir="${EPREFIX}$(vimfiles_directory)"/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}" @@ -101,7 +96,7 @@ update_vim_afterscripts() { sort -z | xargs -0 cat >> "${d%.d}" 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' ]] \ diff --git a/eclass/vim-spell.eclass b/eclass/vim-spell.eclass index 2844ea9d995e..5126f8fa19ce 100644 --- a/eclass/vim-spell.eclass +++ b/eclass/vim-spell.eclass @@ -62,14 +62,10 @@ # spell files. It's best to let upstream know if you've generated spell files # for another language rather than keeping them Gentoo-specific. -inherit eutils +inherit eutils vim-runtime EXPORT_FUNCTIONS src_install pkg_postinst -IUSE="" -DEPEND="|| ( >=app-editors/vim-7_alpha - >=app-editors/gvim-7_alpha )" -RDEPEND="${DEPEND}" SRC_URI="mirror://gentoo/${P}.tar.bz2" SLOT="0" @@ -91,7 +87,7 @@ SLOT="0" # @INTERNAL # @DESCRIPTION: # This variable defines the path to Vim spell files. -: ${VIM_SPELL_DIRECTORY:="${EPREFIX}/usr/share/vim/vimfiles/spell/"} +: ${VIM_SPELL_DIRECTORY:="${EPREFIX}$(vimfiles_directory)/spell/"} # @ECLASS-VARIABLE: DESCRIPTION # @DESCRIPTION: --X1bOJ3K7DJ5YkBrT Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename="vim-runtime.eclass" # Copyright 1999-2017 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # @ECLASS: vim-runtime.eclass # @MAINTAINER: # vim@gentoo.org # @BLURB: used for installing vim plugins # @DESCRIPTION: # This eclass simplifies installation of app-vim plugins into # $(vimfiles_directory). 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. # @ECLASS-VARIABLE: VIM_PLUGIN_VIM_VERSION # @DESCRIPTION: # This variable defines the default vim version for a vim plugin. # The default value is "7.3". : ${VIM_PLUGIN_VIM_VERSION:=7.3} IUSE="nvim" DEPEND="|| ( >=app-editors/vim-${VIM_PLUGIN_VIM_VERSION} >=app-editors/gvim-${VIM_PLUGIN_VIM_VERSION} app-editors/neovim )" RDEPEND="${DEPEND}" vim_binary() { # Find a suitable vim binary local vim=$(type -P vim 2>/dev/null) [[ -z "$vim" ]] && vim=$(type -P gvim 2>/dev/null) [[ -z "$vim" ]] && vim=$(type -P nvim 2>/dev/null) if [[ -z "$vim" ]]; then ewarn "No suitable vim binary found" fi echo "$vim" } vimfiles_directory() { if use nvim ; then echo "/usr/share/nvim/runtime" else echo "/usr/share/vim/vimfiles" fi } --X1bOJ3K7DJ5YkBrT--