alias patch=gpatch is set in Gentoo/FreeBSD profile. (profiles/default/bsd/fbsd/profile.bashrc) But, EAPI=6 patch method (_eapply_patch) ignores alias. e.g.) # emerge dev-vcs/git >>> Emerging (1 of 1) dev-vcs/git-2.7.1::gentoo * git-2.7.1.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ... [ ok ] * git-manpages-2.7.1.tar.xz SHA256 SHA512 WHIRLPOOL size ;-) ... [ ok ] >>> Unpacking source... >>> Unpacking git-2.7.1.tar.xz to /var/tmp/portage/dev-vcs/git-2.7.1/work >>> Unpacking git-manpages-2.7.1.tar.xz to /var/tmp/portage/dev-vcs/git-2.7.1/work/git-2.7.1 >>> Source unpacked in /var/tmp/portage/dev-vcs/git-2.7.1/work >>> Preparing source in /var/tmp/portage/dev-vcs/git-2.7.1/work/git-2.7.1 ... * Applying git-2.2.2-optional-cvs.patch ... patch: invalid option -- g usage: patch [-bCcEeflNnRstuv] [-B backup-prefix] [-D symbol] [-d directory] [-F max-fuzz] [-i patchfile] [-o out-file] [-p strip-count] [-r rej-name] [-V t | nil | never] [-x number] [-z backup-ext] [--posix] [origfile [patchfile]] patch <patchfile [ !! ] * ERROR: dev-vcs/git-2.7.1::gentoo failed (prepare phase): * patch -p1 failed with /usr/portage/dev-vcs/git/files/git-2.2.2-optional-cvs.patch * * Call stack: * ebuild.sh, line 133: Called src_prepare * environment, line 4045: Called default * phase-functions.sh, line 805: Called default_src_prepare * phase-functions.sh, line 870: Called __eapi6_src_prepare * environment, line 272: Called eapply '/usr/portage/dev-vcs/git/files/git-2.2.2-optional-cvs.patch' '/usr/portage/dev-vcs/git/files/git-1.8.5-mw-vendor.patch' '/usr/portage/dev-vcs/git/files/git-2.2.0-svn-fe-linking.patch' '/usr/portage/dev-vcs/git/files/git-2.5.1-freebsd-10.x-no-iconv.patch' * environment, line 834: Called _eapply_patch '/usr/portage/dev-vcs/git/files/git-2.2.2-optional-cvs.patch' * environment, line 772: Called __helpers_die 'patch -p1 failed with /usr/portage/dev-vcs/git/files/git-2.2.2-optional-cvs.patch' * isolated-functions.sh, line 117: Called die * The specific snippet of code: * die "$@" * * If you need support, post the output of `emerge --info '=dev-vcs/git-2.7.1::gentoo'`, * the complete build log and the output of `emerge -pqv '=dev-vcs/git-2.7.1::gentoo'`. * The complete build log is located at '/var/tmp/portage/dev-vcs/git-2.7.1/temp/build.log'. * The ebuild environment file is located at '/var/tmp/portage/dev-vcs/git-2.7.1/temp/environment'. * Working directory: '/var/tmp/portage/dev-vcs/git-2.7.1/work/git-2.7.1' * S: '/var/tmp/portage/dev-vcs/git-2.7.1/work/git-2.7.1' Reproducible: Always
Created attachment 425394 [details, diff] sample patch for bin/phase-helpers.sh
Apparently addition of new aliases does not affect previously defined functions (at least in bash 4.3)... I think that something like the following would be more readable: local patch_executable type -P gpatch > /dev/null && patch_executable=gpatch || patch_executable=patch ... ${patch_executable} -p1 -f -s -g0 ...
*** Bug 579578 has been marked as a duplicate of this bug. ***
*** Bug 585844 has been marked as a duplicate of this bug. ***
*** Bug 585956 has been marked as a duplicate of this bug. ***
We can use a bin/ebuild-helpers/bsd/patch script, similar to bin/ebuild-helpers/bsd/sed.
Created attachment 437930 [details, diff] tested ebuild-helpers/bsd/patch (Replacement from sed to patch) (In reply to Zac Medico from comment #6) > We can use a bin/ebuild-helpers/bsd/patch script, similar to > bin/ebuild-helpers/bsd/sed. I tried your idea. And, I was confirm that the patch is applied. Please add a helper script.
(In reply to Yuta SATOH from comment #7) > Created attachment 437930 [details, diff] [details, diff] > tested ebuild-helpers/bsd/patch (Replacement from sed to patch) Looks good, except I think we should remove the EPATCH variable support. The ESED variable probably isn't used by anyone, so I'd prefer not to support another variable that's not really needed.
Hmm, I wonder if the patch wrapper will break some bsd build systems due to them expecting a bsd version of the patch command in $PATH. If so, it will be safer not to use a wrapper. @bsd team: Do you think a patch wrapper that forces gpatch will break things?
This is in the master branch: https://gitweb.gentoo.org/proj/portage.git/commit/?id=abf71501a7d81f95770322497995c205eff1999c
Fixed in 2.3.0.