1 |
commit: 64edea29f6e62c0ac1005d072f391fe5d4dc0822 |
2 |
Author: Michał Górny <mgorny <AT> gentoo <DOT> org> |
3 |
AuthorDate: Sat Aug 26 11:16:13 2017 +0000 |
4 |
Commit: Michał Górny <mgorny <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Aug 26 11:16:13 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/elt-patches.git/commit/?id=64edea29 |
7 |
|
8 |
Use explicit tool vars instead of aliases |
9 |
|
10 |
Aliases do not work for calling the tool in a subshell, so just |
11 |
explicitly set FIND, PATCH and SED variables to the correct tool, |
12 |
and use them to call them. |
13 |
|
14 |
eltpatch.in | 19 +++++++++---------- |
15 |
1 file changed, 9 insertions(+), 10 deletions(-) |
16 |
|
17 |
diff --git a/eltpatch.in b/eltpatch.in |
18 |
index 8f6f9f3..d8c847b 100644 |
19 |
--- a/eltpatch.in |
20 |
+++ b/eltpatch.in |
21 |
@@ -3,10 +3,9 @@ |
22 |
# Distributed under the terms of the GNU General Public License v2 |
23 |
|
24 |
# BSD support; https://bugs.gentoo.org/628882 |
25 |
-# note: this need to happen before function definitions |
26 |
-type -P gfind &>/dev/null && alias find=gfind |
27 |
-type -P gpatch &>/dev/null && alias patch=gpatch |
28 |
-type -P gsed &>/dev/null && alias sed=gsed |
29 |
+type -P gfind &>/dev/null && FIND=gfind || FIND=find |
30 |
+type -P gpatch &>/dev/null && PATCH=gpatch || PATCH=patch |
31 |
+type -P gsed &>/dev/null && SED=gsed || SED=sed |
32 |
|
33 |
source "@ELT_gentoofuncs@" || exit 1 |
34 |
|
35 |
@@ -40,11 +39,11 @@ ELT_try_and_apply_patch() { |
36 |
# Save file for permission restoration. `patch` sometimes resets things. |
37 |
# Ideally we'd want 'stat -c %a', but stat is highly non portable and we are |
38 |
# guaranted to have GNU find, so use that instead. |
39 |
- local perms="$(find ${file} -maxdepth 0 -printf '%m')" |
40 |
+ local perms="$(${FIND} ${file} -maxdepth 0 -printf '%m')" |
41 |
# We only support patchlevel of 0 - why worry if its static patches? |
42 |
- if patch -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then |
43 |
+ if ${PATCH} -p0 --dry-run "${file}" "${patch}" >> "${log}" 2>&1 ; then |
44 |
einfo " Applying ${disp} ..." |
45 |
- patch -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1 |
46 |
+ ${PATCH} -p0 -g0 --no-backup-if-mismatch "${file}" "${patch}" >> "${log}" 2>&1 |
47 |
ret=$? |
48 |
ELT_APPLIED_PATCHES="${ELT_APPLIED_PATCHES} ${src}" |
49 |
else |
50 |
@@ -92,9 +91,9 @@ ELT_walk_patches() { |
51 |
pushd "@ELT_patchdir@" >/dev/null || die "pushd to elt-patch dir failed" |
52 |
|
53 |
# Go through the patches in reverse order (newer version to older) |
54 |
- for patch in $(find "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do |
55 |
+ for patch in $(${FIND} "${patch_set}" -maxdepth 1 -type f | LC_ALL=C sort -r) ; do |
56 |
tmp="${TMPDIR}/libtool-elt.patch" |
57 |
- sed "${sed_args[@]}" "${patch}" > "${tmp}" || die "sed on patch ${patch} failed" |
58 |
+ ${SED} "${sed_args[@]}" "${patch}" > "${tmp}" || die "sed on patch ${patch} failed" |
59 |
if ELT_try_and_apply_patch "${file}" "${tmp}" "${patch}" ; then |
60 |
# Break to unwind w/popd rather than return directly |
61 |
ret=0 |
62 |
@@ -192,7 +191,7 @@ elibtoolize() { |
63 |
[[ -f ${S}/ltmain.sh || -f ${S}/configure ]] && dirs+=( "${S}" ) |
64 |
else |
65 |
[[ ${#dirs[@]} -eq 0 ]] && dirs+=( "${S}" ) |
66 |
- dirs=( $(find "${dirs[@]}" '(' -name ltmain.sh -o -name configure ')' -printf '%h\n' | sort -u) ) |
67 |
+ dirs=( $(${FIND} "${dirs[@]}" '(' -name ltmain.sh -o -name configure ')' -printf '%h\n' | sort -u) ) |
68 |
fi |
69 |
|
70 |
local d p ret |