summaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2004-01-29 08:38:11 +0000
committerMike Frysinger <vapier@gentoo.org>2004-01-29 08:38:11 +0000
commit7746d21fa9871d8361e51638e917fbc78f27508b (patch)
tree9534cef7833bd53f23bdc96a6d66218072ca91a9 /eclass
parentver bump #38003 (diff)
downloadgentoo-2-7746d21fa9871d8361e51638e917fbc78f27508b.tar.gz
gentoo-2-7746d21fa9871d8361e51638e917fbc78f27508b.tar.bz2
gentoo-2-7746d21fa9871d8361e51638e917fbc78f27508b.zip
remove xpatch
Diffstat (limited to 'eclass')
-rw-r--r--eclass/eutils.eclass141
1 files changed, 1 insertions, 140 deletions
diff --git a/eclass/eutils.eclass b/eclass/eutils.eclass
index b004312aade2..74461d284c4d 100644
--- a/eclass/eutils.eclass
+++ b/eclass/eutils.eclass
@@ -1,6 +1,6 @@
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
-# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.76 2004/01/26 23:40:07 vapier Exp $
+# $Header: /var/cvsroot/gentoo-x86/eclass/eutils.eclass,v 1.77 2004/01/29 08:38:11 vapier Exp $
#
# Author: Martin Schlemmer <azarah@gentoo.org>
#
@@ -759,145 +759,6 @@ Categories=Application;${type};" > ${desktop}
return 0
}
-# 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
-# - 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?)
-# - 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} $*
-
- local list=
- local list2=
- declare -i plevel
-
- # parse patch sources
- for x in $*
- do
- debug-print "${FUNCNAME}: parsing parameter ${x}"
- if [ -f "${x}" ]
- then
- list="${list} ${x}"
- elif [ -d "${x}" ]
- then
- # handles patchdirs like epatch() for now: no recursion.
- # patches are sorted by filename, so with an xy_foo naming scheme you'll get the right order.
- # only patches with _$ARCH_ or _all_ in their filenames are applied.
- for file in `ls -A ${x}`
- do
- debug-print "${FUNCNAME}: parsing in subdir: file ${file}"
- if [ -f "${x}/${file}" -a "${file}" != "${file/_all_}" -o \
- "${file}" != "${file/_$ARCH_}" ]
- then
- list2="${list2} ${x}/${file}"
- fi
- done
- list="`echo ${list2} | sort` ${list}"
- else
- die "Couldn't find ${x}"
- fi
- done
-
- debug-print "${FUNCNAME}: final list of patches: ${list}"
-
- for x in ${list};
- do
- debug-print "${FUNCNAME}: processing ${x}"
- # deal with compressed files. /usr/bin/file is in the system profile, or should be.
- case "`/usr/bin/file -b ${x}`" in
- *gzip*)
- patchfile="${T}/current.patch"
- ungzip -c "${x}" > "${patchfile}"
- ;;
- *bzip2*)
- patchfile="${T}/current.patch"
- bunzip2 -c "${x}" > "${patchfile}"
- ;;
- *text*)
- patchfile="${x}"
- ;;
- *)
- die "Could not determine filetype of patch ${x}"
- ;;
- esac
- debug-print "${FUNCNAME}: patchfile=${patchfile}"
-
- # determine patchlevel. supports p0 and higher with either $S or $WORKDIR as base.
- target="`/bin/grep -m 1 '^+++ ' ${patchfile}`"
- debug-print "${FUNCNAME}: raw target=${target}"
- # 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
- debug-print "${FUNCNAME}: looking in basedir=${basedir}"
- cd "${basedir}"
-
- # try stripping leading directories
- target2="${target}"
- plevel=0
- debug-print "${FUNCNAME}: trying target2=${target2}, plevel=${plevel}"
- while [ ! -f "${target2}" ]
- do
- target2="${target2#*/}" # removes piece of target2 upto the first occurence of /
- plevel=$((plevel+1))
- debug-print "${FUNCNAME}: trying target2=${target2}, plevel=${plevel}"
- [ "${target2}" == "${target2/\/}" ] && break
- done
- test -f "${target2}" && break
-
- # try stripping filename - needed to support patches creating new files
- target2="${target%/*}"
- plevel=0
- debug-print "${FUNCNAME}: trying target2=${target2}, plevel=${plevel}"
- while [ ! -d "${target2}" ]
- do
- target2="${target2#*/}" # removes piece of target2 upto the first occurence of /
- plevel=$((plevel+1))
- debug-print "${FUNCNAME}: trying target2=${target2}, plevel=${plevel}"
- [ "${target2}" == "${target2/\/}" ] && break
- done
- test -d "${target2}" && break
-
- done
-
- test -f "${basedir}/${target2}" || test -d "${basedir}/${target2}" \
- || die "Could not determine patchlevel for ${x}"
- debug-print "${FUNCNAME}: determined plevel=${plevel}"
- # do the patching
- ebegin "Applying patch ${x##*/}..."
- /usr/bin/patch -p${plevel} < "${patchfile}" > /dev/null \
- || die "Failed to apply patch ${x}"
- eend $?
-
- done
-
-}
-
# for internal use only (unpack_pdv and unpack_makeself)
find_unpackable_file() {
local src="$1"