mkogg.py: Fix 'self.get_mp4_metadata(self, source)'
[blog.git] / posts / Portage.mdwn
1 [Portage][] is [[Gentoo]]'s default package manager.  This post isn't
2 supposed to be a tutorial, the [handbook][] does a pretty good job of
3 that already.  I'm just recording a few tricks so I don't forget them.
4
5 User patches
6 ============
7
8 While playing around with [[LDAP]], I was trying to troubleshoot the
9 `SASL_NOCANON` handling.  “Gee,” I thought, “wouldn't it be nice to be
10 able to add debugging printfs to figure out what was happening?”
11 Unfortunately, I had trouble getting `ldapwhoami` working when I
12 compiled it by hand.  “Grrr,” I though, “I just want to add a simple
13 patch and do whatever the ebuild already does.”  This is actually
14 pretty easy to do, once you're looking in the right places.
15
16 Write your patch
17 ----------------
18
19 I'm not going to cover that here.
20
21 Place your patch where `epatch_user` will find it
22 -------------------------------------------------
23
24 This would be under
25
26     /etc/portage/patches/<CATEGORY>/<PF|P|PN>/
27
28 If your ebuild already calls `epatch_user`, or it uses an eclass like
29 `base` that calls `epatch_user` internally, you're done.  If not, read
30 on…
31
32 Forcing `epatch_user`
33 ---------------------
34
35 While you could always write an [[overlay|Gentoo_overlay]] with an
36 improved ebuild, a quicker fix for this kind of hack is
37 [/etc/portage/bashrc][bashrc].  I used:
38
39     if [ "${EBUILD_PHASE}" == "prepare" ]; then
40         echo ":: Calling epatch_user";
41         pushd "${S}"
42         epatch_user
43         popd
44     fi
45
46 to insert my patches at the beginning of the `prepare` phase.
47
48 Cleaning up
49 -----------
50
51 It's safe to call `epatch_user` multiple times, so you can leave this
52 setup in place if you like.  However, you might run into problems [if
53 you touch autoconf files][autoconf], so you may want to move your
54 `bashrc` somewhere else until you need it again!
55
56
57 [Portage]: http://www.gentoo.org/proj/en/portage/index.xml
58 [handbook]: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=1
59 [bashrc]: http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=3&chap=6#doc_chap3
60 [autoconf]: http://comments.gmane.org/gmane.linux.gentoo.devel/76466
61
62 [[!tag tags/tools]]
63 [[!tag tags/programming]]