I am trying to create a system without lvm, and build udesks with -lvm flag.
udesks does not pull in lvm because of the -lvm flag, but it pulls in libblockdev with mandatory cryptsetup use flag.
libblockdev pulls in sys-fs/cryptsetup.
sys-fs/cryptsetup then unconditionally pulls in lvm2.
This should not happen. and can be prevented by having cryptsetup honor the lvm flag.
Steps to Reproduce:
1. set USE="-lvm" in make.conf
2. emerge -uDN udisks
3. lvm2 is pulled in due to cryptsetup.
sys-fs/lvm2 is emerged even when use flag -lvm says it should not be.
USE flag -lvm in make.conf should make sure that package lvm is never emerged.
I do not see a possibility to make lvm optional in sys-fs/cryptsetup. There's a non-optional configure check for libdevmapper which belongs to sys-fs/lvm2:
The only other solution I can see here is to install sys-fs/lvm2 with USE="device-mapper-only" which does what the USE flag says, it's only installing device-mapper stuff. Would that be a feasible alternative to you?
This would meet the goal of removing parts that are unnecessary bloat, while keeping essential functionality.
My concern with this kind of use flags is twofold:
They are relatively hard to understand for someone who does not delve deeply in the details of a package, so that means that the meaning of this use flag may need some more description that just 'emerges the device mapper only'.
So if I want to globally set -lvm, I may understand what logical volumes are, as they are something on a user level, but not what the device mapper is, as that is more of an implementation issue. Also the relation to the global -lvm flag may not be clear.
The second concern is that according to its name this is one flag that enables/disable two things: the logical volume management and the device mapper. I believe there is more flexibility to have one flag for each thing that you want to enable/disable.
So I guess there should be in fact two local flags: lvm and device-mapper with the semantics that the first emerges the 'logical volumes' and the second the device mapper'.
They would have the following relation in the lvm2 ebuild:
if lvm is set, then device-mapper must be set.
if lvm is unset, then device mapper is free to be enabled, and can be required by depending packages.
In this way, cryptsetup can specify it requires sys-fs/lvm2[device-mapper]. This is more logical than requiring sys-fs/cryptsetup[device-mapper-only].
(In reply to jan vereecke from comment #2)
What would happen if the user has USE="-lvm -device-mapper"? I suspect we would end up installing nothing, which doesn't make any sense. I think the "device-mapper" USE flag would serve no useful purpose.
However, changing "device-mapper-only" to "lvm" and inverting its logic definitely makes sense. Enabling USE flags should add functionality, not remove it.
That would work and makes sense. packages such as cryptsetup would then only depend on sys-fs/lvm2, whereas packages requiring lvm functionality would need sys-fs/lvm2[lvm], and it would follow the global meaning of the lvm flag.