From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id DCEA31387B1 for ; Mon, 20 Jan 2014 17:54:47 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 91D4AE1062; Mon, 20 Jan 2014 17:53:28 +0000 (UTC) Received: from mail-ea0-f171.google.com (mail-ea0-f171.google.com [209.85.215.171]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id C273BE1059 for ; Mon, 20 Jan 2014 17:53:27 +0000 (UTC) Received: by mail-ea0-f171.google.com with SMTP id h10so3236111eak.16 for ; Mon, 20 Jan 2014 09:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:in-reply-to:references; bh=rGkjlCVd7ys/+Vjcb4KzoZVHMyLWVV4FyUbsHJnl9ho=; b=V76b4oeOSe8sVIcrFgD3Qxpp0HgIo2dQLMXN50Vn1qNUcdLIKkK4OFKQRQ5Pst8dnL j+X7BO2FQkztfXqhuq3Y+BornbIK7l1w9MYu8r/hGXDGd/JFS7Kt7zezj9+tXwxzLWKv 25qyFYF4dDal3G0zH5/GN0XCt/KhoEJ+qeCX4lI3mIS8xKGoMGRj1EkETFv73Ai9A6Gr 3TJPlidRS+/nWpez8po7pZxte4CmxUIbxL0OgxXVQuK9lGgQP2DZd3zZCCskFLR3VzV3 IhU+/PBDm65hh1k2/lpgkZcd4RaDrydgxItpgSBi0eEWoXiAF8anOXsnjAyiu2CXyhTf DjzQ== X-Received: by 10.15.43.10 with SMTP id w10mr19208894eev.13.1390240406518; Mon, 20 Jan 2014 09:53:26 -0800 (PST) Received: from localhost.localdomain (dsl-trebrasgw2-58c0d8-67.dhcp.inet.fi. [88.192.216.67]) by mx.google.com with ESMTPSA id o47sm5514777eem.21.2014.01.20.09.53.25 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 20 Jan 2014 09:53:26 -0800 (PST) From: Reinis Danne To: gentoo-science@lists.gentoo.org Subject: [gentoo-science] [PATCH 08/10] alternatives-2.eclass: Add documentation comments Date: Mon, 20 Jan 2014 19:53:10 +0200 Message-Id: <1390240392-12173-9-git-send-email-rei4dan@gmail.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1390240392-12173-1-git-send-email-rei4dan@gmail.com> References: <1390240392-12173-1-git-send-email-rei4dan@gmail.com> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-science@lists.gentoo.org Reply-to: gentoo-science@lists.gentoo.org X-Archives-Salt: 9af7177a-6488-456c-9b41-8dbc4be87199 X-Archives-Hash: 2fe8baf7bb4d64a972a05a216005418d --- eclass/alternatives-2.eclass | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/eclass/alternatives-2.eclass b/eclass/alternatives-2.eclass index 5128e11..e15edfa 100644 --- a/eclass/alternatives-2.eclass +++ b/eclass/alternatives-2.eclass @@ -7,6 +7,12 @@ # Copyright 2008, 2009 Mike Kelly # Copyright 2009 David Leverton +# @ECLASS: alternatives-2 +# @MAINTAINER: +# Gentoo Science Project +# @BLURB: Manage alternative implementations. +# @DESCRIPTION: +# # If your package provides pkg_postinst or pkg_prerm phases, you need to be # sure you explicitly run alternatives-2_pkg_{postinst,prerm} where appropriate. @@ -21,8 +27,6 @@ case "${EAPI:-0}" in ;; esac -ALTERNATIVES_DIR="/etc/env.d/alternatives" - DEPEND=">=app-admin/eselect-1.4-r100" RDEPEND="${DEPEND} !app-admin/eselect-blas @@ -31,9 +35,24 @@ RDEPEND="${DEPEND} EXPORT_FUNCTIONS pkg_postinst pkg_prerm -# alternatives_for alternative provider importance source target [ source target [...]] -alternatives_for() { +# @ECLASS-VARIABLE: ALTERNATIVES_DIR +# @INTERNAL +# @DESCRIPTION: +# Alternatives directory with symlinks managed by eselect. +ALTERNATIVES_DIR="/etc/env.d/alternatives" +# @FUNCTION: alternatives_for +# @USAGE: alternative provider importance source target [source target [...]] +# @DESCRIPTION: +# Set up alternative provider. +# +# EXAMPLE: +# @CODE +# alternatives_for cblas atlas 0 \ +# /usr/$(get_libdir)/pkgconfig/cblas.pc atlas-cblas.pc \ +# /usr/include/cblas.h atlas/cblas.h +# @CODE +alternatives_for() { (( $# >= 5 )) && (( ($#-3)%2 == 0)) || die "${FUNCNAME} requires exactly 3+N*2 arguments where N>=1" local alternative=${1} provider=${2} importance=${3} index src target ret=0 shift 3 @@ -106,6 +125,10 @@ alternatives_for() { [[ ${ret} -eq 0 ]] || die "Errors detected for ${provider}, provided for ${alternative}" } +# @FUNCTION: cleanup_old_alternatives_module +# @USAGE: alternative +# @DESCRIPTION: +# Remove old alternatives module. cleanup_old_alternatives_module() { local alt=${1} old_module="${EROOT%/}/usr/share/eselect/modules/${alt}.eselect" if [[ -f "${old_module}" && "$(source "${old_module}" &>/dev/null; echo "${ALTERNATIVE}")" == "${alt}" ]]; then @@ -117,6 +140,11 @@ cleanup_old_alternatives_module() { fi } +# @FUNCTION: alternatives-2_pkg_postinst +# @DESCRIPTION: +# Create eselect modules for all provided alternatives. +# +# Provided alternatives are set up using alternatives_for(). alternatives-2_pkg_postinst() { local a alt provider module_version="20090908" local EAUTO="${EROOT%/}/usr/share/eselect/modules/auto" @@ -149,6 +177,11 @@ alternatives-2_pkg_postinst() { done } +# @FUNCTION: alternatives-2_pkg_prerm +# @DESCRIPTION: +# Remove autogenerated eselect modules for all alternatives. +# +# Provided alternatives are set up using alternatives_for(). alternatives-2_pkg_prerm() { local a alt provider ignore local EAUTO="${EROOT%/}/usr/share/eselect/modules/auto" -- 1.8.5.3