A hook at the very end of a package merge would be nice. 'postinst' is close, but happens before files belonging to a previous version of the merged package are removed. 'mergecomplete' should happen just before portage moves on to the next package/atom to merge. This is a good place to take a snapshot of the file system, restart services, etc. Reproducible: Always Steps to Reproduce:
Created attachment 156541 [details, diff] Patch that works with Portage 2.1.4.4 `cd /usr; patch -p0 < /path/to/mergecomplete.patch` I hope this is the appropriate method to create the hook. Exhaustive testing not done.
For >portage-2.1.5 pkg_postinst is now called after merging the package into the file system AND unmerging previous versions. As of >portage-2.2_rc1 the last regeneration of environment.bz2 for the package is done AFTER pkg_postinst is called. See bug #155993. postinst is now called in the treewalk function in pym/portage/dbapi/vartree.py