Gentoo/Applying patches

From Sidvind
Jump to: navigation, search

Apply custom patches to ebuilds[edit]

Depending on the package you can apply custom patches without modifying the ebuild by dropping .patch-files in /etc/portage/patches/${CATEGORY}/${P} where ${P} can also contain both versions and slots:

  • /etc/portage/patches/dev-lang/python
  • /etc/portage/patches/dev-lang/python:3.4
  • /etc/portage/patches/dev-lang/python-3.4.2

For this to work the ebuild must call epatch_user in src_prepare. In case the ebuild doesn't you can force it by utilizing /etc/portage/bashrc (globally) or /etc/portage/env/... (per package) to force calling epatch_user in the post_src_prepare hook (see blog.yjl.im for details)