/[gentoo-x86]/eclass/eutils.eclass
Gentoo

Diff of /eclass/eutils.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.432 Revision 1.433
1# Copyright 1999-2013 Gentoo Foundation 1# Copyright 1999-2013 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.432 2014/03/15 00:47:42 creffett Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.433 2014/04/27 18:58:07 vapier Exp $
4 4
5# @ECLASS: eutils.eclass 5# @ECLASS: eutils.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# base-system@gentoo.org 7# base-system@gentoo.org
8# @BLURB: many extra (but common) functions that are used in ebuilds 8# @BLURB: many extra (but common) functions that are used in ebuilds
1736# provide the described functionality 1736# provide the described functionality
1737# 1737#
1738# The following snippet would suggest app-misc/foo for optional foo support, 1738# The following snippet would suggest app-misc/foo for optional foo support,
1739# app-misc/bar or app-misc/baz[bar] for optional bar support 1739# app-misc/bar or app-misc/baz[bar] for optional bar support
1740# and either both app-misc/a and app-misc/b or app-misc/c for alphabet support. 1740# and either both app-misc/a and app-misc/b or app-misc/c for alphabet support.
1741# @CODE: 1741# @CODE
1742# optfeature "foo support" app-misc/foo 1742# optfeature "foo support" app-misc/foo
1743# optfeature "bar support" app-misc/bar app-misc/baz[bar] 1743# optfeature "bar support" app-misc/bar app-misc/baz[bar]
1744# optfeature "alphabet support" "app-misc/a app-misc/b" app-misc/c 1744# optfeature "alphabet support" "app-misc/a app-misc/b" app-misc/c
1745# 1745# @CODE
1746optfeature() { 1746optfeature() {
1747 debug-print-function ${FUNCNAME} "$@" 1747 debug-print-function ${FUNCNAME} "$@"
1748 local i j msg 1748 local i j msg
1749 local desc=$1 1749 local desc=$1
1750 local flag=0 1750 local flag=0
1751 shift 1751 shift
1752 for i; do 1752 for i; do
1753 for j in $i; do 1753 for j in ${i}; do
1754 if has_version "$j"; then 1754 if has_version "${j}"; then
1755 flag=1 1755 flag=1
1756 else 1756 else
1757 flag=0 1757 flag=0
1758 break 1758 break
1759 fi 1759 fi
1760 done 1760 done
1761 if [[ $flag -eq 1 ]]; then 1761 if [[ ${flag} -eq 1 ]]; then
1762 break 1762 break
1763 fi 1763 fi
1764 done 1764 done
1765 if [[ $flag -eq 0 ]]; then 1765 if [[ ${flag} -eq 0 ]]; then
1766 for i; do 1766 for i; do
1767 msg=" " 1767 msg=" "
1768 for j in $i; do 1768 for j in ${i}; do
1769 msg="${msg} ${j} and" 1769 msg+=" ${j} and"
1770 done 1770 done
1771 msg="${msg:0: -4} for ${desc}" 1771 msg="${msg:0: -4} for ${desc}"
1772 elog "${msg}" 1772 elog "${msg}"
1773 done 1773 done
1774 fi 1774 fi

Legend:
Removed from v.1.432  
changed lines
  Added in v.1.433

  ViewVC Help
Powered by ViewVC 1.1.20