diff options
author | Dan Armak <danarmak@gentoo.org> | 2003-06-21 09:23:24 +0000 |
---|---|---|
committer | Dan Armak <danarmak@gentoo.org> | 2003-06-21 09:23:24 +0000 |
commit | 31763771607d73afacc36adee0ec29580947fd9b (patch) | |
tree | 77e4cc665c224b1dd19866118bfda1d538303006 /eclass | |
parent | version bump + source code! (diff) | |
download | historical-31763771607d73afacc36adee0ec29580947fd9b.tar.gz historical-31763771607d73afacc36adee0ec29580947fd9b.tar.bz2 historical-31763771607d73afacc36adee0ec29580947fd9b.zip |
updates to xpatch courtesy of rach. holmes - see -dev posting
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/eutils.eclass | 45 |
1 files changed, 25 insertions, 20 deletions
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass index 9acab74f67d5..89c4085d58a1 100644 --- a/eclass/eutils.eclass +++ b/eclass/eutils.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2003 Gentoo Technologies, Inc. # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.33 2003/06/12 18:21:23 vapier Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.34 2003/06/21 09:23:24 danarmak Exp $ # # Author: Martin Schlemmer <azarah@gentoo.org> # @@ -640,20 +640,30 @@ edos2unix() { done } -# new convinience patch wapper function to eventually replace epatch(), $PATCHES, $PATCHES1, src_unpack:patch, src_unpack:autopatch and /usr/bin/patch +# new convenience patch wrapper function to eventually replace epatch(), +# $PATCHES, $PATCHES1, src_unpack:patch, src_unpack:autopatch and +# /usr/bin/patch # Features: # - bulk patch handling similar to epatch()'s # - automatic patch level detection like epatch()'s -# - semiautomatic patch uncompression like epatch()'s (may switch to using /usr/bin/file for extra power, instead of just looking at the filename) -# - doesn't have the --dry-run overhead of epatch() - inspects patchfiles manually instead -# - is called from base_src_unpack to handle $PATCHES to avoid defining src_unpack(-) just to use xpatch +# - automatic patch uncompression like epatch()'s +# - doesn't have the --dry-run overhead of epatch() - inspects patchfiles +# manually instead +# - once I decide it's production-ready, it'll be called from base_src_unpack +# to handle $PATCHES to avoid defining src_unpack just to use xpatch # accepts zero or more parameters specifying patchfiles and/or patchdirs # known issues: -# - only supports unified style patches (does anyone _really_ use anything else?) -# - first file addressed in a patch can't have spaces in its name or in the path mentioned in the patchfile -# (can be easily fixed to be: at least one file addressed in the patch must have no spaces...) +# - only supports unified style patches (does anyone _really_ use anything +# else?) +# - because it doesn't use --dry-run there is a risk of it failing +# to find the files to patch, ie detect the patchlevel, properly. It doesn't use +# any of the backup heuristics that patch employs to discover a filename. +# however, this isn't dangerous because if it works for the developer who's +# writing the ebuild, it'll always work for the users, and if it doesn't, +# then we'll fix it :-) +# - no support as yet for patches applying outside $S (and not directly in $WORKDIR). xpatch() { debug-print-function $FUNCNAME $* @@ -697,22 +707,17 @@ xpatch() { debug-print "$FUNCNAME: patchfile=$patchfile" # determine patchlevel. supports p0 and higher with either $S or $WORKDIR as base. - target="`/bin/grep '+++' $patchfile | /usr/bin/tail -1`" + target="`/bin/grep -m 1 '^+++ ' $patchfile`" debug-print "$FUNCNAME: raw target=$target" - # strip target down to the path/filename. NOTE doesn't support filenames/paths with spaces in them :-( - # remove leading +++ - target="${target/+++ }" - # ugly, yes. i dunno why doesn't this work instead: target=${target%% *} - for foo in $target; do target="$foo"; break; done - # duplicate slashes are discarded by patch wrt the patchlevel. therefore we need to discard them as well - # to calculate the correct patchlevel. - while [ "$target" != "${target/\/\/}" ]; do - target="${target/\/\//\/}" - done + # strip target down to the path/filename, remove leading +++ + target="${target/+++ }"; target="${target%% *}" + # duplicate slashes are discarded by patch wrt the patchlevel. therefore we need + # to discard them as well to calculate the correct patchlevel. + target="${target//\/\//\/}" debug-print "$FUNCNAME: stripped target=$target" # look for target - for basedir in "$S" "$WORKDIR" "`pwd`"; do + for basedir in "$S" "$WORKDIR" "${PWD}"; do debug-print "$FUNCNAME: looking in basedir=$basedir" cd "$basedir" |