From: W. Trevor King Date: Sat, 23 Jun 2012 18:50:41 +0000 (-0400) Subject: Add Portage post. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=152c4ba1bd0aacf06c02dda524ad68dc6d238d19;p=mw2txt.git Add Portage post. --- diff --git a/posts/Portage.mdwn b/posts/Portage.mdwn new file mode 100644 index 0000000..6b82d2f --- /dev/null +++ b/posts/Portage.mdwn @@ -0,0 +1,63 @@ +[Portage][] is [[Gentoo]]'s default package manager. This post isn't +supposed to be a tutorial, the [handbook][] does a pretty good job of +that already. I'm just recording a few tricks so I don't forget them. + +User patches +============ + +While playing around with [[LDAP]], I was trying to troubleshoot the +`SASL_NOCANON` handling. “Gee,” I thought, “wouldn't it be nice to be +able to add debugging printfs to figure out what was happening?” +Unfortunately, I had trouble getting `ldapwhoami` working when I +compiled it by hand. “Grrr,” I though, “I just want to add a simple +patch and do whatever the ebuild already does.” This is actually +pretty easy to do, once you're looking in the right places. + +Write your patch +---------------- + +I'm not going to cover that here. + +Place your patch where `epatch_user` will find it +------------------------------------------------- + +This would be under + + /etc/portage/patches/// + +If your ebuild already calls `epatch_user`, or it uses an eclass like +`base` that calls `epatch_user` internally, you're done. If not, read +on… + +Forcing `epatch_user` +--------------------- + +While you could always write an [[overlay|Gentoo_overlay]] with an +improved ebuild, a quicker fix for this kind of hack is +[/etc/portage/bashrc][bashrc]. I used: + + if [ "${EBUILD_PHASE}" == "prepare" ]; then + echo ":: Calling epatch_user"; + pushd "${S}" + epatch_user + popd + fi + +to insert my patches at the beginning of the `prepare` phase. + +Cleaning up +----------- + +It's safe to call `epatch_user` multiple times, so you can leave this +setup in place if you like. However, you might run into problems [if +you touch autoconf files][autoconf], so you may want to move your +`bashrc` somewhere else until you need it again! + + +[Portage]: http://www.gentoo.org/proj/en/portage/index.xml +[handbook]: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1 +[bashrc]: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=6#doc_chap3 +[autoconf]: http://comments.gmane.org/gmane.linux.gentoo.devel/76466 + +[[!tag tags/tools]] +[[!tag tags/programming]]