At my workplace, we have lots of scripts that call `emerge --sync private-work-repo` to ensure that the current system has the latest changes from private-work-repo. It can be annoying if it spends the bulk of its time calling hooks, even though private-work-repo was already up-to-date: >>> Timestamps on the server and in the local repository are the same. >>> Cancelling all further sync action. You are already up to date. So, we want to skip the hooks when repos are already up-to-date. However, we don't want to skip the hooks unless the user has explicitly requested this behavior, since some users might be relying on the existing behavior where hooks are always called regardless of whether or not anything changed. Therefore, I propose a repos.conf sync-hooks-lazy setting which enables this "lazy" hooks behavior: sync-hooks-lazy If set to true, then sync of a given repository will not trigger postsync hooks unless hooks would have executed for a master repository or the repository has changed since the previous sync operation.
There's a patch in the following branch: https://github.com/zmedico/portage/tree/bug_565172 I've posted it for review here: https://archives.gentoo.org/gentoo-portage-dev/message/1322120a0981114736ea7cc91ead28e7
This is in the master branch: https://gitweb.gentoo.org/proj/portage.git/commit/?id=016d605612910211dee1226c2f1c49acc01c490a
Fixed in 2.2.24.