public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] libtool.eclass update to allow @...@ replacements in patches
@ 2011-09-29 17:28 Mike Frysinger
  2011-09-29 21:57 ` Donnie Berkholz
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2011-09-29 17:28 UTC (permalink / raw
  To: Gentoo Development

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



^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-dev] libtool.eclass update to allow @...@ replacements in patches
  2011-09-29 17:28 [gentoo-dev] libtool.eclass update to allow @...@ replacements in patches Mike Frysinger
@ 2011-09-29 21:57 ` Donnie Berkholz
  2011-09-29 22:08   ` Mike Frysinger
  2011-09-30 10:45   ` [gentoo-dev] " Diego Elio Pettenò
  0 siblings, 2 replies; 7+ messages in thread
From: Donnie Berkholz @ 2011-09-29 21:57 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 434 bytes --]

On 13:28 Thu 29 Sep     , Mike Frysinger wrote:
> cleaned up ELT_try_and_apply_patch a bit, and added support for
> @GENTOO_LIBDIR@ in patches

Is this documented anywhere besides the comment immediately above the 
implementation? Would be nice for anyone who writes a libtool patch to 
be more aware of this.

-- 
Thanks,
Donnie

Donnie Berkholz
Council Member / Sr. Developer
Gentoo Linux
Blog: http://dberkholz.com

[-- Attachment #2: Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-dev] libtool.eclass update to allow @...@ replacements in patches
  2011-09-29 21:57 ` Donnie Berkholz
@ 2011-09-29 22:08   ` Mike Frysinger
  2011-09-30 10:45   ` [gentoo-dev] " Diego Elio Pettenò
  1 sibling, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2011-09-29 22:08 UTC (permalink / raw
  To: gentoo-dev

On Thursday, September 29, 2011 17:57:27 Donnie Berkholz wrote:
> On 13:28 Thu 29 Sep     , Mike Frysinger wrote:
> > cleaned up ELT_try_and_apply_patch a bit, and added support for
> > @GENTOO_LIBDIR@ in patches
> 
> Is this documented anywhere besides the comment immediately above the
> implementation? Would be nice for anyone who writes a libtool patch to
> be more aware of this.

nothing about ELT-patches/ is documented currently
-mike



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-dev] Re: libtool.eclass update to allow @...@ replacements in patches
  2011-09-29 21:57 ` Donnie Berkholz
  2011-09-29 22:08   ` Mike Frysinger
@ 2011-09-30 10:45   ` Diego Elio Pettenò
  2011-09-30 15:06     ` [gentoo-dev] libtool.eclass documentation Mike Frysinger
  1 sibling, 1 reply; 7+ messages in thread
From: Diego Elio Pettenò @ 2011-09-30 10:45 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 519 bytes --]

Il giorno gio, 29/09/2011 alle 16.57 -0500, Donnie Berkholz ha scritto:
> 
> Is this documented anywhere besides the comment immediately above the 
> implementation? Would be nice for anyone who writes a libtool patch
> to 
> be more aware of this. 

I think the whole ELT system is clearly "documented" only in the minds
of Vapier, solar and (partly) me...

Definitely not good, and should be fixed, but ... not sure how we can do
that.

-- 
Diego Elio Pettenò — Flameeyes
http://blog.flameeyes.eu/

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-dev] libtool.eclass documentation
  2011-09-30 10:45   ` [gentoo-dev] " Diego Elio Pettenò
@ 2011-09-30 15:06     ` Mike Frysinger
  2011-09-30 15:27       ` [gentoo-dev] " Diego Elio Pettenò
  0 siblings, 1 reply; 7+ messages in thread
From: Mike Frysinger @ 2011-09-30 15:06 UTC (permalink / raw
  To: gentoo-dev

On Friday, September 30, 2011 06:45:05 Diego Elio Pettenò wrote:
> Il giorno gio, 29/09/2011 alle 16.57 -0500, Donnie Berkholz ha scritto:
> > Is this documented anywhere besides the comment immediately above the
> > implementation? Would be nice for anyone who writes a libtool patch
> > to
> > be more aware of this.
> 
> I think the whole ELT system is clearly "documented" only in the minds
> of Vapier, solar and (partly) me...

and azarah ;)

> Definitely not good, and should be fixed, but ... not sure how we can do
> that.

want to do a brain dump into the @DESCRIPTION part of libtool.eclass ?  and 
then i can add on to your stuff once that's committed.  and in the ELT subdir, 
we can add a small README that just says "see libtool.eclass".

i could extend the eclass man page syntax to allow for dedicated "background" 
or even arbitrary sections, but i think just tacking it onto the existing 
description is fine.
-mike



^ permalink raw reply	[flat|nested] 7+ messages in thread

* [gentoo-dev] Re: libtool.eclass documentation
  2011-09-30 15:06     ` [gentoo-dev] libtool.eclass documentation Mike Frysinger
@ 2011-09-30 15:27       ` Diego Elio Pettenò
  2011-10-14  4:47         ` Mike Frysinger
  0 siblings, 1 reply; 7+ messages in thread
From: Diego Elio Pettenò @ 2011-09-30 15:27 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 342 bytes --]

Il giorno ven, 30/09/2011 alle 11.06 -0400, Mike Frysinger ha scritto:
> and azarah ;)

Right, by the way have you (or anyone else) got any news of him?

> want to do a brain dump into the @DESCRIPTION part of libtool.eclass ?

Yup, will be my weekend's task then.

-- 
Diego Elio Pettenò — Flameeyes
http://blog.flameeyes.eu/

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [gentoo-dev] Re: libtool.eclass documentation
  2011-09-30 15:27       ` [gentoo-dev] " Diego Elio Pettenò
@ 2011-10-14  4:47         ` Mike Frysinger
  0 siblings, 0 replies; 7+ messages in thread
From: Mike Frysinger @ 2011-10-14  4:47 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: Text/Plain, Size: 394 bytes --]

On Friday 30 September 2011 11:27:18 Diego Elio Pettenò wrote:
> Il giorno ven, 30/09/2011 alle 11.06 -0400, Mike Frysinger ha scritto:
> > and azarah ;)
> 
> Right, by the way have you (or anyone else) got any news of him?
> 
> > want to do a brain dump into the @DESCRIPTION part of libtool.eclass ?
> 
> Yup, will be my weekend's task then.

get a chance to do this yet ?
-mike

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-10-14  4:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-09-29 17:28 [gentoo-dev] libtool.eclass update to allow @...@ replacements in patches Mike Frysinger
2011-09-29 21:57 ` Donnie Berkholz
2011-09-29 22:08   ` Mike Frysinger
2011-09-30 10:45   ` [gentoo-dev] " Diego Elio Pettenò
2011-09-30 15:06     ` [gentoo-dev] libtool.eclass documentation Mike Frysinger
2011-09-30 15:27       ` [gentoo-dev] " Diego Elio Pettenò
2011-10-14  4:47         ` Mike Frysinger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox