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

Diff of /eclass/eutils.eclass

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

Revision 1.315 Revision 1.321
1# Copyright 1999-2007 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.315 2009/02/21 23:28:21 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.321 2009/10/18 07:52:23 grobian 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
183 183
184 local EPATCH_SOURCE="${EPATCH_SOURCE}/*.${EPATCH_SUFFIX}" 184 local EPATCH_SOURCE="${EPATCH_SOURCE}/*.${EPATCH_SUFFIX}"
185 fi 185 fi
186 186
187 case ${EPATCH_SUFFIX##*\.} in 187 case ${EPATCH_SUFFIX##*\.} in
188 xz)
189 PIPE_CMD="xz -dc"
190 PATCH_SUFFIX="xz"
191 ;;
188 lzma) 192 lzma)
189 PIPE_CMD="lzma -dc" 193 PIPE_CMD="lzma -dc"
190 PATCH_SUFFIX="lzma" 194 PATCH_SUFFIX="lzma"
191 ;; 195 ;;
192 bz2) 196 bz2)
343 if [ "${SINGLE_PATCH}" = "no" ] 347 if [ "${SINGLE_PATCH}" = "no" ]
344 then 348 then
345 einfo "Done with patching" 349 einfo "Done with patching"
346 fi 350 fi
347} 351}
352epatch_user() {
353 [[ $# -ne 0 ]] && die "epatch_user takes no options"
354
355 # don't clobber any EPATCH vars that the parent might want
356 local EPATCH_SOURCE check base=${PORTAGE_CONFIGROOT}/etc/portage/patches
357 for check in {${CATEGORY}/${PF},${CATEGORY}/${P},${CATEGORY}/${PN}}; do
358 EPATCH_SOURCE=${base}/${CTARGET}/${check}
359 [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${CHOST}/${check}
360 [[ -r ${EPATCH_SOURCE} ]] || EPATCH_SOURCE=${base}/${check}
361 if [[ -d ${EPATCH_SOURCE} ]] ; then
362 EPATCH_SOURCE=${EPATCH_SOURCE} \
363 EPATCH_SUFFIX="patch" \
364 EPATCH_FORCE="yes" \
365 EPATCH_MULTI_MSG="Applying user patches from ${EPATCH_SOURCE} ..." \
366 epatch
367 break
368 fi
369 done
370}
348 371
349# @FUNCTION: emktemp 372# @FUNCTION: emktemp
350# @USAGE: [temp dir] 373# @USAGE: [temp dir]
351# @DESCRIPTION: 374# @DESCRIPTION:
352# Cheap replacement for when debianutils (and thus mktemp) 375# Cheap replacement for when debianutils (and thus mktemp)
392# Small wrapper for getent (Linux), 415# Small wrapper for getent (Linux),
393# nidump (< Mac OS X 10.5), dscl (Mac OS X 10.5), 416# nidump (< Mac OS X 10.5), dscl (Mac OS X 10.5),
394# and pw (FreeBSD) used in enewuser()/enewgroup() 417# and pw (FreeBSD) used in enewuser()/enewgroup()
395egetent() { 418egetent() {
396 case ${CHOST} in 419 case ${CHOST} in
420 *-darwin[678])
421 case "$2" in
422 *[!0-9]*) # Non numeric
423 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }"
424 ;;
425 *) # Numeric
426 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }"
427 ;;
428 esac
429 ;;
397 *-darwin9) 430 *-darwin*)
398 local mytype=$1 431 local mytype=$1
399 [[ "passwd" == $mytype ]] && mytype="Users" 432 [[ "passwd" == $mytype ]] && mytype="Users"
400 [[ "group" == $mytype ]] && mytype="Groups" 433 [[ "group" == $mytype ]] && mytype="Groups"
401 case "$2" in 434 case "$2" in
402 *[!0-9]*) # Non numeric 435 *[!0-9]*) # Non numeric
404 ;; 437 ;;
405 *) # Numeric 438 *) # Numeric
406 local mykey="UniqueID" 439 local mykey="UniqueID"
407 [[ $mytype == "Groups" ]] && mykey="PrimaryGroupID" 440 [[ $mytype == "Groups" ]] && mykey="PrimaryGroupID"
408 dscl . -search /$mytype $mykey $2 2>/dev/null 441 dscl . -search /$mytype $mykey $2 2>/dev/null
409 ;;
410 esac
411 ;;
412 *-darwin*)
413 case "$2" in
414 *[!0-9]*) # Non numeric
415 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }"
416 ;;
417 *) # Numeric
418 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }"
419 ;; 442 ;;
420 esac 443 esac
421 ;; 444 ;;
422 *-freebsd*|*-dragonfly*) 445 *-freebsd*|*-dragonfly*)
423 local opts action="user" 446 local opts action="user"
623 fi 646 fi
624 ;; 647 ;;
625 648
626 *) 649 *)
627 if [[ -z $@ ]] ; then 650 if [[ -z $@ ]] ; then
628 useradd ${opts} ${euser} \ 651 useradd ${opts} \
629 -c "added by portage for ${PN}" \ 652 -c "added by portage for ${PN}" \
653 ${euser} \
630 || die "enewuser failed" 654 || die "enewuser failed"
631 else 655 else
632 einfo " - Extra: $@" 656 einfo " - Extra: $@"
633 useradd ${opts} ${euser} "$@" \ 657 useradd ${opts} "$@" \
658 ${euser} \
634 || die "enewuser failed" 659 || die "enewuser failed"
635 fi 660 fi
636 ;; 661 ;;
637 esac 662 esac
638 663
920 local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop" 945 local desktop="${T}/$(echo ${exec} | sed 's:[[:space:]/:]:_:g')-${desktop_name}.desktop"
921 #local desktop=${T}/${exec%% *:-${desktop_name}}.desktop 946 #local desktop=${T}/${exec%% *:-${desktop_name}}.desktop
922 947
923 cat <<-EOF > "${desktop}" 948 cat <<-EOF > "${desktop}"
924 [Desktop Entry] 949 [Desktop Entry]
925 Version=1.0
926 Name=${name} 950 Name=${name}
927 Type=Application 951 Type=Application
928 Comment=${DESCRIPTION} 952 Comment=${DESCRIPTION}
929 Exec=${exec} 953 Exec=${exec}
930 TryExec=${exec%% *} 954 TryExec=${exec%% *}
1614 else 1638 else
1615 nols="${nols} ${f}" 1639 nols="${nols} ${f}"
1616 fi 1640 fi
1617 done 1641 done
1618 [[ -n ${nols} ]] \ 1642 [[ -n ${nols} ]] \
1619 && ewarn "Sorry, but ${PN} does not support the LINGUAs:" ${nols} 1643 && ewarn "Sorry, but ${PN} does not support the LINGUAS:" ${nols}
1620 export LINGUAS=${newls:1} 1644 export LINGUAS=${newls:1}
1621} 1645}
1622 1646
1623# @FUNCTION: preserve_old_lib 1647# @FUNCTION: preserve_old_lib
1624# @USAGE: <libs to preserve> [more libs] 1648# @USAGE: <libs to preserve> [more libs]

Legend:
Removed from v.1.315  
changed lines
  Added in v.1.321

  ViewVC Help
Powered by ViewVC 1.1.20