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

Diff of /eclass/eutils.eclass

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

Revision 1.268 Revision 1.282
1# Copyright 1999-2006 Gentoo Foundation 1# Copyright 1999-2007 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.282 2007/06/16 07:11:43 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!
35 echo -ne "\a" 35 echo -ne "\a"
36 sleep 1 36 sleep 1
37 done 37 done
38 fi 38 fi
39} 39}
40
41# This function generate linker scripts in /usr/lib for dynamic
42# libs in /lib. This is to fix linking problems when you have
43# the .so in /lib, and the .a in /usr/lib. What happens is that
44# in some cases when linking dynamic, the .a in /usr/lib is used
45# instead of the .so in /lib due to gcc/libtool tweaking ld's
46# library search path. This cause many builds to fail.
47# See bug #4411 for more info.
48#
49# To use, simply call:
50#
51# gen_usr_ldscript libfoo.so
52#
53# Note that you should in general use the unversioned name of
54# the library, as ldconfig should usually update it correctly
55# to point to the latest version of the library present.
56#
57# <azarah@gentoo.org> (26 Oct 2002)
58#
59gen_usr_ldscript() {
60 if [[ $(type -t _tc_gen_usr_ldscript) == "function" ]] ; then
61 _tc_gen_usr_ldscript "$@"
62 return $?
63 fi
64
65 ewarn "QA Notice: Please upgrade your ebuild to use toolchain-funcs"
66 ewarn "QA Notice: rather than gen_usr_ldscript() from eutils"
67
68 local lib libdir=$(get_libdir)
69 # Just make sure it exists
70 dodir /usr/${libdir}
71
72 for lib in "${@}" ; do
73 cat > "${D}/usr/${libdir}/${lib}" <<-END_LDSCRIPT
74 /* GNU ld script
75 Since Gentoo has critical dynamic libraries
76 in /lib, and the static versions in /usr/lib,
77 we need to have a "fake" dynamic lib in /usr/lib,
78 otherwise we run into linking problems.
79
80 See bug http://bugs.gentoo.org/4411 for more info.
81 */
82 GROUP ( /${libdir}/${lib} )
83 END_LDSCRIPT
84 fperms a+x "/usr/${libdir}/${lib}" || die "could not change perms on ${lib}"
85 done
86}
87
88 40
89# Default directory where patches are located 41# Default directory where patches are located
90EPATCH_SOURCE="${WORKDIR}/patch" 42EPATCH_SOURCE="${WORKDIR}/patch"
91# Default extension for patches 43# Default extension for patches
92EPATCH_SUFFIX="patch.bz2" 44EPATCH_SUFFIX="patch.bz2"
253 einfo "${EPATCH_SINGLE_MSG}" 205 einfo "${EPATCH_SINGLE_MSG}"
254 else 206 else
255 einfo "Applying ${patchname} ..." 207 einfo "Applying ${patchname} ..."
256 fi 208 fi
257 else 209 else
258 einfo " ${patchname} ..." 210 einfo " ${patchname} ..."
259 fi 211 fi
260 212
261 echo "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} 213 echo "***** ${patchname} *****" > ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
262 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} 214 echo >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
263 215
366 [[ -z ${T} ]] \ 318 [[ -z ${T} ]] \
367 && topdir="/tmp" \ 319 && topdir="/tmp" \
368 || topdir=${T} 320 || topdir=${T}
369 fi 321 fi
370 322
371 if [[ -z $(type -p mktemp) ]] ; then 323 if ! type -P mktemp > /dev/null ; then
324 # system lacks `mktemp` so we have to fake it
372 local tmp=/ 325 local tmp=/
373 while [[ -e ${tmp} ]] ; do 326 while [[ -e ${tmp} ]] ; do
374 tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM} 327 tmp=${topdir}/tmp.${RANDOM}.${RANDOM}.${RANDOM}
375 done 328 done
376 ${exe} "${tmp}" || ${exe} -p "${tmp}" 329 ${exe} "${tmp}" || ${exe} -p "${tmp}"
377 echo "${tmp}" 330 echo "${tmp}"
378 else 331 else
332 # the args here will give slightly wierd names on BSD,
333 # but should produce a usable file on all userlands
379 if [[ ${exe} == "touch" ]] ; then 334 if [[ ${exe} == "touch" ]] ; then
380 [[ ${USERLAND} == "GNU" ]] \
381 && mktemp -p "${topdir}" \
382 || TMPDIR="${topdir}" mktemp -t tmp 335 TMPDIR="${topdir}" mktemp -t tmp.XXXXXXXXXX
383 else 336 else
384 [[ ${USERLAND} == "GNU" ]] \
385 && mktemp -d "${topdir}" \
386 || TMPDIR="${topdir}" mktemp -dt tmp 337 TMPDIR="${topdir}" mktemp -dt tmp.XXXXXXXXXX
387 fi 338 fi
388 fi 339 fi
389} 340}
390 341
391# Small wrapper for getent (Linux), nidump (Mac OS X), 342# Small wrapper for getent (Linux), nidump (Mac OS X),
892 if [ "${SLOT}" == "0" ] ; then 843 if [ "${SLOT}" == "0" ] ; then
893 local desktop_name="${PN}" 844 local desktop_name="${PN}"
894 else 845 else
895 local desktop_name="${PN}-${SLOT}" 846 local desktop_name="${PN}-${SLOT}"
896 fi 847 fi
897 local desktop=${T}/${exec%% *}-${desktop_name}.desktop 848 local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop"
898# local desktop=${T}/${exec%% *:-${desktop_name}}.desktop 849 #local desktop=${T}/${exec%% *:-${desktop_name}}.desktop
899 850
851 cat <<-EOF > "${desktop}"
900echo "[Desktop Entry] 852 [Desktop Entry]
901Encoding=UTF-8 853 Encoding=UTF-8
902Version=0.9.2 854 Version=0.9.2
903Name=${name} 855 Name=${name}
904Type=Application 856 Type=Application
905Comment=${DESCRIPTION} 857 Comment=${DESCRIPTION}
906Exec=${exec} 858 Exec=${exec}
907TryExec=${exec%% *} 859 TryExec=${exec%% *}
908Path=${path} 860 Path=${path}
909Icon=${icon} 861 Icon=${icon}
910Categories=Application;${type};" > "${desktop}" 862 Categories=Application;${type};
863 EOF
911 864
912 ( 865 (
913 # wrap the env here so that the 'insinto' call 866 # wrap the env here so that the 'insinto' call
914 # doesn't corrupt the env of the caller 867 # doesn't corrupt the env of the caller
915 insinto /usr/share/applications 868 insinto /usr/share/applications
916 doins "${desktop}" 869 doins "${desktop}"
917 ) 870 )
918} 871}
919 872
873
874# Validate desktop entries using desktop-file-utils
875# Carsten Lohrke <carlo@gentoo.org>
876#
877# Usage: validate_desktop_entries [directory ...]
878
879validate_desktop_entries() {
880 if [[ -x /usr/bin/desktop-file-validate ]] ; then
881 einfo "Checking desktop entry validity"
882 local directories=""
883 for d in /usr/share/applications $@ ; do
884 [[ -d ${D}${d} ]] && directories="${directories} ${D}${d}"
885 done
886 if [[ -n ${directories} ]] ; then
887 for FILE in $(find ${directories} -name "*\.desktop" \
888 -not -path '*.hidden*' | sort -u 2>/dev/null)
889 do
890 local temp=$(desktop-file-validate ${FILE} | grep -v "warning:" | \
891 sed -e "s|error: ||" -e "s|${FILE}:|--|g" )
892 [[ -n $temp ]] && elog ${temp/--/${FILE/${D}/}:}
893 done
894 fi
895 echo ""
896 else
897 einfo "Passing desktop entry validity check. Install dev-util/desktop-file-utils, if you want to help to improve Gentoo."
898 fi
899}
900
901
920# Make a GDM/KDM Session file 902# Make a GDM/KDM Session file
921# 903#
922# make_session_desktop(<title>, <command>) 904# make_session_desktop(<title>, <command>)
923# title: File to execute to start the Window Manager 905# title: File to execute to start the Window Manager
924# command: Name of the Window Manager 906# command: Name of the Window Manager
929 911
930 local title=$1 912 local title=$1
931 local command=$2 913 local command=$2
932 local desktop=${T}/${wm}.desktop 914 local desktop=${T}/${wm}.desktop
933 915
916 cat <<-EOF > "${desktop}"
934echo "[Desktop Entry] 917 [Desktop Entry]
935Encoding=UTF-8 918 Encoding=UTF-8
936Name=${title} 919 Name=${title}
937Comment=This session logs you into ${title} 920 Comment=This session logs you into ${title}
938Exec=${command} 921 Exec=${command}
939TryExec=${command} 922 TryExec=${command}
940Type=Application" > "${desktop}" 923 Type=Application
924 EOF
941 925
926 (
927 # wrap the env here so that the 'insinto' call
928 # doesn't corrupt the env of the caller
942 insinto /usr/share/xsessions 929 insinto /usr/share/xsessions
943 doins "${desktop}" 930 doins "${desktop}"
931 )
944} 932}
945 933
946domenu() { 934domenu() {
935 (
936 # wrap the env here so that the 'insinto' call
937 # doesn't corrupt the env of the caller
947 local i j 938 local i j ret=0
948 insinto /usr/share/applications 939 insinto /usr/share/applications
949 for i in "$@" ; do 940 for i in "$@" ; do
950 if [[ -f ${i} ]] ; then 941 if [[ -f ${i} ]] ; then
951 doins "${i}" 942 doins "${i}"
943 ((ret+=$?))
952 elif [[ -d ${i} ]] ; then 944 elif [[ -d ${i} ]] ; then
953 for j in "${i}"/*.desktop ; do 945 for j in "${i}"/*.desktop ; do
954 doins "${j}" 946 doins "${j}"
947 ((ret+=$?))
955 done 948 done
956 fi 949 fi
957 done 950 done
951 exit ${ret}
952 )
958} 953}
959newmenu() { 954newmenu() {
955 (
956 # wrap the env here so that the 'insinto' call
957 # doesn't corrupt the env of the caller
960 insinto /usr/share/applications 958 insinto /usr/share/applications
961 newins "$1" "$2" 959 newins "$@"
960 )
962} 961}
963 962
964doicon() { 963doicon() {
964 (
965 # wrap the env here so that the 'insinto' call
966 # doesn't corrupt the env of the caller
965 local i j 967 local i j ret
966 insinto /usr/share/pixmaps 968 insinto /usr/share/pixmaps
967 for i in "$@" ; do 969 for i in "$@" ; do
968 if [[ -f ${i} ]] ; then 970 if [[ -f ${i} ]] ; then
969 doins "${i}" 971 doins "${i}"
972 ((ret+=$?))
970 elif [[ -d ${i} ]] ; then 973 elif [[ -d ${i} ]] ; then
971 for j in "${i}"/*.png ; do 974 for j in "${i}"/*.png ; do
972 doins "${j}" 975 doins "${j}"
976 ((ret+=$?))
973 done 977 done
974 fi 978 fi
975 done 979 done
980 exit ${ret}
981 )
976} 982}
977newicon() { 983newicon() {
984 (
985 # wrap the env here so that the 'insinto' call
986 # doesn't corrupt the env of the caller
978 insinto /usr/share/pixmaps 987 insinto /usr/share/pixmaps
979 newins "$1" "$2" 988 newins "$@"
989 )
980} 990}
981 991
982############################################################## 992##############################################################
983# END: Handle .desktop files and menu entries # 993# END: Handle .desktop files and menu entries #
984############################################################## 994##############################################################
1021# lseek 1031# lseek
1022# root@vapier 0 pdv_unpack # strace -elseek ./hldsupdatetool.bin 1032# root@vapier 0 pdv_unpack # strace -elseek ./hldsupdatetool.bin
1023# lseek(3, -4, SEEK_END) = 2981250 1033# lseek(3, -4, SEEK_END) = 2981250
1024# thus we would pass in the value of '4' as the second parameter. 1034# thus we would pass in the value of '4' as the second parameter.
1025unpack_pdv() { 1035unpack_pdv() {
1026 local src=$(find_unpackable_file $1) 1036 local src=$(find_unpackable_file "$1")
1027 local sizeoff_t=$2 1037 local sizeoff_t=$2
1028 1038
1029 [[ -z ${src} ]] && die "Could not locate source for '$1'" 1039 [[ -z ${src} ]] && die "Could not locate source for '$1'"
1030 [[ -z ${sizeoff_t} ]] && die "No idea what off_t size was used for this pdv :(" 1040 [[ -z ${sizeoff_t} ]] && die "No idea what off_t size was used for this pdv :("
1031 1041
1032 local shrtsrc=$(basename "${src}") 1042 local shrtsrc=$(basename "${src}")
1033 echo ">>> Unpacking ${shrtsrc} to ${PWD}" 1043 echo ">>> Unpacking ${shrtsrc} to ${PWD}"
1034 local metaskip=`tail -c ${sizeoff_t} ${src} | hexdump -e \"%i\"` 1044 local metaskip=$(tail -c ${sizeoff_t} "${src}" | hexdump -e \"%i\")
1035 local tailskip=`tail -c $((${sizeoff_t}*2)) ${src} | head -c ${sizeoff_t} | hexdump -e \"%i\"` 1045 local tailskip=$(tail -c $((${sizeoff_t}*2)) "${src}" | head -c ${sizeoff_t} | hexdump -e \"%i\")
1036 1046
1037 # grab metadata for debug reasons 1047 # grab metadata for debug reasons
1038 local metafile="$(emktemp)" 1048 local metafile=$(emktemp)
1039 tail -c +$((${metaskip}+1)) ${src} > ${metafile} 1049 tail -c +$((${metaskip}+1)) "${src}" > "${metafile}"
1040 1050
1041 # rip out the final file name from the metadata 1051 # rip out the final file name from the metadata
1042 local datafile="`tail -c +$((${metaskip}+1)) ${src} | strings | head -n 1`" 1052 local datafile=$(tail -c +$((${metaskip}+1)) "${src}" | strings | head -n 1)
1043 datafile="`basename ${datafile}`" 1053 datafile=$(basename "${datafile}")
1044 1054
1045 # now lets uncompress/untar the file if need be 1055 # now lets uncompress/untar the file if need be
1046 local tmpfile="$(emktemp)" 1056 local tmpfile=$(emktemp)
1047 tail -c +$((${tailskip}+1)) ${src} 2>/dev/null | head -c 512 > ${tmpfile} 1057 tail -c +$((${tailskip}+1)) ${src} 2>/dev/null | head -c 512 > ${tmpfile}
1048 1058
1049 local iscompressed="`file -b ${tmpfile}`" 1059 local iscompressed=$(file -b "${tmpfile}")
1050 if [ "${iscompressed:0:8}" == "compress" ] ; then 1060 if [[ ${iscompressed:0:8} == "compress" ]] ; then
1051 iscompressed=1 1061 iscompressed=1
1052 mv ${tmpfile}{,.Z} 1062 mv ${tmpfile}{,.Z}
1053 gunzip ${tmpfile} 1063 gunzip ${tmpfile}
1054 else 1064 else
1055 iscompressed=0 1065 iscompressed=0
1056 fi 1066 fi
1057 local istar="`file -b ${tmpfile}`" 1067 local istar=$(file -b "${tmpfile}")
1058 if [ "${istar:0:9}" == "POSIX tar" ] ; then 1068 if [[ ${istar:0:9} == "POSIX tar" ]] ; then
1059 istar=1 1069 istar=1
1060 else 1070 else
1061 istar=0 1071 istar=0
1062 fi 1072 fi
1063 1073
1155 dd) exe="dd ibs=${skip} skip=1 obs=1024 conv=sync if='${src}'";; 1165 dd) exe="dd ibs=${skip} skip=1 obs=1024 conv=sync if='${src}'";;
1156 *) die "makeself cant handle exe '${exe}'" 1166 *) die "makeself cant handle exe '${exe}'"
1157 esac 1167 esac
1158 1168
1159 # lets grab the first few bytes of the file to figure out what kind of archive it is 1169 # lets grab the first few bytes of the file to figure out what kind of archive it is
1160 local tmpfile="$(emktemp)" 1170 local tmpfile=$(emktemp)
1161 eval ${exe} 2>/dev/null | head -c 512 > "${tmpfile}" 1171 eval ${exe} 2>/dev/null | head -c 512 > "${tmpfile}"
1162 local filetype="$(file -b "${tmpfile}")" 1172 local filetype=$(file -b "${tmpfile}")
1163 case ${filetype} in 1173 case ${filetype} in
1164 *tar\ archive*) 1174 *tar\ archive*)
1165 eval ${exe} | tar --no-same-owner -xf - 1175 eval ${exe} | tar --no-same-owner -xf -
1166 ;; 1176 ;;
1167 bzip2*) 1177 bzip2*)
1212 return 0 1222 return 0
1213 fi 1223 fi
1214 done 1224 done
1215 set +o noglob; set -$shopts #reset old shell opts 1225 set +o noglob; set -$shopts #reset old shell opts
1216 1226
1217 local licmsg="$(emktemp)" 1227 local licmsg=$(emktemp)
1218 cat << EOF > ${licmsg} 1228 cat <<-EOF > ${licmsg}
1219********************************************************** 1229 **********************************************************
1220The following license outlines the terms of use of this 1230 The following license outlines the terms of use of this
1221package. You MUST accept this license for installation to 1231 package. You MUST accept this license for installation to
1222continue. When you are done viewing, hit 'q'. If you 1232 continue. When you are done viewing, hit 'q'. If you
1223CTRL+C out of this, the install will not run! 1233 CTRL+C out of this, the install will not run!
1224********************************************************** 1234 **********************************************************
1225 1235
1226EOF 1236 EOF
1227 cat ${lic} >> ${licmsg} 1237 cat ${lic} >> ${licmsg}
1228 ${PAGER:-less} ${licmsg} || die "Could not execute pager (${PAGER}) to accept ${lic}" 1238 ${PAGER:-less} ${licmsg} || die "Could not execute pager (${PAGER}) to accept ${lic}"
1229 einfon "Do you accept the terms of this license (${l})? [yes/no] " 1239 einfon "Do you accept the terms of this license (${l})? [yes/no] "
1230 read alic 1240 read alic
1231 case ${alic} in 1241 case ${alic} in
1400 local dir=$(dirname ${cdset[${i}]}) 1410 local dir=$(dirname ${cdset[${i}]})
1401 local file=$(basename ${cdset[${i}]}) 1411 local file=$(basename ${cdset[${i}]})
1402 1412
1403 local point= node= fs= foo= 1413 local point= node= fs= foo=
1404 while read point node fs foo ; do 1414 while read point node fs foo ; do
1405 [[ " cd9660 iso9660 " != *" ${fs} "* ]] && \ 1415 [[ " cd9660 iso9660 udf " != *" ${fs} "* ]] && \
1406 ! [[ ${fs} == "subfs" && ",${opts}," == *",fs=cdfss,"* ]] \ 1416 ! [[ ${fs} == "subfs" && ",${opts}," == *",fs=cdfss,"* ]] \
1407 && continue 1417 && continue
1408 point=${point//\040/ } 1418 point=${point//\040/ }
1409 [[ -z $(find "${point}/${dir}" -maxdepth 1 -iname "${file}") ]] && continue 1419 [[ -z $(find "${point}/${dir}" -maxdepth 1 -iname "${file}") ]] && continue
1410 export CDROM_ROOT=${point} 1420 export CDROM_ROOT=${point}
1551# } 1561# }
1552 1562
1553preserve_old_lib() { 1563preserve_old_lib() {
1554 if [[ ${EBUILD_PHASE} != "preinst" ]] ; then 1564 if [[ ${EBUILD_PHASE} != "preinst" ]] ; then
1555 eerror "preserve_old_lib() must be called from pkg_preinst() only" 1565 eerror "preserve_old_lib() must be called from pkg_preinst() only"
1556# die "Invalid preserve_old_lib() usage" 1566 die "Invalid preserve_old_lib() usage"
1557 fi 1567 fi
1558 [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> [more libraries to preserve]" 1568 [[ -z $1 ]] && die "Usage: preserve_old_lib <library to preserve> [more libraries to preserve]"
1559 1569
1560 local lib dir 1570 local lib dir
1561 for lib in "$@" ; do 1571 for lib in "$@" ; do
1568} 1578}
1569 1579
1570preserve_old_lib_notify() { 1580preserve_old_lib_notify() {
1571 if [[ ${EBUILD_PHASE} != "postinst" ]] ; then 1581 if [[ ${EBUILD_PHASE} != "postinst" ]] ; then
1572 eerror "preserve_old_lib_notify() must be called from pkg_postinst() only" 1582 eerror "preserve_old_lib_notify() must be called from pkg_postinst() only"
1573# die "Invalid preserve_old_lib_notify() usage" 1583 die "Invalid preserve_old_lib_notify() usage"
1574 fi 1584 fi
1575 1585
1576 local lib notice=0 1586 local lib notice=0
1577 for lib in "$@" ; do 1587 for lib in "$@" ; do
1578 [[ -e ${ROOT}/${lib} ]] || continue 1588 [[ -e ${ROOT}/${lib} ]] || continue
1590} 1600}
1591 1601
1592# Hack for people to figure out if a package was built with 1602# Hack for people to figure out if a package was built with
1593# certain USE flags 1603# certain USE flags
1594# 1604#
1595# Usage: built_with_use [-a|-o] <DEPEND ATOM> <List of USE flags> 1605# Usage: built_with_use [--missing <action>] [-a|-o] <DEPEND ATOM> <List of USE flags>
1596# ex: built_with_use xchat gtk2 1606# ex: built_with_use xchat gtk2
1597# 1607#
1598# Flags: -a all USE flags should be utilized 1608# Flags: -a all USE flags should be utilized
1599# -o at least one USE flag should be utilized 1609# -o at least one USE flag should be utilized
1610# --missing peform the specified action if the flag is not in IUSE (true/false/die)
1611# --hidden USE flag we're checking is hidden expanded so it isnt in IUSE
1600# Note: the default flag is '-a' 1612# Note: the default flag is '-a'
1601built_with_use() { 1613built_with_use() {
1614 local hidden="no"
1615 if [[ $1 == "--hidden" ]] ; then
1616 hidden="yes"
1617 shift
1618 fi
1619
1620 local missing_action="die"
1621 if [[ $1 == "--missing" ]] ; then
1622 missing_action=$2
1623 shift ; shift
1624 case ${missing_action} in
1625 true|false|die) ;;
1626 *) die "unknown action '${missing_action}'";;
1627 esac
1628 fi
1629
1602 local opt=$1 1630 local opt=$1
1603 [[ ${opt:0:1} = "-" ]] && shift || opt="-a" 1631 [[ ${opt:0:1} = "-" ]] && shift || opt="-a"
1604 1632
1605 local PKG=$(best_version $1) 1633 local PKG=$(best_version $1)
1606 [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package" 1634 [[ -z ${PKG} ]] && die "Unable to resolve $1 to an installed package"
1607 shift 1635 shift
1608 1636
1609 local USEFILE=${ROOT}/var/db/pkg/${PKG}/USE 1637 local USEFILE=${ROOT}/var/db/pkg/${PKG}/USE
1610 local IUSEFILE=${ROOT}/var/db/pkg/${PKG}/IUSE 1638 local IUSEFILE=${ROOT}/var/db/pkg/${PKG}/IUSE
1611 1639
1612 # if the USE file doesnt exist, assume the $PKG is either 1640 # if the IUSE file doesn't exist, the read will error out, we need to handle
1613 # injected or package.provided 1641 # this gracefully
1642 if [[ ! -e ${USEFILE} ]] || [[ ! -e ${IUSEFILE} && ${hidden} == "no" ]] ; then
1643 case ${missing_action} in
1644 true) return 0;;
1645 false) return 1;;
1614 [[ ! -e ${USEFILE} ]] && die "Unable to determine what USE flags $PKG was built with" 1646 die) die "Unable to determine what USE flags $PKG was built with";;
1647 esac
1648 fi
1615 1649
1650 if [[ ${hidden} == "no" ]] ; then
1616 local IUSE_BUILT=$(<${IUSEFILE}) 1651 local IUSE_BUILT=$(<${IUSEFILE})
1617 # Don't check USE_EXPAND #147237 1652 # Don't check USE_EXPAND #147237
1618 local expand 1653 local expand
1619 for expand in $(echo ${USE_EXPAND} | tr '[:upper:]' '[:lower:]') ; do 1654 for expand in $(echo ${USE_EXPAND} | tr '[:upper:]' '[:lower:]') ; do
1620 if [[ $1 == ${expand}_* ]] ; then 1655 if [[ $1 == ${expand}_* ]] ; then
1621 expand="" 1656 expand=""
1622 break 1657 break
1623 fi 1658 fi
1624 done 1659 done
1625 if [[ -n ${expand} ]] ; then 1660 if [[ -n ${expand} ]] ; then
1661 if ! has $1 ${IUSE_BUILT} ; then
1662 case ${missing_action} in
1663 true) return 0;;
1664 false) return 1;;
1626 has $1 ${IUSE_BUILT} || die "$PKG does not actually support the $1 USE flag!" 1665 die) die "$PKG does not actually support the $1 USE flag!";;
1666 esac
1667 fi
1668 fi
1627 fi 1669 fi
1628 1670
1629 local USE_BUILT=$(<${USEFILE}) 1671 local USE_BUILT=$(<${USEFILE})
1630 while [[ $# -gt 0 ]] ; do 1672 while [[ $# -gt 0 ]] ; do
1631 if [[ ${opt} = "-o" ]] ; then 1673 if [[ ${opt} = "-o" ]] ; then

Legend:
Removed from v.1.268  
changed lines
  Added in v.1.282

  ViewVC Help
Powered by ViewVC 1.1.20