commit:     abf71501a7d81f95770322497995c205eff1999c
Author:     Zac Medico <zmedico <AT> gentoo <DOT> org>
AuthorDate: Sun Jun 19 05:49:25 2016 +0000
Commit:     Zac Medico <zmedico <AT> gentoo <DOT> org>
CommitDate: Sun Jun 19 05:51:31 2016 +0000
URL:        https://gitweb.gentoo.org/proj/portage.git/commit/?id=abf71501

eapply: use gpatch for bsd userland (bug 574626)

This is needed because eapply uses GNU patch extensions, such as the -g
option.

X-Gentoo-Bug: 574626
X-Gentoo-Bug-url: https://bugs.gentoo.org/show_bug.cgi?id=574626

 bin/phase-helpers.sh | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/bin/phase-helpers.sh b/bin/phase-helpers.sh
index 5af2784..995156a 100644
--- a/bin/phase-helpers.sh
+++ b/bin/phase-helpers.sh
@@ -981,9 +981,12 @@ fi
 
 if ___eapi_has_eapply; then
        eapply() {
-               local failed
+               local failed patch_cmd=patch
                local -x LC_COLLATE=POSIX
 
+               # for bsd userland support, use gpatch if available
+               type -P gpatch > /dev/null && patch_cmd=gpatch
+
                _eapply_patch() {
                        local f=${1}
                        local prefix=${2}
@@ -995,7 +998,7 @@ if ___eapi_has_eapply; then
                        # -s to silence progress output
                        # -g0 to guarantee no VCS interaction
                        # --no-backup-if-mismatch not to pollute the sources
-                       patch -p1 -f -s -g0 --no-backup-if-mismatch \
+                       ${patch_cmd} -p1 -f -s -g0 --no-backup-if-mismatch \
                                "${patch_options[@]}" < "${f}"
                        failed=${?}
                        if ! eend "${failed}"; then

Reply via email to