From: Mike Frysinger <vapier@gentoo.org>
To: Gentoo Development <gentoo-dev@lists.gentoo.org>
Subject: [gentoo-dev] libtool.eclass update to allow @...@ replacements in patches
Date: Thu, 29 Sep 2011 13:28:07 -0400 [thread overview]
Message-ID: <201109291328.09124.vapier@gentoo.org> (raw)
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
next reply other threads:[~2011-09-29 17:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-29 17:28 Mike Frysinger [this message]
2011-09-29 21:57 ` [gentoo-dev] libtool.eclass update to allow @...@ replacements in patches 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=201109291328.09124.vapier@gentoo.org \
--to=vapier@gentoo.org \
--cc=gentoo-dev@lists.gentoo.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox