Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 781617 - Portage module-rebuild set wrongly records gentoo-kernel as an external kmod
Summary: Portage module-rebuild set wrongly records gentoo-kernel as an external kmod
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: PATCH
Depends on:
Blocks: 144480
  Show dependency tree
 
Reported: 2021-04-09 02:56 UTC by Dave Hughes
Modified: 2021-06-21 19:37 UTC (History)
6 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dave Hughes 2021-04-09 02:56:17 UTC
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).
Comment 1 Zac Medico gentoo-dev 2021-04-09 03:00:32 UTC
We could also do something like RESTRICT=module-rebuild.
Comment 2 Ionen Wolkens gentoo-dev 2021-04-09 03:32:44 UTC
Had bug #757654 too
Comment 3 Zac Medico gentoo-dev 2021-04-09 03:39:44 UTC
A possibility is to extend OwnerSet with behavior like VariableSet, so we can exclude owners based on RESTRICT.
Comment 4 Zac Medico gentoo-dev 2021-04-09 03:41:09 UTC
Bug 757654 comment 2 is a possibility, though we may need to add glob support to the exclude-files parameter.
Comment 5 Zac Medico gentoo-dev 2021-04-09 03:45:41 UTC
We can add exclude-files glob support similar to this:

https://gitweb.gentoo.org/proj/portage.git/commit/?id=b1342ac2c83b4a1b0415eb5fcc4dd1d6c65561d8
Comment 6 Dave Hughes 2021-04-16 13:26:37 UTC
Fix has been submitted to Portage https://github.com/gentoo/portage/pull/694
Comment 7 Dave Hughes 2021-06-21 19:37:29 UTC
PR was merged into Portage 3.0.19.