Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 498988 | Differences between
and this patch

Collapse All | Expand All

(-)eutils.eclass (+67 lines)
Lines 1729-1732 Link Here
1729
1729
1730
check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; }
1730
check_license() { die "you no longer need this as portage supports ACCEPT_LICENSE itself"; }
1731
1731
1732
# @FUNCTION: optfeature
1733
# @USAGE: <short description> <package atom to match> [other atoms]
1734
# @DESCRIPTION:
1735
# Print out a message suggesting an optional package (or packages) which
1736
# provide the described functionality
1737
#
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
1740
# and either both app-misc/a and app-misc/b or app-misc/c for alphabet support.
1741
# @CODE:
1742
# 		optfeature "foo support" app-misc/foo
1743
# 		optfeature "bar support" app-misc/bar app-misc/baz[bar]
1744
#		optfeature "alphabet support" \( app-misc/a app-misc/b \) app-misc/c
1745
#
1746
optfeature() {
1747
	debug-print-function ${FUNCNAME} "$@"
1748
	local i
1749
	local desc=$1
1750
	local flag=0
1751
	local innercount=0
1752
	local innerflag=0
1753
	shift
1754
	for i; do
1755
		if [[ "$i" == "(" ]]; then		
1756
			innercount=0
1757
			innerflag=0
1758
			flag=2
1759
		elif [[ $flag -eq 2 ]]; then
1760
			if [[ "$i" == ")" ]]; then
1761
				if [[ $innercount -eq $innerflag ]]; then
1762
					flag=1
1763
					break
1764
				else
1765
					flag=0
1766
				fi
1767
			else
1768
				innercount=$((innercount+1))
1769
				if has_version $i; then
1770
					innerflag=$((innerflag+1))
1771
				fi
1772
			fi			
1773
		elif has_version "$i"; then
1774
			flag=1
1775
			break
1776
	
1777
		fi
1778
	done
1779
	if [[ $flag -eq 0 ]]; then
1780
		local andflag=0
1781
		local msg=""
1782
		for i in "$@"; do
1783
			if [[ "$i" == "(" ]]; then
1784
				andflag=1
1785
				msg=" "
1786
			elif [[ "$i" == ")" ]]; then
1787
				andflag=0
1788
				msg="${msg:0: -4} for ${desc}"
1789
				elog "${msg}"
1790
			elif [[ $andflag -eq 1 ]]; then
1791
				msg="${msg} ${i} and"
1792
			else
1793
				elog "  $i for ${desc}"
1794
			fi
1795
		done
1796
	fi
1797
}
1798
1732
fi
1799
fi

Return to bug 498988