With the current state of emerge getting bigger, and better organized, i'm going to propose a hook system into emerge to let users run functions before any build-event in emerge Currently the proof-of-concept can hook any of the action_* functions in emerge and run any hook-script in /etc/portage/portage.hooks as long as it has a .py extension, which can be further limited to scripts that certify certain conditions, etc. Also we can modify the tracebacks from any hooked function to hide the emerge system itself, since any error is basically the error of the hook-script writer and not of emerge, although this system is good potential for injection attacks, since any script will be run, allowing modification of portage at runtime Attached is a patch to emerge-2.1.1_pre4-r2 that will implement this feature An API of overridable functions in emerge should also be drawn up and users allowed to modify those
Created attachment 93519 [details, diff] Patch against emerge-2.1.1_pre4-r2
I'd also like to see something like this. I think simply extending the postsync.d idea that is in recentish portages would be effective. One possibilite includes: postmerge.d--Run right before an emerge process terminates, users for this could be glep 42 NEWS updates, removing the etc-update notice from portage itself, running programs such as locale purge once instead of once per package, and perhaps even some of the other commonly run updates (gmime db/env-update comes to mind, but this may break things)
wrt ebuild phases, I believe bashrc can accomplish this. postmerge.d, just make a shell script.