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

Diff of /eclass/eutils.eclass

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

Revision 1.304 Revision 1.311
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.304 2008/09/20 18:45:26 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.311 2009/02/18 08:05:52 mr_bones_ 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
77# Default options for patch 77# Default options for patch
78# Set -g0 to keep RCS, ClearCase, Perforce and SCCS happy. Bug #24571 78# Set -g0 to keep RCS, ClearCase, Perforce and SCCS happy. Bug #24571
79# Set --no-backup-if-mismatch so we don't leave '.orig' files behind. 79# Set --no-backup-if-mismatch so we don't leave '.orig' files behind.
80# Set -E to automatically remove empty files. 80# Set -E to automatically remove empty files.
81EPATCH_OPTS="-g0 -E --no-backup-if-mismatch" 81EPATCH_OPTS="-g0 -E --no-backup-if-mismatch"
82# List of patches not to apply. Not this is only file names, 82# List of patches not to apply. Note this is only file names,
83# and not the full path .. 83# and not the full path ..
84EPATCH_EXCLUDE="" 84EPATCH_EXCLUDE=""
85# Change the printed message for a single patch. 85# Change the printed message for a single patch.
86EPATCH_SINGLE_MSG="" 86EPATCH_SINGLE_MSG=""
87# Change the printed message for multiple patches. 87# Change the printed message for multiple patches.
105# bug they should be left as is to ensure an ebuild can rely on 105# bug they should be left as is to ensure an ebuild can rely on
106# them for. 106# them for.
107# 107#
108# Patches are applied in current directory. 108# Patches are applied in current directory.
109# 109#
110# Bulk Patches should preferibly have the form of: 110# Bulk Patches should preferably have the form of:
111# 111#
112# ??_${ARCH}_foo.${EPATCH_SUFFIX} 112# ??_${ARCH}_foo.${EPATCH_SUFFIX}
113# 113#
114# For example: 114# For example:
115# 115#
262 fi 262 fi
263 else 263 else
264 PATCH_TARGET="${x}" 264 PATCH_TARGET="${x}"
265 fi 265 fi
266 266
267 # Check for absolute paths in patches. If sandbox is disabled,
268 # people could (accidently) patch files in the root filesystem.
269 # Or trigger other unpleasantries #237667. So disallow -p0 on
270 # such patches.
271 local abs_paths=$(egrep -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }')
272 if [[ -n ${abs_paths} ]] ; then
273 count=1
274 echo "NOTE: skipping -p0 due to absolute paths in patch:" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
275 echo "${abs_paths}" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
276 fi
277
267 # Allow for prefix to differ ... im lazy, so shoot me :/ 278 # Allow for prefix to differ ... im lazy, so shoot me :/
268 while [ "${count}" -lt 5 ] 279 while [ "${count}" -lt 5 ]
269 do 280 do
270 # Generate some useful debug info ... 281 # Generate some useful debug info ...
271 _epatch_draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/} 282 _epatch_draw_line "***** ${patchname} *****" >> ${STDERR_TARGET%/*}/${patchname}-${STDERR_TARGET##*/}
376# base-system@gentoo.org (Linux) 387# base-system@gentoo.org (Linux)
377# Joe Jezak <josejx@gmail.com> (OS X) 388# Joe Jezak <josejx@gmail.com> (OS X)
378# usata@gentoo.org (OS X) 389# usata@gentoo.org (OS X)
379# Aaron Walker <ka0ttic@gentoo.org> (FreeBSD) 390# Aaron Walker <ka0ttic@gentoo.org> (FreeBSD)
380# @DESCRIPTION: 391# @DESCRIPTION:
381# Small wrapper for getent (Linux), nidump (Mac OS X), 392# Small wrapper for getent (Linux),
393# nidump (< Mac OS X 10.5), dscl (Mac OS X 10.5),
382# and pw (FreeBSD) used in enewuser()/enewgroup() 394# and pw (FreeBSD) used in enewuser()/enewgroup()
383egetent() { 395egetent() {
384 case ${CHOST} in 396 case ${CHOST} in
397 *-darwin9)
398 local mytype=$1
399 [[ "passwd" == $mytype ]] && mytype="Users"
400 [[ "group" == $mytype ]] && mytype="Groups"
401 case "$2" in
402 *[!0-9]*) # Non numeric
403 dscl . -read /$mytype/$2 2>/dev/null |grep RecordName
404 ;;
405 *) # Numeric
406 local mykey="UniqueID"
407 [[ $mytype == "Groups" ]] && mykey="PrimaryGroupID"
408 dscl . -search /$mytype $mykey $2 2>/dev/null
409 ;;
410 esac
411 ;;
385 *-darwin*) 412 *-darwin*)
386 case "$2" in 413 case "$2" in
387 *[!0-9]*) # Non numeric 414 *[!0-9]*) # Non numeric
388 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }" 415 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }"
389 ;; 416 ;;
1794 ) || die 1821 ) || die
1795 else 1822 else
1796 newbin "${tmpwrapper}" "${wrapper}" || die 1823 newbin "${tmpwrapper}" "${wrapper}" || die
1797 fi 1824 fi
1798} 1825}
1826
1827# @FUNCTION: prepalldocs
1828# @USAGE:
1829# @DESCRIPTION:
1830# Compress files in /usr/share/doc which are not already
1831# compressed, excluding /usr/share/doc/${PF}/html.
1832# Uses the ecompressdir to do the compression.
1833prepalldocs() {
1834 if [[ -n $1 ]] ; then
1835 ewarn "prepalldocs: invalid usage; takes no arguments"
1836 fi
1837
1838 cd "${D}"
1839 [[ -d usr/share/doc ]] || exit 0
1840
1841 ecompressdir --ignore /usr/share/doc/${PF}/html
1842 ecompressdir --queue /usr/share/doc
1843}

Legend:
Removed from v.1.304  
changed lines
  Added in v.1.311

  ViewVC Help
Powered by ViewVC 1.1.20