7

How can I customize an ebuild in Gentoo without maintaining a customized package in own overlay?

The case is that I need to mark compiled binaries with paxctl. But there are about 100 of such packages and I don't want to watch for updates by myself in local overlay.

Portage ebuilds aren't compiled without such marking. Now I have to change their compile flags in /etc/portage/package.env directory. PAX-marking is a better solution but I don't know how to do that in Gentoo within the portage tree.

4

Using portage you can do this with package.env. The right place to look for the documentation is http://dev.gentoo.org/~zmedico/portage/doc/portage.html#config-bashrc-ebuild-phase-hooks. Basically the way you use it is as follows. First you create (assuming standard setup without custom ROOT) a file in /etc/portage/env. For example, you can create a file /etc/portage/env/paxmark

#paxmark

#Set this to what you need it to be
PAXFLAGS="-p"

post_src_install() {
  find "${INSTALL}" -type x -print0 |xargs -0 -n 1 paxctl $PAXFLAGS
}

Then for all packages you want this to apply to you add an entry to /etc/portage/package.env :

#package.env example for paxmark
sys-apps/gcc paxmark

This will apply the paxmark script to the package that has it specified. Alternatively you can also create a /etc/portage/bashrc script for global overrides (be very careful with that).

A general warning though, as you can add pre and post hooks to all phases this can be dangerous. Be careful with what you do as all your packages that use the hook have now become no more robust than your hook script. (The above example for pax marking should be fine).

  • 1
    Thanks for giving an answer. It will be helpful if you can provide more steps to your answer. – Ramesh Apr 24 '14 at 15:23
  • I've updated the question. Hope this helps more. – Paul de Vrieze Apr 24 '14 at 16:06
  • This way causes a portage exception in my case. I've opened a new question – Uroc327 Jul 25 '15 at 9:21
1

If you switch to Paludis, which is an alternative package manager for Gentoo (i.e. a replacement for emerge), you can probably set up a hook to do that.

  • Can paludis work with catalyst? – trupanka Sep 1 '13 at 8:38
  • I don't know. I've never tried catalyst. – cjm Sep 1 '13 at 14:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.