From bd7908c6630f38067350d396ac5d18c3cc2434a0 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 29 Oct 2017 11:22:34 +0000 Subject: gentoo resync : 29.10.2017 --- eclass/kde4-base.eclass | 10 ++--- eclass/kde5-functions.eclass | 63 +++++++++++++++++-------------- eclass/kde5-meta-pkg.eclass | 5 ++- eclass/kde5.eclass | 73 +++++++++++++++++++++++------------- eclass/meson.eclass | 3 ++ eclass/mysql-multilib-r1.eclass | 2 +- eclass/mysql-multilib.eclass | 2 +- eclass/mysql-v2.eclass | 2 +- eclass/toolchain.eclass | 2 +- eclass/vim-plugin.eclass | 82 ++++++++++++++++++++++++++++++----------- 10 files changed, 158 insertions(+), 86 deletions(-) (limited to 'eclass') diff --git a/eclass/kde4-base.eclass b/eclass/kde4-base.eclass index b43f0600e5e2..781c2bda0673 100644 --- a/eclass/kde4-base.eclass +++ b/eclass/kde4-base.eclass @@ -33,7 +33,7 @@ _KDE4_BASE_ECLASS=1 # for tests you should proceed with setting VIRTUALX_REQUIRED=test. : ${VIRTUALX_REQUIRED:=manual} -inherit kde4-functions toolchain-funcs fdo-mime flag-o-matic gnome2-utils virtualx versionator eutils multilib +inherit kde4-functions toolchain-funcs flag-o-matic gnome2-utils virtualx versionator eutils multilib xdg-utils if [[ ${KDE_BUILD_TYPE} = live ]]; then case ${KDE_SCM} in @@ -929,8 +929,8 @@ kde4-base_pkg_postinst() { if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then gnome2_icon_cache_update fi - fdo-mime_desktop_database_update - fdo-mime_mime_database_update + xdg_desktop_database_update + xdg_mimeinfo_database_update buildsycoca if [[ -z ${I_KNOW_WHAT_I_AM_DOING} ]]; then @@ -953,8 +953,8 @@ kde4-base_pkg_postrm() { if [[ -n ${GNOME2_ECLASS_ICONS} ]]; then gnome2_icon_cache_update fi - fdo-mime_desktop_database_update - fdo-mime_mime_database_update + xdg_desktop_database_update + xdg_mimeinfo_database_update buildsycoca } diff --git a/eclass/kde5-functions.eclass b/eclass/kde5-functions.eclass index 345408aae2b5..44e45e4734fd 100644 --- a/eclass/kde5-functions.eclass +++ b/eclass/kde5-functions.eclass @@ -4,10 +4,12 @@ # @ECLASS: kde5-functions.eclass # @MAINTAINER: # kde@gentoo.org -# @BLURB: Common ebuild functions for KDE 5 packages +# @BLURB: Common ebuild functions for packages based on KDE Frameworks 5. # @DESCRIPTION: -# This eclass contains all functions shared by the different eclasses, -# for KDE 5 ebuilds. +# This eclass contains functions shared by the other KDE eclasses and forms +# part of their public API. +# +# This eclass should (almost) never be inherited directly by an ebuild. if [[ -z ${_KDE5_FUNCTIONS_ECLASS} ]]; then _KDE5_FUNCTIONS_ECLASS=1 @@ -22,7 +24,10 @@ case ${EAPI} in *) die "EAPI=${EAPI:-0} is not supported" ;; esac -# determine the build type +# @ECLASS-VARIABLE: KDE_BUILD_TYPE +# @DESCRIPTION: +# If PV matches "*9999*", this is automatically set to "live". +# Otherwise, this is automatically set to "release". if [[ ${PV} = *9999* ]]; then KDE_BUILD_TYPE="live" else @@ -44,28 +49,29 @@ esac # @ECLASS-VARIABLE: QT_MINIMAL # @DESCRIPTION: -# Minimal Qt version to require for the package. +# Minimum version of Qt to require. This affects add_qt_dep. : ${QT_MINIMAL:=5.7.1} # @ECLASS-VARIABLE: FRAMEWORKS_MINIMAL # @DESCRIPTION: -# Minimal Frameworks version to require for the package. +# Minimum version of Frameworks to require. This affects add_frameworks_dep. : ${FRAMEWORKS_MINIMAL:=5.37.0} # @ECLASS-VARIABLE: PLASMA_MINIMAL # @DESCRIPTION: -# Minimal Plasma version to require for the package. +# Minimum version of Plasma to require. This affects add_plasma_dep. : ${PLASMA_MINIMAL:=5.10.5} # @ECLASS-VARIABLE: KDE_APPS_MINIMAL # @DESCRIPTION: -# Minimal KDE Applications version to require for the package. +# Minimum version of KDE Applications to require. This affects add_kdeapps_dep. : ${KDE_APPS_MINIMAL:=14.12.0} # @ECLASS-VARIABLE: KDE_GCC_MINIMAL # @DEFAULT_UNSET # @DESCRIPTION: -# Minimal GCC version to require for the package. +# Minimum version of active GCC to require. This is checked in kde5.eclass in +# kde5_pkg_pretend and kde5_pkg_setup. # @ECLASS-VARIABLE: KDEBASE # @DESCRIPTION: @@ -79,7 +85,8 @@ debug-print "${ECLASS}: ${KDEBASE} ebuild recognized" # @ECLASS-VARIABLE: KDE_SCM # @DESCRIPTION: -# SCM to use if this is a live ebuild. +# SCM to use if KDE_BUILD_TYPE is determined to be "live". +# Currently, only git is supported. : ${KDE_SCM:=git} case ${KDE_SCM} in @@ -135,7 +142,7 @@ _add_category_dep() { if [[ -n ${version} ]] ; then local operator=">=" - local version="-$(get_version_component_range 1-3 ${version})" + local version="-${version}" fi if [[ -n ${slot} ]] ; then @@ -148,7 +155,7 @@ _add_category_dep() { } # @FUNCTION: add_frameworks_dep -# @USAGE: [USE flags] [minimum version] +# @USAGE: [USE flags] [minimum version] [slot + operator] # @DESCRIPTION: # Create proper dependency for kde-frameworks/ dependencies. # This takes 1 to 4 arguments. The first being the package name, the optional @@ -172,7 +179,7 @@ add_frameworks_dep() { version=${3} elif [[ ${CATEGORY} = kde-frameworks ]]; then version=$(get_version_component_range 1-2) - elif [[ -z "${version}" ]] ; then + elif [[ -z ${3} ]] ; then version=${FRAMEWORKS_MINIMAL} fi @@ -180,7 +187,7 @@ add_frameworks_dep() { } # @FUNCTION: add_plasma_dep -# @USAGE: [USE flags] [minimum version] +# @USAGE: [USE flags] [minimum version] [slot + operator] # @DESCRIPTION: # Create proper dependency for kde-plasma/ dependencies. # This takes 1 to 4 arguments. The first being the package name, the optional @@ -203,8 +210,8 @@ add_plasma_dep() { if [[ -n ${3} ]]; then version=${3} elif [[ ${CATEGORY} = kde-plasma ]]; then - version=${PV} - elif [[ -z "${version}" ]] ; then + version=$(get_version_component_range 1-3) + elif [[ -z ${3} ]] ; then version=${PLASMA_MINIMAL} fi @@ -212,7 +219,7 @@ add_plasma_dep() { } # @FUNCTION: add_kdeapps_dep -# @USAGE: [USE flags] [minimum version] +# @USAGE: [USE flags] [minimum version] [slot + operator] # @DESCRIPTION: # Create proper dependency for kde-apps/ dependencies. # This takes 1 to 4 arguments. The first being the package name, the optional @@ -235,8 +242,8 @@ add_kdeapps_dep() { if [[ -n ${3} ]]; then version=${3} elif [[ ${CATEGORY} = kde-apps ]]; then - version=${PV} - elif [[ -z "${version}" ]] ; then + version=$(get_version_component_range 1-3) + elif [[ -z ${3} ]] ; then version=${KDE_APPS_MINIMAL} fi @@ -244,7 +251,7 @@ add_kdeapps_dep() { } # @FUNCTION: add_qt_dep -# @USAGE: [USE flags] [minimum version] +# @USAGE: [USE flags] [minimum version] [slot + operator] # @DESCRIPTION: # Create proper dependency for dev-qt/ dependencies. # This takes 1 to 4 arguments. The first being the package name, the optional @@ -262,15 +269,12 @@ add_qt_dep() { die "${FUNCNAME} was called with too many arguments" fi - local version + local version=${3} local slot=${4} - if [[ -n ${3} ]]; then - version=${3} - elif [[ -z "${version}" ]]; then + if [[ -z ${version} ]]; then version=${QT_MINIMAL} fi - if [[ -z ${slot} ]]; then slot="5" fi @@ -278,10 +282,13 @@ add_qt_dep() { _add_category_dep dev-qt "${1}" "${2}" "${version}" "${slot}" } -# @FUNCTION: get_kde_version +# @FUNCTION: get_kde_version [version] # @DESCRIPTION: -# Translates an ebuild version into a major.minor KDE SC -# release version. If no version is specified, ${PV} is used. +# Translates an ebuild version into a major.minor KDE release version, taking +# into account KDE's prerelease versioning scheme. +# For example, get_kde_version 17.07.80 will return "17.08". +# If the version equals 9999, "live" is returned. +# If no version is specified, ${PV} is used. get_kde_version() { local ver=${1:-${PV}} local major=$(get_major_version ${ver}) diff --git a/eclass/kde5-meta-pkg.eclass b/eclass/kde5-meta-pkg.eclass index a79caf145f9c..feea480d9e17 100644 --- a/eclass/kde5-meta-pkg.eclass +++ b/eclass/kde5-meta-pkg.eclass @@ -4,9 +4,10 @@ # @ECLASS: kde5-meta-pkg.eclass # @MAINTAINER: # kde@gentoo.org -# @BLURB: This eclass contains boilerplate for KDE 5 meta packages +# @BLURB: This eclass contains boilerplate for KDE meta packages. # @DESCRIPTION: -# This eclass should only be used for defining meta packages for KDE 5. +# This eclass should only be used for defining meta packages bundling +# software produced by the KDE community. if [[ -z ${_KDE5_META_PKG_ECLASS} ]]; then _KDE5_META_PKG_ECLASS=1 diff --git a/eclass/kde5.eclass b/eclass/kde5.eclass index a72f2d23ce4a..17b480c44e33 100644 --- a/eclass/kde5.eclass +++ b/eclass/kde5.eclass @@ -4,9 +4,22 @@ # @ECLASS: kde5.eclass # @MAINTAINER: # kde@gentoo.org -# @BLURB: Support eclass for KDE 5-related packages. +# @BLURB: Support eclass for packages that follow KDE packaging conventions. # @DESCRIPTION: -# The kde5.eclass provides support for building KDE 5-related packages. +# This eclass is intended to streamline the creation of ebuilds for packages +# that follow KDE upstream packaging conventions. It's primarily intended for +# the three upstream release groups (Frameworks, Plasma, Applications) but +# is also for any package that follows similar conventions. +# +# This eclass unconditionally inherits kde5-functions.eclass and all its public +# functions and variables may be considered as part of this eclass's API. +# +# This eclass unconditionally inherits cmake-utils.eclass and all its public +# variables and helper functions (not phase functions) may be considered as part +# of this eclass's API. +# +# This eclass's phase functions are not intended to be mixed and matched, so if +# any phase functions are overriden the version here should also be called. if [[ -z ${_KDE5_ECLASS} ]]; then _KDE5_ECLASS=1 @@ -35,19 +48,22 @@ EXPORT_FUNCTIONS pkg_setup pkg_nofetch src_unpack src_prepare src_configure src_ # @ECLASS-VARIABLE: KDE_AUTODEPS # @DESCRIPTION: # If set to "false", do nothing. -# For any other value, add a dependency on dev-qt/qtcore:5 and kde-frameworks/extra-cmake-modules:5. +# For any other value, add dependencies on dev-qt/qtcore:5, kde-frameworks/kf-env +# and kde-frameworks/extra-cmake-modules:5. Additionally, required blockers may +# be set depending on the value of CATEGORY. : ${KDE_AUTODEPS:=true} # @ECLASS-VARIABLE: KDE_BLOCK_SLOT4 # @DESCRIPTION: -# This variable is used when KDE_AUTODEPS is set. -# If set to "true", add RDEPEND block on kde-apps/${PN}:4 +# This variable only has any effect when when CATEGORY = "kde-apps" and +# KDE_AUTODEPS is also set. If set to "true", add RDEPEND block on kde-apps/${PN}:4 : ${KDE_BLOCK_SLOT4:=true} # @ECLASS-VARIABLE: KDE_DEBUG # @DESCRIPTION: -# If set to "false", unconditionally build with -DNDEBUG. -# Otherwise, add debug to IUSE to control building with that flag. +# If set to "false", add -DNDEBUG (via cmake-utils_src_configure) and -DQT_NO_DEBUG +# to CPPFLAGS. +# Otherwise, add debug to IUSE. : ${KDE_DEBUG:=true} # @ECLASS-VARIABLE: KDE_DESIGNERPLUGIN @@ -76,7 +92,7 @@ EXPORT_FUNCTIONS pkg_setup pkg_nofetch src_unpack src_prepare src_configure src_ # @ECLASS-VARIABLE: KDE_DOC_DIR # @DESCRIPTION: -# Defaults to "doc". Otherwise, use alternative KDE handbook path. +# Specifies the location of the KDE handbook if not the default. : ${KDE_DOC_DIR:=doc} # @ECLASS-VARIABLE: KDE_QTHELP @@ -84,7 +100,7 @@ EXPORT_FUNCTIONS pkg_setup pkg_nofetch src_unpack src_prepare src_configure src_ # If set to "false", do nothing. # Otherwise, add "doc" to IUSE, add the appropriate dependency, generate # and install Qt compressed help files with -DBUILD_QCH=ON when USE=doc. -if [[ ${CATEGORY} = kde-frameworks && ( $(get_version_component_range 2) -ge 36 || ${KDE_BUILD_TYPE} = live ) ]]; then +if [[ ${CATEGORY} = kde-frameworks ]]; then : ${KDE_QTHELP:=true} else : ${KDE_QTHELP:=false} @@ -314,8 +330,6 @@ _calculate_src_uri() { case ${CATEGORY} in kde-apps) case ${PV} in - 16.12.3) - SRC_URI="mirror://kde/Attic/applications/16.12.3/src/${_kmname}-${PV}.tar.xz" ;; ??.?.[6-9]? | ??.??.[6-9]? ) SRC_URI="mirror://kde/unstable/applications/${PV}/src/${_kmname}-${PV}.tar.xz" RESTRICT+=" mirror" @@ -330,7 +344,7 @@ _calculate_src_uri() { local plasmapv=$(get_version_component_range 1-3) case ${PV} in - 5.?.[6-9]? ) + 5.?.[6-9]? | 5.??.[6-9]? ) # Plasma 5 beta releases SRC_URI="mirror://kde/unstable/plasma/${plasmapv}/${_kmname}-${PV}.tar.xz" RESTRICT+=" mirror" @@ -417,7 +431,8 @@ debug-print "${LINENO} ${ECLASS} ${FUNCNAME}: SRC_URI is ${SRC_URI}" # @FUNCTION: kde5_pkg_pretend # @DESCRIPTION: -# Do some basic settings +# Checks if the active compiler meets the minimum version requirements. +# phase function is only exported if KDE_GCC_MINIMAL is defined. kde5_pkg_pretend() { debug-print-function ${FUNCNAME} "$@" _check_gcc_version @@ -425,7 +440,7 @@ kde5_pkg_pretend() { # @FUNCTION: kde5_pkg_setup # @DESCRIPTION: -# Do some basic settings +# Checks if the active compiler meets the minimum version requirements. kde5_pkg_setup() { debug-print-function ${FUNCNAME} "$@" _check_gcc_version @@ -433,7 +448,9 @@ kde5_pkg_setup() { # @FUNCTION: kde5_pkg_nofetch # @DESCRIPTION: -# Display package publication status +# Intended for use in the KDE overlay. If this package matches something in +# KDE_UNRELEASED, display a giant warning that the package has not yet been +# released upstream and should not be used. kde5_pkg_nofetch() { if ! _kde_is_unreleased ; then return @@ -463,7 +480,7 @@ kde5_pkg_nofetch() { # @FUNCTION: kde5_src_unpack # @DESCRIPTION: -# Function for unpacking KDE 5. +# Unpack the sources, automatically handling both release and live ebuilds. kde5_src_unpack() { debug-print-function ${FUNCNAME} "$@" @@ -480,7 +497,8 @@ kde5_src_unpack() { # @FUNCTION: kde5_src_prepare # @DESCRIPTION: -# Function for preparing the KDE 5 sources. +# Wrapper for cmake-utils_src_prepare with lots of extra logic for magic +# handling of linguas, tests, handbook etc. kde5_src_prepare() { debug-print-function ${FUNCNAME} "$@" @@ -590,7 +608,8 @@ kde5_src_prepare() { # @FUNCTION: kde5_src_configure # @DESCRIPTION: -# Function for configuring the build of KDE 5. +# Wrapper for cmake-utils_src_configure with extra logic for magic handling of +# handbook, tests etc. kde5_src_configure() { debug-print-function ${FUNCNAME} "$@" @@ -601,7 +620,7 @@ kde5_src_configure() { local cmakeargs - if ! use_if_iuse test ; then + if in_iuse test && ! use test ; then cmakeargs+=( -DBUILD_TESTING=OFF ) if [[ ${KDE_TEST} = optional ]] ; then @@ -632,7 +651,8 @@ kde5_src_configure() { # @FUNCTION: kde5_src_compile # @DESCRIPTION: -# Function for compiling KDE 5. +# Wrapper for cmake-utils_src_compile. Currently doesn't do anything extra, but +# is included as part of the API just in case it's needed in the future. kde5_src_compile() { debug-print-function ${FUNCNAME} "$@" @@ -641,7 +661,8 @@ kde5_src_compile() { # @FUNCTION: kde5_src_test # @DESCRIPTION: -# Function for testing KDE 5. +# Wrapper for cmake-utils_src_test with extra logic for magic handling of dbus +# and virtualx. kde5_src_test() { debug-print-function ${FUNCNAME} "$@" @@ -672,7 +693,9 @@ kde5_src_test() { # @FUNCTION: kde5_src_install # @DESCRIPTION: -# Function for installing KDE 5. +# Wrapper for cmake-utils_src_install with extra logic to avoid compressing +# certain types of files. For example, khelpcenter is not able to read +# compressed handbooks. kde5_src_install() { debug-print-function ${FUNCNAME} "$@" @@ -695,7 +718,7 @@ kde5_src_install() { # @FUNCTION: kde5_pkg_preinst # @DESCRIPTION: -# Function storing icon caches +# Sets up environment variables required in kde5_pkg_postinst. kde5_pkg_preinst() { debug-print-function ${FUNCNAME} "$@" @@ -705,7 +728,7 @@ kde5_pkg_preinst() { # @FUNCTION: kde5_pkg_postinst # @DESCRIPTION: -# Function to rebuild the KDE System Configuration Cache after an application has been installed. +# Updates the various XDG caches (icon, desktop, mime) if necessary. kde5_pkg_postinst() { debug-print-function ${FUNCNAME} "$@" @@ -726,7 +749,7 @@ kde5_pkg_postinst() { # @FUNCTION: kde5_pkg_postrm # @DESCRIPTION: -# Function to rebuild the KDE System Configuration Cache after an application has been removed. +# Updates the various XDG caches (icon, desktop, mime) if necessary. kde5_pkg_postrm() { debug-print-function ${FUNCNAME} "$@" diff --git a/eclass/meson.eclass b/eclass/meson.eclass index b339017f9017..be1055a3fe57 100644 --- a/eclass/meson.eclass +++ b/eclass/meson.eclass @@ -125,6 +125,7 @@ _meson_create_cross_file() { ar = '${AR}' c = '${CC}' cpp = '${CXX}' + pkgconfig = '${PKG_CONFIG}' strip = '${STRIP}' [host_machine] @@ -155,6 +156,7 @@ meson_src_configure() { local -x AR=$(tc-getAR) local -x CC=$(tc-getCC) local -x CXX=$(tc-getCXX) + local -x PKG_CONFIG=$(tc-getPKG_CONFIG) local -x STRIP=$(tc-getSTRIP) if tc-is-cross-compiler; then @@ -166,6 +168,7 @@ meson_src_configure() { AR=$(tc-getBUILD_AR) CC=$(tc-getBUILD_CC) CXX=$(tc-getBUILD_CXX) + PKG_CONFIG=$(tc-getBUILD_PKG_CONFIG) STRIP=$(tc-getBUILD_STRIP) fi diff --git a/eclass/mysql-multilib-r1.eclass b/eclass/mysql-multilib-r1.eclass index 6c88c7198937..cfe684bc5db1 100644 --- a/eclass/mysql-multilib-r1.eclass +++ b/eclass/mysql-multilib-r1.eclass @@ -887,7 +887,7 @@ mysql-multilib-r1_pkg_config() { ${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null for opt in grant-tables host-cache name-resolve networking slave-start \ federated ssl log-bin relay-log slow-query-log external-locking \ - ndbcluster log-slave-updates \ + ndbcluster log-slave-updates wsrep-on \ ; do optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" diff --git a/eclass/mysql-multilib.eclass b/eclass/mysql-multilib.eclass index a5a0b0b4ed42..1ba8ad36e037 100644 --- a/eclass/mysql-multilib.eclass +++ b/eclass/mysql-multilib.eclass @@ -1044,7 +1044,7 @@ mysql-multilib_pkg_config() { ${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null for opt in grant-tables host-cache name-resolve networking slave-start \ federated ssl log-bin relay-log slow-query-log external-locking \ - ndbcluster log-slave-updates \ + ndbcluster log-slave-updates wsrep-on \ ; do optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" diff --git a/eclass/mysql-v2.eclass b/eclass/mysql-v2.eclass index fe379980a800..94a36dc43547 100644 --- a/eclass/mysql-v2.eclass +++ b/eclass/mysql-v2.eclass @@ -795,7 +795,7 @@ mysql-v2_pkg_config() { ${EROOT}/usr/sbin/mysqld --verbose --help >"${helpfile}" 2>/dev/null for opt in grant-tables host-cache name-resolve networking slave-start \ federated ssl log-bin relay-log slow-query-log external-locking \ - ndbcluster log-slave-updates \ + ndbcluster log-slave-updates wsrep-on \ ; do optexp="--(skip-)?${opt}" optfull="--loose-skip-${opt}" egrep -sq -- "${optexp}" "${helpfile}" && options="${options} ${optfull}" diff --git a/eclass/toolchain.eclass b/eclass/toolchain.eclass index a18e8042641c..9dca44439c9d 100644 --- a/eclass/toolchain.eclass +++ b/eclass/toolchain.eclass @@ -239,7 +239,7 @@ S=$( gentoo_urls() { local devspace="HTTP~vapier/dist/URI HTTP~rhill/dist/URI HTTP~zorry/patches/gcc/URI HTTP~blueness/dist/URI - HTTP~tamiko/distfiles/URI" + HTTP~tamiko/distfiles/URI HTTP~slyfox/distfiles/URI" devspace=${devspace//HTTP/https:\/\/dev.gentoo.org\/} echo mirror://gentoo/$1 ${devspace//URI/$1} } diff --git a/eclass/vim-plugin.eclass b/eclass/vim-plugin.eclass index cdc24a15cf6f..abe9c7b3661b 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 @@ -11,7 +11,7 @@ # 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 estack vim-doc EXPORT_FUNCTIONS src_install pkg_postinst pkg_postrm VIM_PLUGIN_VIM_VERSION="${VIM_PLUGIN_VIM_VERSION:-7.3}" @@ -25,6 +25,12 @@ if [[ ${PV} != 9999* ]] ; then fi SLOT="0" +# @FUNCTION: vim-plugin_src_install +# @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}" local f @@ -42,11 +48,27 @@ vim-plugin_src_install() { eend $? fi - # Remove unwanted files that may exist - rm -rf .[^.] .??* Makefile* + # 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 - cd "${S}" + cd "${S}" || die "couldn't cd in ${S}" + local f for f in *; do [[ -f "${f}" ]] || continue if [[ "${f}" = *.html ]]; then @@ -54,24 +76,37 @@ vim-plugin_src_install() { else dodoc "${f}" fi - rm -f "${f}" + rm "${f}" || die done # Install remainder of plugin - cd "${WORKDIR}" + cd "${WORKDIR}" || die "couldn't cd in ${WORKDIR}" dodir /usr/share/vim - mv "${S}" "${ED}"/usr/share/vim/vimfiles + mv "${S}" "${ED}"/usr/share/vim/vimfiles || die \ + "couldn't move ${S} to ${ED}/usr/share/vim/vimfiles" # Fix remaining bad permissions chmod -R -x+X "${ED}"/usr/share/vim/vimfiles/ || die "chmod failed" } +# @FUNCTION: vim-plugin_pkg_postinst +# @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() { update_vim_helptags # from vim-doc update_vim_afterscripts # see below display_vim_plugin_help # see below } +# @FUNCTION: vim-plugin_pkg_postrm +# @DESCRIPTION: +# Overrides the pkg_postrm phase for this eclass. +# 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 @@ -79,12 +114,14 @@ 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}/usr/share/vim/vimfiles" -depth -type d -exec rmdir {} \; 2>/dev/null || \ + die "rmdir failed" } -# update_vim_afterscripts: create scripts in -# /usr/share/vim/vimfiles/after/* comprised of the snippets in -# /usr/share/vim/vimfiles/after/*/*.d +# @FUNCTION: update_vim_afterscripts +# @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= @@ -94,11 +131,10 @@ update_vim_afterscripts() { [ -d "${afterdir}" ] || return 0 einfo "Updating scripts in ${EPREFIX}/usr/share/vim/vimfiles/after" - find "${afterdir}" -type d -name \*.vim.d | \ - while read d; do - echo '" Generated by update_vim_afterscripts' > "${d%.d}" - find "${d}" -name \*.vim -type f -maxdepth 1 -print0 | \ - sort -z | xargs -0 cat >> "${d%.d}" + 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" @@ -110,18 +146,20 @@ update_vim_afterscripts() { # if there's no corresponding .d directory, or if the # file's effectively empty if [[ ! -d "${f}.d" || -z "$(grep -v '^"' "${f}")" ]]; then - rm -f "${f}" + rm "${f}" || die fi done } -# Display a message with the plugin's help file if one is available. Uses the +# @FUNCTION: display_vim_plugin_help +# @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 # should be separated by spaces. If no help files are available, but the env # var VIM_PLUGIN_HELPTEXT is set, that is displayed instead. Finally, if we -# have nothing else, display a link to VIM_PLUGIN_HELPURI. An extra message -# regarding enabling filetype plugins is displayed if VIM_PLUGIN_MESSAGES -# includes the word "filetype". +# have nothing else, this functions displays a link to VIM_PLUGIN_HELPURI. An +# extra message regarding enabling filetype plugins is displayed if +# VIM_PLUGIN_MESSAGES includes the word "filetype". display_vim_plugin_help() { local h -- cgit v1.2.3