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

Diff of /eclass/eutils.eclass

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

Revision 1.33 Revision 1.35
1# Copyright 1999-2003 Gentoo Technologies, Inc. 1# Copyright 1999-2003 Gentoo Technologies, Inc.
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.33 2003/06/12 18:21:23 vapier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.35 2003/06/22 05:44:04 drobbins Exp $
4# 4#
5# Author: Martin Schlemmer <azarah@gentoo.org> 5# Author: Martin Schlemmer <azarah@gentoo.org>
6# 6#
7# This eclass is for general purpose functions that most ebuilds 7# This eclass is for general purpose functions that most ebuilds
8# have to implement themselves. 8# have to implement themselves.
400 ADMINPARAM="${ADMINPARAM/-j}" 400 ADMINPARAM="${ADMINPARAM/-j}"
401 fi 401 fi
402 402
403 export MAKEOPTS="`echo ${MAKEOPTS} | sed -e 's:-j *[0-9]*::g'`" 403 export MAKEOPTS="`echo ${MAKEOPTS} | sed -e 's:-j *[0-9]*::g'`"
404 404
405 if [ "${ARCH}" = "x86" -o "${ARCH}" = "hppa" -o \ 405 if [ "${ARCH}" = "amd64" -o "${ARCH}" = "x86" -o "${ARCH}" = "hppa" -o \
406 "${ARCH}" = "arm" -o "${ARCH}" = "mips" ] 406 "${ARCH}" = "arm" -o "${ARCH}" = "mips" ]
407 then 407 then
408 # these archs will always have "[Pp]rocessor" 408 # these archs will always have "[Pp]rocessor"
409 jobs="$((`grep -c ^[Pp]rocessor /proc/cpuinfo` * 2))" 409 jobs="$((`grep -c ^[Pp]rocessor /proc/cpuinfo` * 2))"
410 410
638 cp ${f} ${T}/edos2unix 638 cp ${f} ${T}/edos2unix
639 sed 's/\r$//' ${T}/edos2unix > ${f} 639 sed 's/\r$//' ${T}/edos2unix > ${f}
640 done 640 done
641} 641}
642 642
643# new convinience patch wapper function to eventually replace epatch(), $PATCHES, $PATCHES1, src_unpack:patch, src_unpack:autopatch and /usr/bin/patch 643# new convenience patch wrapper function to eventually replace epatch(),
644# $PATCHES, $PATCHES1, src_unpack:patch, src_unpack:autopatch and
645# /usr/bin/patch
644# Features: 646# Features:
645# - bulk patch handling similar to epatch()'s 647# - bulk patch handling similar to epatch()'s
646# - automatic patch level detection like epatch()'s 648# - automatic patch level detection like epatch()'s
647# - semiautomatic patch uncompression like epatch()'s (may switch to using /usr/bin/file for extra power, instead of just looking at the filename) 649# - automatic patch uncompression like epatch()'s
648# - doesn't have the --dry-run overhead of epatch() - inspects patchfiles manually instead 650# - doesn't have the --dry-run overhead of epatch() - inspects patchfiles
649# - is called from base_src_unpack to handle $PATCHES to avoid defining src_unpack(-) just to use xpatch 651# manually instead
652# - once I decide it's production-ready, it'll be called from base_src_unpack
653# to handle $PATCHES to avoid defining src_unpack just to use xpatch
650 654
651# accepts zero or more parameters specifying patchfiles and/or patchdirs 655# accepts zero or more parameters specifying patchfiles and/or patchdirs
652 656
653# known issues: 657# known issues:
654# - only supports unified style patches (does anyone _really_ use anything else?) 658# - only supports unified style patches (does anyone _really_ use anything
655# - first file addressed in a patch can't have spaces in its name or in the path mentioned in the patchfile 659# else?)
656# (can be easily fixed to be: at least one file addressed in the patch must have no spaces...) 660# - because it doesn't use --dry-run there is a risk of it failing
661# to find the files to patch, ie detect the patchlevel, properly. It doesn't use
662# any of the backup heuristics that patch employs to discover a filename.
663# however, this isn't dangerous because if it works for the developer who's
664# writing the ebuild, it'll always work for the users, and if it doesn't,
665# then we'll fix it :-)
666# - no support as yet for patches applying outside $S (and not directly in $WORKDIR).
657xpatch() { 667xpatch() {
658 668
659 debug-print-function $FUNCNAME $* 669 debug-print-function $FUNCNAME $*
660 670
661 local list="" 671 local list=""
695 *) die "Could not determine filetype of patch $x";; 705 *) die "Could not determine filetype of patch $x";;
696 esac 706 esac
697 debug-print "$FUNCNAME: patchfile=$patchfile" 707 debug-print "$FUNCNAME: patchfile=$patchfile"
698 708
699 # determine patchlevel. supports p0 and higher with either $S or $WORKDIR as base. 709 # determine patchlevel. supports p0 and higher with either $S or $WORKDIR as base.
700 target="`/bin/grep '+++' $patchfile | /usr/bin/tail -1`" 710 target="`/bin/grep -m 1 '^+++ ' $patchfile`"
701 debug-print "$FUNCNAME: raw target=$target" 711 debug-print "$FUNCNAME: raw target=$target"
702 # strip target down to the path/filename. NOTE doesn't support filenames/paths with spaces in them :-( 712 # strip target down to the path/filename, remove leading +++
703 # remove leading +++ 713 target="${target/+++ }"; target="${target%% *}"
704 target="${target/+++ }"
705 # ugly, yes. i dunno why doesn't this work instead: target=${target%% *}
706 for foo in $target; do target="$foo"; break; done
707 # duplicate slashes are discarded by patch wrt the patchlevel. therefore we need to discard them as well 714 # duplicate slashes are discarded by patch wrt the patchlevel. therefore we need
708 # to calculate the correct patchlevel. 715 # to discard them as well to calculate the correct patchlevel.
709 while [ "$target" != "${target/\/\/}" ]; do
710 target="${target/\/\//\/}" 716 target="${target//\/\//\/}"
711 done
712 debug-print "$FUNCNAME: stripped target=$target" 717 debug-print "$FUNCNAME: stripped target=$target"
713 718
714 # look for target 719 # look for target
715 for basedir in "$S" "$WORKDIR" "`pwd`"; do 720 for basedir in "$S" "$WORKDIR" "${PWD}"; do
716 debug-print "$FUNCNAME: looking in basedir=$basedir" 721 debug-print "$FUNCNAME: looking in basedir=$basedir"
717 cd "$basedir" 722 cd "$basedir"
718 723
719 # try stripping leading directories 724 # try stripping leading directories
720 target2="$target" 725 target2="$target"

Legend:
Removed from v.1.33  
changed lines
  Added in v.1.35

  ViewVC Help
Powered by ViewVC 1.1.20