Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 440996 - dev-db/mysql++-3.0.9 should use epatch_user
Summary: dev-db/mysql++-3.0.9 should use epatch_user
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: [OLD] Development (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo Linux MySQL bugs team
Depends on:
Reported: 2012-11-02 18:47 UTC by S.Holzbach
Modified: 2013-03-05 16:27 UTC (History)
0 users

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


Note You need to log in before you can comment on or make changes to this bug.
Description S.Holzbach 2012-11-02 18:47:12 UTC
Trying to resolve bug 378921 by appplying patch via epatch_user function failes because ebuild does not call epatch_user

Reproducible: Always

Steps to Reproduce:
1.use gcc-4.6 or higher
2.emerge dev-db/mysql++-3.0.9
Actual Results:  
emerge failes with errors described in 378921 because patch in /etc/portage/patches/dev-db/mysql++ is not applied

Expected Results:  
patch is applied and emerge proceeds
Comment 1 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2012-11-03 15:42:40 UTC
Here's the way to patch a package that doesn't call epatch_user:

1) Place your patch in /etc/portage/patches/CATEGORY/PKG/ where you need to replace CATEGORY/PKG by the package atom you're using excluding the version.

2) Place the following code in /etc/portage/env/CATEGORY/PKG-VER where you need to replace CATEGORY/PKG-VER by the package atom optionally including the version, it should be noted that /PKG-VER is a file and not a directory! Replace CATEGORY/PKG/NAME below such that it can find your patch.

    post_src_prepare() {
        patch -p1 < /etc/portage/patches/CATEGORY/PKG/NAME.patch

Extra notes:

3) If the ebuild uses eutils, you could just use epatch_user.

4) pre_src_prepare might not always work, in some case you'll need it to happen at another moment. You can add pre_ (before) or post_ (after) to any of the ebuild phases (see

Since you can choose when your patch applies (and this is not limited to patching); this gives you a much bigger control over the build without needing to place the ebuild in a local overlay or keeping it up-to-date.

Are you suggesting that epatch_user needs to be added to the ebuild?

I don't know the rules on that, but it might be that they only add it to packages that are patches often.
Comment 2 S.Holzbach 2012-11-03 18:47:00 UTC
Ok, I didn't know this way to apply my own (or not yet in portage) patches. I only know the way described here:

This description sounds to me like the epatch_user way is the preferred way of applying out-of-portage patches.
Maybe the handbook needs an update ?

One question:
Would it be possible to do something like that:

post_src_prepare() {

This would eliminate the need to list all patches...
Comment 3 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2012-11-03 19:07:55 UTC
> Would it be possible to do something like that

Yes, but only if the ebuild uses eutils, some don't and I'm unaware if it's possible to inherit eutils through this way. Although that won't be necessary in this case, as mysql++ does inherit eutils so this will most likely work.

What I've suggested before is a specific way which allows you to manipulate what happens between build phases without actually touching them, if you want a more generic way to apply all patches from a dir at a specific build phase, see codestation's simple bashrc post in

I can tell you in advance that this might not always work since sometimes you'll not want to apply the patch at post_src_unpack but instead apply it at post_src_prepare or some later point because you wanted to patch a file that has been produced and not change a file that came with the source. Which is why I use the more specific method; it's up to you which one you use, or just mix them both...

This has been assigned to the mysql maintainers which might or might not include epatch_user in the ebuild, as per the usage rules or their reasoning regarding that function...

Let us know if you managed to get it patched or have further problems.
Comment 4 S.Holzbach 2012-11-04 01:21:43 UTC
I got it patched by editing the ebuild and add epatch_user to src_unpack-method. No further problems arised.

Thank you
Comment 5 Tom Wijsman (TomWij) (RETIRED) gentoo-dev 2012-11-04 20:11:17 UTC
(In reply to comment #4)
> I got it patched by editing the ebuild and add epatch_user to
> src_unpack-method. No further problems arised.
> Thank you

You'll need to place it in a local overlay for that, otherwise an `emerge --sync` will override it. See the Creating a Local Overlay section at If you want to avoid doing this for each new version you can use one of the methods I've described above. Glad you've got it patched.

Anyhow, I'll leave this bug open so we can see if more people need this support and to let the maintainers of this package decide whether they want to add epatch_user support to the package.
Comment 6 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2013-03-04 20:24:19 UTC
InCVS. Thanks to Brian Evans.