Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 404447 - Recent changes to eutils.eclass breaks emerge on g/fbsd
Summary: Recent changes to eutils.eclass breaks emerge on g/fbsd
Status: RESOLVED FIXED
Alias: None
Product: Gentoo/Alt
Classification: Unclassified
Component: FreeBSD (show other bugs)
Hardware: All FreeBSD
: High critical (vote)
Assignee: Gentoo/BSD Team
URL:
Whiteboard:
Keywords:
: 406325 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-02-18 21:22 UTC by Dmitri Bogomolov
Modified: 2013-04-25 18:38 UTC (History)
3 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dmitri Bogomolov 2012-02-18 21:22:37 UTC
Any ebuild containing `epatch` now dies on src_prepare phase. *.patch.out contains:

=======================================================
patch: invalid option -- g
Usage: patch [options] [origfile [patchfile]] [+ [options] [origfile]]...
Options:
       [-cCeEflnNRsStuv] [-b backup-ext] [-B backup-prefix] [-d directory]
       [-D symbol] [-F max-fuzz] [-i patchfile] [-o out-file] [-p[strip-count]]
       [-r rej-name] [-V {numbered,existing,simple}] [--check] [--context]
       [--prefix=backup-prefix] [--suffix=backup-ext] [--ifdef=symbol]
       [--directory=directory] [--ed] [--fuzz=max-fuzz] [--force] [--batch]
       [--ignore-whitespace] [--forward] [--reverse] [--output=out-file]
       [--strip[=strip-count]] [--normal] [--reject-file=rej-name] [--skip]
       [--remove-empty-files] [--quiet] [--silent] [--unified] [--version]
       [--version-control={numbered,existing,simple}] [--index-first]

patch program exited with status 1
=======================================================

Reproducible: Always




# which patch
/usr/bin/patch
# equery belongs /usr/bin/patch
 * Searching for /usr/bin/patch ... 
sys-freebsd/freebsd-contrib-8.2 (/usr/bin/patch)
# equery files sys-devel/patch
 * Searching for patch in sys-devel ...
 * Contents of sys-devel/patch-2.6.1:
/usr
/usr/bin
/usr/bin/gpatch
...
Comment 1 Dmitri Bogomolov 2012-02-18 21:24:24 UTC
Unsure about Product field of this bug.
Comment 3 Alexis Ballier gentoo-dev 2012-02-21 12:59:12 UTC
problem is that doing 'patch_cmd="patch -p${count} ${EPATCH_OPTS}"' ignores the 'alias patch=gpatch' we have in our profile.bashrc; epatch requires gnu patch.

no clue how to get a straightforward fix though :(
Comment 4 Dmitri Bogomolov 2012-02-21 15:41:10 UTC
(In reply to comment #3)
> problem is that doing 'patch_cmd="patch -p${count} ${EPATCH_OPTS}"' ignores the
> 'alias patch=gpatch' we have in our profile.bashrc; epatch requires gnu patch.
> 
> no clue how to get a straightforward fix though :(

I think there is a similar problem with python-updater in bug 370935. And Arfrever Frehtes Taifersar Arahesis proposed `shopt -s expand_aliases`.
Comment 5 SpanKY gentoo-dev 2012-02-24 22:46:05 UTC
does `shopt -s expand_aliases` make it work ?
Comment 6 Dmitri Bogomolov 2012-02-25 06:24:08 UTC
(In reply to comment #5)
> does `shopt -s expand_aliases` make it work ?

No (I tried to add it above patch_cmd=).
Comment 7 Naohiro Aota gentoo-dev 2012-02-27 12:19:53 UTC
How about this patch?

diff -u -r1.384 eutils.eclass
--- eutils.eclass       26 Feb 2012 13:20:59 -0000      1.384
+++ eutils.eclass       27 Feb 2012 12:18:38 -0000
@@ -444,7 +444,7 @@
                # Dynamically detect the correct -p# ... i'm lazy, so shoot me :/
                local patch_cmd
                while [[ ${count} -lt 5 ]] ; do
-                       patch_cmd="patch -p${count} ${EPATCH_OPTS}"
+                       patch_cmd="${BASH_ALIASES[patch]:-patch} -p${count} ${EPATCH_OPTS}"
 
                        # Generate some useful debug info ...
                        (
Comment 8 Dmitri Bogomolov 2012-02-27 13:15:07 UTC
(In reply to comment #7)
> How about this patch?
> 

> -                       patch_cmd="patch -p${count} ${EPATCH_OPTS}"
> +                       patch_cmd="${BASH_ALIASES[patch]:-patch} -p${count} ${EPATCH_OPTS}"

It works for me.
Comment 9 Naohiro Aota gentoo-dev 2012-02-28 13:44:47 UTC
I'll commit this change in a few days, if no devs has disagree for it.
Comment 10 Diego Elio Pettenò (RETIRED) gentoo-dev 2012-02-29 17:06:08 UTC
*** Bug 406325 has been marked as a duplicate of this bug. ***
Comment 11 SpanKY gentoo-dev 2012-02-29 22:58:10 UTC
(In reply to comment #7)

technically, BASH_ALIASES was introduced in bash-4.0, and we are supposed to be compatible with bash-3.2+.  your code would still "work" with older versions of bash if you define "work" as "everyone without a patch alias" (since the ":-" fallback will kick in fine).

if the bsd/prefix guys don't care, then i'm fine with that solution.
Comment 12 Fabian Groffen gentoo-dev 2012-03-01 08:03:26 UTC
Prefix uses GNU patch, so any solution that works for normal Gentoo should work for us here.
Comment 13 Naohiro Aota gentoo-dev 2012-03-01 22:11:52 UTC
Change applied. Thanks.