Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to apply patches?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
Drasica
Apprentice
Apprentice


Joined: 16 Apr 2006
Posts: 181

PostPosted: Wed Mar 02, 2011 6:17 pm    Post subject: How to apply patches? Reply with quote

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
View user's profile Send private message
mikegpitt
Advocate
Advocate


Joined: 22 May 2004
Posts: 3224

PostPosted: Wed Mar 02, 2011 6:39 pm    Post subject: Reply with quote

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
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 54033
Location: 56N 3W

PostPosted: Wed Mar 02, 2011 6:55 pm    Post subject: Reply with quote

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
View user's profile Send private message
forrestfunk81
Guru
Guru


Joined: 07 Feb 2006
Posts: 565
Location: münchen.de

PostPosted: Thu Mar 03, 2011 12:42 pm    Post subject: Reply with quote

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
View user's profile Send private message
z0ny
Tux's lil' helper
Tux's lil' helper


Joined: 19 Mar 2005
Posts: 102
Location: Germany

PostPosted: Fri Apr 22, 2011 7:35 am    Post subject: Reply with quote

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
View user's profile Send private message
Mad Alex
n00b
n00b


Joined: 22 Feb 2005
Posts: 6
Location: York, UK

PostPosted: Sat Apr 23, 2011 9:12 pm    Post subject: Application of user patches with portage 2.1.9.42 Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum