As per title. Portage currently constructs the module-rebuild package set via packages which own files in /lib/modules. This results in the scenario where sys-kernel/gentoo-kernel (or other similar type packages) are wrongly recorded as external modules in the module-rebuild set because the package owns files in the /lib/modules directory. Reproducible: Always Steps to Reproduce: 1.emerge sys-kernel/gentoo-kernel 2.emerge --ask @module-rebuild 3.emerge output will show sys-kernel/gentoo-kernel alongside any other external kmods e.g. zfs-kmod, nvidia etc Actual Results: sys-kernel/gentoo-kernel wrongly recorded as external kernel module. Expected Results: sys-kernel/gentoo-kernel should not be recorded as an external kernel module. I changed (locally) the module-rebuild package set logic to construct itself via inheritance of linux-mod.eclass as opposed to ownership of files in /lib/modules. However there is the small issue of the following packages which inherit linux-mod.eclass, but only conditionally build external kernel modules. - net-dialup/accel-ppp - net-firewall/ipset - net-fs/openafs - net-misc/openvswitch - app-crypt/tpm-emulator - net-firewall/xtables-addons I spoke with Zac on irc about the possibility of staying with the ownership based logic and adding 'exclude-files=/usr/src' to the module-rebuild set which works nicely, other than the small problem of zfs + spl being installed in that directory. As a result I tried 'exclude-files=/usr/src/linux*' which would hopefully exclude all kernel packages from the ownership logic while allowing zfs to be recorded in the module-rebuild set, but unfortunately exclude-files does not currently accept globs which means this doesn't work. Another approach that Zac proposed would be via 'PROPERTIES="kernel-module"'. As far as I'm aware this would require modifying all the ebuilds individually, unless it is added to the linux-mod.eclass phases as opposed to the class itself (as some ~6 packages inherit linux-mod.eclass but only build kernel modules if USE=foo).
We could also do something like RESTRICT=module-rebuild.
Had bug #757654 too
A possibility is to extend OwnerSet with behavior like VariableSet, so we can exclude owners based on RESTRICT.
Bug 757654 comment 2 is a possibility, though we may need to add glob support to the exclude-files parameter.
We can add exclude-files glob support similar to this: https://gitweb.gentoo.org/proj/portage.git/commit/?id=b1342ac2c83b4a1b0415eb5fcc4dd1d6c65561d8
Fix has been submitted to Portage https://github.com/gentoo/portage/pull/694
PR was merged into Portage 3.0.19.