View previous topic :: View next topic |
Author |
Message |
Drasica Apprentice
Joined: 16 Apr 2006 Posts: 181
|
Posted: Wed Mar 02, 2011 6:17 pm Post subject: How to apply patches? |
|
|
I'm trying to apply a patch I found in this thread: https://bugs.gentoo.org/show_bug.cgi?id=342101
But I'm having trouble finding a recent set of documentation on how to apply a patch.
I would appreciate any links to sites/threads/or even instructions here! |
|
Back to top |
|
|
mikegpitt Advocate
Joined: 22 May 2004 Posts: 3224
|
Posted: Wed Mar 02, 2011 6:39 pm Post subject: |
|
|
The usual syntax is:
Code: | patch -p0 < file.patch | You will want to replace the 0 with the level of directory you are under. Usually most patches are applied at p0 or p1.
Although... if you are applying a patch to an ebuild, portage will take care of these details for you if you make a call to epatch inside the ebuild. This way you don't need to manually patch a source package prior to building it. |
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54123 Location: 56N 3W
|
Posted: Wed Mar 02, 2011 6:55 pm Post subject: |
|
|
Drasica,
If you are going the ebuild edit route, copy the ebuild to your own overlay - the handbook explains the setup.
Bump the ebuild version, so that the one in your overlay is more recent than the one in portage.
Put the patch file in the ./files directory, next to your .ebuild file.
Look at a few other ebuilds to see how to call epatch - customise for your case.
Run Code: | ebuild /path/to/ebuild digest | so portage does not generate digest errors.
emerge your modified package
test the package.
file a bug at bugs.gentoo.org with your patch attached, giving credit to the original author, the link to the side where you found the patch.
Move on to your next contribution to Gentoo. _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
forrestfunk81 Guru
Joined: 07 Feb 2006 Posts: 565 Location: münchen.de
|
Posted: Thu Mar 03, 2011 12:42 pm Post subject: |
|
|
There is also an easy way to patch ebuilds with the /etc/portage/patches/ directory.
In this bug report is a good description of what to do.
Quote: | Instead of worrying about updating the ebuild when you have "user" patches to
apply like this one, in /most/ cases, you can simply drop the patch as a file
in /etc/portage/patches/cat-egory/package(-version-optional)/*.patch and
portage will automatically try to apply it for you. |
_________________ # cd /pub/
# more beer |
|
Back to top |
|
|
z0ny Tux's lil' helper
Joined: 19 Mar 2005 Posts: 102 Location: Germany
|
Posted: Fri Apr 22, 2011 7:35 am Post subject: |
|
|
Does this work with sys-apps/portage-2.1.9.42? I'd like to patch the pam_mysql package to fix a memory leak and thus put the .patch file into '/etc/portage/patches/sys-auth/pam_mysql-0.7_rc1-r1/' (also tried without a version) but it seems to be ignored when re-emerging the package. Am I missing something? Thanks in advance. _________________ Old C programmers never die. They're just cast into void. |
|
Back to top |
|
|
Mad Alex n00b
Joined: 22 Feb 2005 Posts: 6 Location: York, UK
|
Posted: Sat Apr 23, 2011 9:12 pm Post subject: Application of user patches with portage 2.1.9.42 |
|
|
The application of user patches from /etc/portage/patches does still work with portage 2.1.9.42 but it does not work with all packages. It only works if the ebuild calls epatch_user from src_prepare, or if it inherits src_prepare from an eclass whose implementation includes such a call.
So one way or another you will have to go through the whole processes of copying the pam_mysql ebuild into an overlay so that you can edit its src_prepare function. Sorry! You could either hack it to directly apply the patch you want to test or probably easier would be to add a call to epatch_user so that the patch will be picked up from /etc/portage/patches.
If you felt especially motivated you could file a bug about pam_mysql not supporting user patches.
Hope that helps,
Alex |
|
Back to top |
|
|
|