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 9F4DC13933E for ; Fri, 16 Jul 2021 18:37:00 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 627D7E0A04; Fri, 16 Jul 2021 18:36:54 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 0EA03E09AD for ; Fri, 16 Jul 2021 18:36:54 +0000 (UTC) From: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= To: gentoo-dev@lists.gentoo.org Cc: =?UTF-8?q?Micha=C5=82=20G=C3=B3rny?= Subject: [gentoo-dev] [PATCH v4] bash-completion-r1.eclass: Add EAPI 8 support Date: Fri, 16 Jul 2021 20:36:48 +0200 Message-Id: <20210716183648.233743-1-mgorny@gentoo.org> X-Mailer: git-send-email 2.32.0 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 X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Archives-Salt: 357a1d1f-d313-4c99-bace-fb2255c6a40c X-Archives-Hash: 7fefc984f7adee3ed58f6aedb61bf063 Signed-off-by: Michał Górny --- eclass/bash-completion-r1.eclass | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/eclass/bash-completion-r1.eclass b/eclass/bash-completion-r1.eclass index 80f2d5fcd32a..a9bac0ffae42 100644 --- a/eclass/bash-completion-r1.eclass +++ b/eclass/bash-completion-r1.eclass @@ -1,138 +1,143 @@ # Copyright 1999-2021 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 # @ECLASS: bash-completion-r1.eclass # @MAINTAINER: # mgorny@gentoo.org -# @SUPPORTED_EAPIS: 0 1 2 3 4 5 6 7 +# @SUPPORTED_EAPIS: 5 6 7 8 # @BLURB: A few quick functions to install bash-completion files # @EXAMPLE: # # @CODE -# EAPI=5 +# EAPI=8 # # src_configure() { # econf \ # --with-bash-completion-dir="$(get_bashcompdir)" # } # # src_install() { # default # # newbashcomp contrib/${PN}.bash-completion ${PN} # } # @CODE +if [[ ! ${_BASH_COMPLETION_R1_ECLASS} ]]; then + inherit toolchain-funcs -case ${EAPI:-0} in - 0|1|2|3|4|5|6|7) ;; - *) die "EAPI ${EAPI} unsupported (yet)." +case ${EAPI} in + 5|6|7|8) ;; + *) die "${ECLASS}: EAPI ${EAPI} unsupported." esac # @FUNCTION: _bash-completion-r1_get_bashdir # @INTERNAL # @DESCRIPTION: # First argument is name of the string in bash-completion.pc # Second argument is the fallback directory if the string is not found # @EXAMPLE: # _bash-completion-r1_get_bashdir completionsdir /usr/share/bash-completion _bash-completion-r1_get_bashdir() { debug-print-function ${FUNCNAME} "${@}" if $(tc-getPKG_CONFIG) --exists bash-completion &>/dev/null; then local path path=$($(tc-getPKG_CONFIG) --variable="${1}" bash-completion) || die # we need to return unprefixed, so strip from what pkg-config returns # to us, bug #477692 echo "${path#${EPREFIX}}" else echo "${2}" fi } # @FUNCTION: _bash-completion-r1_get_bashcompdir # @INTERNAL # @DESCRIPTION: # Get unprefixed bash-completion completions directory. _bash-completion-r1_get_bashcompdir() { debug-print-function ${FUNCNAME} "${@}" _bash-completion-r1_get_bashdir completionsdir /usr/share/bash-completion/completions } # @FUNCTION: _bash-completion-r1_get_helpersdir # @INTERNAL # @DESCRIPTION: # Get unprefixed bash-completion helpers directory. _bash-completion-r1_get_bashhelpersdir() { debug-print-function ${FUNCNAME} "${@}" _bash-completion-r1_get_bashdir helpersdir /usr/share/bash-completion/helpers } # @FUNCTION: get_bashcompdir # @DESCRIPTION: # Get the bash-completion completions directory. get_bashcompdir() { debug-print-function ${FUNCNAME} "${@}" echo "${EPREFIX}$(_bash-completion-r1_get_bashcompdir)" } # @FUNCTION: get_bashhelpersdir # @INTERNAL # @DESCRIPTION: # Get the bash-completion helpers directory. get_bashhelpersdir() { debug-print-function ${FUNCNAME} "${@}" echo "${EPREFIX}$(_bash-completion-r1_get_bashhelpersdir)" } # @FUNCTION: dobashcomp # @USAGE: [...] # @DESCRIPTION: # Install bash-completion files passed as args. Has EAPI-dependent failure # behavior (like doins). dobashcomp() { debug-print-function ${FUNCNAME} "${@}" ( insopts -m 0644 insinto "$(_bash-completion-r1_get_bashcompdir)" doins "${@}" ) } # @FUNCTION: newbashcomp # @USAGE: # @DESCRIPTION: # Install bash-completion file under a new name. Has EAPI-dependent failure # behavior (like newins). newbashcomp() { debug-print-function ${FUNCNAME} "${@}" ( insopts -m 0644 insinto "$(_bash-completion-r1_get_bashcompdir)" newins "${@}" ) } # @FUNCTION: bashcomp_alias # @USAGE: ... # @DESCRIPTION: # Alias completion to one or more commands (es). bashcomp_alias() { debug-print-function ${FUNCNAME} "${@}" [[ ${#} -lt 2 ]] && die "Usage: ${FUNCNAME} ..." local base=${1} f shift for f; do dosym "${base}" "$(_bash-completion-r1_get_bashcompdir)/${f}" \ || return done } + +_BASH_COMPLETION_R1_ECLASS=1 +fi -- 2.32.0