From 56bd759df1d0c750a065b8c845e93d5dfa6b549d Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Sat, 8 Aug 2015 13:49:04 -0700 Subject: proj/gentoo: Initial commit MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This commit represents a new era for Gentoo: Storing the gentoo-x86 tree in Git, as converted from CVS. This commit is the start of the NEW history. Any historical data is intended to be grafted onto this point. Creation process: 1. Take final CVS checkout snapshot 2. Remove ALL ChangeLog* files 3. Transform all Manifests to thin 4. Remove empty Manifests 5. Convert all stale $Header$/$Id$ CVS keywords to non-expanded Git $Id$ 5.1. Do not touch files with -kb/-ko keyword flags. Signed-off-by: Robin H. Johnson X-Thanks: Alec Warner - did the GSoC 2006 migration tests X-Thanks: Robin H. Johnson - infra guy, herding this project X-Thanks: Nguyen Thai Ngoc Duy - Former Gentoo developer, wrote Git features for the migration X-Thanks: Brian Harring - wrote much python to improve cvs2svn X-Thanks: Rich Freeman - validation scripts X-Thanks: Patrick Lauer - Gentoo dev, running new 2014 work in migration X-Thanks: Michał Górny - scripts, QA, nagging X-Thanks: All of other Gentoo developers - many ideas and lots of paint on the bikeshed --- eclass/bash-completion-r1.eclass | 134 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 eclass/bash-completion-r1.eclass (limited to 'eclass/bash-completion-r1.eclass') diff --git a/eclass/bash-completion-r1.eclass b/eclass/bash-completion-r1.eclass new file mode 100644 index 000000000000..255197361229 --- /dev/null +++ b/eclass/bash-completion-r1.eclass @@ -0,0 +1,134 @@ +# Copyright 1999-2014 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Id$ + +# @ECLASS: bash-completion-r1.eclass +# @MAINTAINER: +# mgorny@gentoo.org +# @BLURB: A few quick functions to install bash-completion files +# @EXAMPLE: +# +# @CODE +# EAPI=5 +# +# src_configure() { +# econf \ +# --with-bash-completion-dir="$(get_bashcompdir)" +# } +# +# src_install() { +# default +# +# newbashcomp contrib/${PN}.bash-completion ${PN} +# } +# @CODE + +inherit toolchain-funcs + +case ${EAPI:-0} in + 0|1|2|3|4|5) ;; + *) die "EAPI ${EAPI} unsupported (yet)." +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="$($(tc-getPKG_CONFIG) --variable=$1 bash-completion)" + # 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: file [...] +# @DESCRIPTION: +# Install bash-completion files passed as args. Has EAPI-dependant failure +# behavior (like doins). +dobashcomp() { + debug-print-function ${FUNCNAME} "${@}" + + ( + insinto "$(_bash-completion-r1_get_bashcompdir)" + doins "${@}" + ) +} + +# @FUNCTION: newbashcomp +# @USAGE: file newname +# @DESCRIPTION: +# Install bash-completion file under a new name. Has EAPI-dependant failure +# behavior (like newins). +newbashcomp() { + debug-print-function ${FUNCNAME} "${@}" + + ( + 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}" + done +} -- cgit v1.2.3-18-g5258