Gentoo Logo
Gentoo Spaceship




Note: Due to technical difficulties, the Archives are currently not up to date. GMANE provides an alternative service for most mailing lists.
c.f. bug 424647
List Archive: gentoo-dev
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Headers:
To: Gentoo Development <gentoo-dev@g.o>
From: Mike Frysinger <vapier@g.o>
Subject: libtool.eclass update to allow @...@ replacements in patches
Date: Thu, 29 Sep 2011 13:28:07 -0400
cleaned up ELT_try_and_apply_patch a bit, and added support for
@GENTOO_LIBDIR@ in patches
-mike

--- libtool.eclass
+++ libtool.eclass
@@ -16,7 +16,7 @@
 
 DESCRIPTION="Based on the ${ECLASS} eclass"
 
-inherit toolchain-funcs
+inherit multilib toolchain-funcs
 
 ELT_PATCH_DIR="${ECLASSDIR}/ELT-patches"
 
@@ -27,17 +27,18 @@ ELT_try_and_apply_patch() {
 	local ret=0
 	local file=$1
 	local patch=$2
+	local src=$3
+	local disp="${src} patch"
+	local log="${T}/elibtool.log"
 
-	echo -e "\nTrying $(basename "$(dirname "${patch}")")-${patch##*/}.patch on ${file}" \
-		>> "${T}/elibtool.log" 2>&1
+	printf '\nTrying %s\nTMP: %s\n' "${disp}" "${patch}" >> "${log}"
 
 	# We only support patchlevel of 0 - why worry if its static patches?
-	if patch -p0 --dry-run "${file}" "${patch}" >> "${T}/elibtool.log" 2>&1 ; then
-		einfo "  Applying $(basename "$(dirname "${patch}")")-${patch##*/}.patch ..."
-		patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" \
-			>> "${T}/elibtool.log" 2>&1
+	if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then
+		einfo "  Applying ${disp} ..."
+		patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1
 		ret=$?
-		export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${patch##*/}"
+		export ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${src}"
 	else
 		ret=1
 	fi
@@ -61,7 +62,7 @@ ELT_libtool_version() {
 # apply to $1 ...
 #
 ELT_walk_patches() {
-	local patch
+	local patch tmp
 	local ret=1
 	local file=$1
 	local patch_set=$2
@@ -71,20 +72,21 @@ ELT_walk_patches() {
 	[[ -z ${patch_set} ]] && return 1
 	[[ ! -d ${patch_dir} ]] && return 1
 
-	pushd "${ELT_PATCH_DIR}" >/dev/null
+	# Allow patches to use @GENTOO_LIBDIR@ replacements
+	local sed_args=( -e "s:@GENTOO_LIBDIR@:$(get_libdir):g" )
+	if [[ -n ${rem_int_dep} ]] ; then
+		# replace @REM_INT_DEP@ with what was passed
+		# to --remove-internal-dep
+		sed_args+=( -e "s|@REM_INT_DEP@|${rem_int_dep}|g" )
+	fi
+
+	pushd "${ELT_PATCH_DIR}" >/dev/null || die
 
 	# Go through the patches in reverse order (newer version to older)
 	for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do
-		# For --remove-internal-dep ...
-		if [[ -n ${rem_int_dep} ]] ; then
-			# For replace @REM_INT_DEP@ with what was passed
-			# to --remove-internal-dep
-			local tmp="${T}/$$.rem_int_deps.patch"
-			sed -e "s|@REM_INT_DEP@|${rem_int_dep}|g" "${patch}" > "${tmp}"
-			patch=${tmp}
-		fi
-
-		if ELT_try_and_apply_patch "${file}" "${patch}" ; then
+		tmp="${T}/libtool-elt.patch"
+		sed "${sed_args[@]}" "${patch}" > "${tmp}" || die
+		if ELT_try_and_apply_patch "${file}" "${tmp}" "${patch}" ; then
 			# Break to unwind w/popd rather than return directly
 			ret=0
 			break


Replies:
Re: libtool.eclass update to allow @...@ replacements in patches
-- Donnie Berkholz
Navigation:
Lists: gentoo-dev: < Prev By Thread Next > < Prev By Date Next >
Previous by thread:
Manifest signing
Next by thread:
Re: libtool.eclass update to allow @...@ replacements in patches
Previous by date:
Re: Manifest signing
Next by date:
edos2unix will now `die` for you


Updated Jun 29, 2012

Summary: Archive of the gentoo-dev mailing list.

Donate to support our development efforts.

Copyright 2001-2013 Gentoo Foundation, Inc. Questions, Comments? Contact us.