summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorAnna Vyalkova <cyber+gentoo@sysrq.in>2022-04-06 16:34:18 +0500
committerPatrice Clement <monsieurp@gentoo.org>2022-05-30 14:57:02 +0200
commit72d55e0f005d399231b34eaed9dd279c4ccf1378 (patch)
tree6ddaf2d86caab1dd512395b6a72131d8ee8973f3 /eclass
parentvim-plugin.eclass: EAPI 8: install allowed dirs only (diff)
downloadgentoo-72d55e0f005d399231b34eaed9dd279c4ccf1378.tar.gz
gentoo-72d55e0f005d399231b34eaed9dd279c4ccf1378.tar.bz2
gentoo-72d55e0f005d399231b34eaed9dd279c4ccf1378.zip
vim-plugin.eclass: EAPI 8: add src_prepare
Signed-off-by: Anna Vyalkova <cyber+gentoo@sysrq.in> Signed-off-by: Patrice Clement <monsieurp@gentoo.org>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/vim-plugin.eclass32
1 files changed, 31 insertions, 1 deletions
diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass
index 0c323e0d09e7..9d300ad4826b 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} not supported" ;;
esac
@@ -32,6 +33,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:
@@ -190,3 +214,9 @@ _VIM_PLUGIN_ECLASS=1
fi
EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm
+
+# src_prepare is only exported in EAPI >= 8
+case ${EAPI} in
+ 6|7) ;;
+ *) EXPORT_FUNCTIONS src_prepare ;;
+esac