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

Diff of /eclass/eutils.eclass

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

Revision 1.349 Revision 1.357
1# Copyright 1999-2009 Gentoo Foundation 1# Copyright 1999-2011 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.349 2010/08/19 21:32:26 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.357 2011/06/14 20:16:51 betelgeuse 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
200# If you do not specify any options, then epatch will default to the directory 200# If you do not specify any options, then epatch will default to the directory
201# specified by EPATCH_SOURCE. 201# specified by EPATCH_SOURCE.
202# 202#
203# When processing directories, epatch will apply all patches that match: 203# When processing directories, epatch will apply all patches that match:
204# @CODE 204# @CODE
205# ${EPATCH_FORCE} == "yes" 205# if ${EPATCH_FORCE} != "yes"
206# ??_${ARCH}_foo.${EPATCH_SUFFIX} 206# ??_${ARCH}_foo.${EPATCH_SUFFIX}
207# else 207# else
208# *.${EPATCH_SUFFIX} 208# *.${EPATCH_SUFFIX}
209# @CODE 209# @CODE
210# The leading ?? are typically numbers used to force consistent patch ordering. 210# The leading ?? are typically numbers used to force consistent patch ordering.
289 # ???_arch_foo.patch 289 # ???_arch_foo.patch
290 # Else, skip this input altogether 290 # Else, skip this input altogether
291 local a=${patchname#*_} # strip the ???_ 291 local a=${patchname#*_} # strip the ???_
292 a=${a%%_*} # strip the _foo.patch 292 a=${a%%_*} # strip the _foo.patch
293 if ! [[ ${SINGLE_PATCH} == "yes" || \ 293 if ! [[ ${SINGLE_PATCH} == "yes" || \
294 ${EPATCH_FORCE} == "yes" || \ 294 ${EPATCH_FORCE} == "yes" || \
295 ${a} == all || \ 295 ${a} == all || \
296 ${a} == ${ARCH} ]] 296 ${a} == ${ARCH} ]]
297 then 297 then
298 continue 298 continue
299 fi 299 fi
300 300
301 # Let people filter things dynamically 301 # Let people filter things dynamically
357 # such patches. 357 # such patches.
358 local abs_paths=$(egrep -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }') 358 local abs_paths=$(egrep -n '^[-+]{3} /' "${PATCH_TARGET}" | awk '$2 != "/dev/null" { print }')
359 if [[ -n ${abs_paths} ]] ; then 359 if [[ -n ${abs_paths} ]] ; then
360 count=1 360 count=1
361 printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDERR_TARGET}" 361 printf "NOTE: skipping -p0 due to absolute paths in patch:\n%s\n" "${abs_paths}" >> "${STDERR_TARGET}"
362 fi
363 # Similar reason, but with relative paths.
364 local rel_paths=$(egrep -n '^[-+]{3} [^ ]*[.][.]/' "${PATCH_TARGET}")
365 if [[ -n ${rel_paths} ]] ; then
366 eqawarn "QA Notice: Your patch uses relative paths '../'."
367 eqawarn " In the future this will cause a failure."
368 eqawarn "${rel_paths}"
362 fi 369 fi
363 370
364 # Dynamically detect the correct -p# ... i'm lazy, so shoot me :/ 371 # Dynamically detect the correct -p# ... i'm lazy, so shoot me :/
365 while [[ ${count} -lt 5 ]] ; do 372 while [[ ${count} -lt 5 ]] ; do
366 # Generate some useful debug info ... 373 # Generate some useful debug info ...
490egetent() { 497egetent() {
491 case ${CHOST} in 498 case ${CHOST} in
492 *-darwin[678]) 499 *-darwin[678])
493 case "$2" in 500 case "$2" in
494 *[!0-9]*) # Non numeric 501 *[!0-9]*) # Non numeric
495 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2$/) {print \$0;exit;} }" 502 nidump $1 . | awk -F":" "{ if (\$1 ~ /^$2\$/) {print \$0;exit;} }"
496 ;; 503 ;;
497 *) # Numeric 504 *) # Numeric
498 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }" 505 nidump $1 . | awk -F":" "{ if (\$3 == $2) {print \$0;exit;} }"
499 ;; 506 ;;
500 esac 507 esac
1384 dd) exe="dd ibs=${skip} skip=1 if='${src}'";; 1391 dd) exe="dd ibs=${skip} skip=1 if='${src}'";;
1385 *) die "makeself cant handle exe '${exe}'" 1392 *) die "makeself cant handle exe '${exe}'"
1386 esac 1393 esac
1387 1394
1388 # lets grab the first few bytes of the file to figure out what kind of archive it is 1395 # lets grab the first few bytes of the file to figure out what kind of archive it is
1389 local tmpfile=$(emktemp) 1396 local filetype tmpfile=$(emktemp)
1390 eval ${exe} 2>/dev/null | head -c 512 > "${tmpfile}" 1397 eval ${exe} 2>/dev/null | head -c 512 > "${tmpfile}"
1391 local filetype=$(file -b "${tmpfile}") 1398 filetype=$(file -b "${tmpfile}") || die
1392 case ${filetype} in 1399 case ${filetype} in
1393 *tar\ archive*) 1400 *tar\ archive*)
1394 eval ${exe} | tar --no-same-owner -xf - 1401 eval ${exe} | tar --no-same-owner -xf -
1395 ;; 1402 ;;
1396 bzip2*) 1403 bzip2*)
1785 ewarn "the libraries are not being removed. You need to run revdep-rebuild" 1792 ewarn "the libraries are not being removed. You need to run revdep-rebuild"
1786 ewarn "in order to remove these old dependencies. If you do not have this" 1793 ewarn "in order to remove these old dependencies. If you do not have this"
1787 ewarn "helper program, simply emerge the 'gentoolkit' package." 1794 ewarn "helper program, simply emerge the 'gentoolkit' package."
1788 ewarn 1795 ewarn
1789 fi 1796 fi
1797 # temp hack for #348634 #357225
1798 [[ ${PN} == "mpfr" ]] && lib=${lib##*/}
1790 ewarn " # revdep-rebuild --library ${lib##*/}" 1799 ewarn " # revdep-rebuild --library '${lib}'"
1791 done 1800 done
1792 if [[ ${notice} -eq 1 ]] ; then 1801 if [[ ${notice} -eq 1 ]] ; then
1793 ewarn 1802 ewarn
1794 ewarn "Once you've finished running revdep-rebuild, it should be safe to" 1803 ewarn "Once you've finished running revdep-rebuild, it should be safe to"
1795 ewarn "delete the old libraries. Here is a copy & paste for the lazy:" 1804 ewarn "delete the old libraries. Here is a copy & paste for the lazy:"
1941 else 1950 else
1942 newbin "${tmpwrapper}" "${wrapper}" || die 1951 newbin "${tmpwrapper}" "${wrapper}" || die
1943 fi 1952 fi
1944} 1953}
1945 1954
1946# @FUNCTION: prepalldocs 1955# @FUNCTION: path_exists
1947# @USAGE: 1956# @USAGE: [-a|-o] <paths>
1948# @DESCRIPTION: 1957# @DESCRIPTION:
1949# Compress files in /usr/share/doc which are not already 1958# Check if the specified paths exist. Works for all types of paths
1950# compressed, excluding /usr/share/doc/${PF}/html. 1959# (files/dirs/etc...). The -a and -o flags control the requirements
1951# Uses the ecompressdir to do the compression. 1960# of the paths. They correspond to "and" and "or" logic. So the -a
1952# 2009-02-18 by betelgeuse: 1961# flag means all the paths must exist while the -o flag means at least
1953# Commented because ecompressdir is even more internal to 1962# one of the paths must exist. The default behavior is "and". If no
1954# Portage than prepalldocs (it's not even mentioned in man 5 1963# paths are specified, then the return value is "false".
1955# ebuild). Please submit a better version for review to gentoo-dev 1964path_exists() {
1956# if you want prepalldocs here. 1965 local opt=$1
1957#prepalldocs() { 1966 [[ ${opt} == -[ao] ]] && shift || opt="-a"
1958# if [[ -n $1 ]] ; then
1959# ewarn "prepalldocs: invalid usage; takes no arguments"
1960# fi
1961 1967
1962# cd "${D}" 1968 # no paths -> return false
1963# [[ -d usr/share/doc ]] || return 0 1969 # same behavior as: [[ -e "" ]]
1970 [[ $# -eq 0 ]] && return 1
1964 1971
1965# find usr/share/doc -exec gzip {} + 1972 local p r=0
1966# ecompressdir --ignore /usr/share/doc/${PF}/html 1973 for p in "$@" ; do
1967# ecompressdir --queue /usr/share/doc 1974 [[ -e ${p} ]]
1968#} 1975 : $(( r += $? ))
1976 done
1977
1978 case ${opt} in
1979 -a) return $(( r != 0 )) ;;
1980 -o) return $(( r == $# )) ;;
1981 esac
1982}

Legend:
Removed from v.1.349  
changed lines
  Added in v.1.357

  ViewVC Help
Powered by ViewVC 1.1.20