| 1 | # Copyright 1999-2006 Gentoo Foundation |
1 | # Copyright 1999-2006 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.268 2007/01/13 19:36:14 vapier Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.270 2007/01/20 06:24:17 vapier Exp $ |
| 4 | # |
4 | # |
| 5 | # This eclass is for general purpose functions that most ebuilds |
5 | # This eclass is for general purpose functions that most ebuilds |
| 6 | # have to implement themselves. |
6 | # have to implement themselves. |
| 7 | # |
7 | # |
| 8 | # NB: If you add anything, please comment it! |
8 | # NB: If you add anything, please comment it! |
| … | |
… | |
| 253 | einfo "${EPATCH_SINGLE_MSG}" |
253 | einfo "${EPATCH_SINGLE_MSG}" |
| 254 | else |
254 | else |
| 255 | einfo "Applying ${patchname} ..." |
255 | einfo "Applying ${patchname} ..." |
| 256 | fi |
256 | fi |
| 257 | else |
257 | else |
| 258 | einfo " ${patchname} ..." |
258 | einfo " ${patchname} ..." |
| 259 | fi |
259 | fi |
| 260 | |
260 | |
| 261 | echo "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} |
261 | echo "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} |
| 262 | echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} |
262 | echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} |
| 263 | |
263 | |
| … | |
… | |
| 1590 | } |
1590 | } |
| 1591 | |
1591 | |
| 1592 | # Hack for people to figure out if a package was built with |
1592 | # Hack for people to figure out if a package was built with |
| 1593 | # certain USE flags |
1593 | # certain USE flags |
| 1594 | # |
1594 | # |
| 1595 | # Usage: built_with_use [-a|-o] <DEPEND ATOM> <List of USE flags> |
1595 | # Usage: built_with_use [--missing <action>] [-a|-o] <DEPEND ATOM> <List of USE flags> |
| 1596 | # ex: built_with_use xchat gtk2 |
1596 | # ex: built_with_use xchat gtk2 |
| 1597 | # |
1597 | # |
| 1598 | # Flags: -a all USE flags should be utilized |
1598 | # Flags: -a all USE flags should be utilized |
| 1599 | # -o at least one USE flag should be utilized |
1599 | # -o at least one USE flag should be utilized |
|
|
1600 | # --missing peform the specified action if the flag is not in IUSE (true/false/die) |
| 1600 | # Note: the default flag is '-a' |
1601 | # Note: the default flag is '-a' |
| 1601 | built_with_use() { |
1602 | built_with_use() { |
|
|
1603 | local missing_action="die" |
|
|
1604 | if [[ $1 == "--missing" ]] ; then |
|
|
1605 | missing_action=$2 |
|
|
1606 | shift ; shift |
|
|
1607 | case ${missing_action} in |
|
|
1608 | true|false|die) ;; |
|
|
1609 | *) die "unknown action '${missing_action}'";; |
|
|
1610 | esac |
|
|
1611 | fi |
|
|
1612 | |
| 1602 | local opt=$1 |
1613 | local opt=$1 |
| 1603 | [[ ${opt:0:1} = "-" ]] && shift || opt="-a" |
1614 | [[ ${opt:0:1} = "-" ]] && shift || opt="-a" |
| 1604 | |
1615 | |
| 1605 | local PKG=$(best_version $1) |
1616 | local PKG=$(best_version $1) |
| 1606 | [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package" |
1617 | [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package" |
| … | |
… | |
| 1621 | expand="" |
1632 | expand="" |
| 1622 | break |
1633 | break |
| 1623 | fi |
1634 | fi |
| 1624 | done |
1635 | done |
| 1625 | if [[ -n ${expand} ]] ; then |
1636 | if [[ -n ${expand} ]] ; then |
|
|
1637 | if ! has $1 ${IUSE_BUILT} ; then |
|
|
1638 | case ${missing_action} in |
|
|
1639 | true) return 0;; |
|
|
1640 | false) return 1;; |
| 1626 | has $1 ${IUSE_BUILT} || die "$PKG does not actually support the $1 USE flag!" |
1641 | die) die "$PKG does not actually support the $1 USE flag!";; |
|
|
1642 | esac |
|
|
1643 | fi |
| 1627 | fi |
1644 | fi |
| 1628 | |
1645 | |
| 1629 | local USE_BUILT=$(<${USEFILE}) |
1646 | local USE_BUILT=$(<${USEFILE}) |
| 1630 | while [[ $# -gt 0 ]] ; do |
1647 | while [[ $# -gt 0 ]] ; do |
| 1631 | if [[ ${opt} = "-o" ]] ; then |
1648 | if [[ ${opt} = "-o" ]] ; then |