eclean-kernel
eclean-kernel copied to clipboard
Add --write-eclean-kernel-preserved-set option
This options makes eclean-kernel create (or update) a portage user set called 'eclean-kernel-preserved'. Since user sets are automatically part of the world set, this prevents kernels that are preserved by eclean-kernel to be uninstalled by portage via the depclean mechanism.
I don't think this is the right approach. It basically assumes that the PM should remove kernels unless user calls eclean-kernel first, in which case eclean-kernel blocks the PM from removing kernels.
It would really make more sense if emerge marked newly installed kernels as "non-uninstallable", and EK removed these markers in order to unblock removal.
I don't think this is the right approach.
And I think I agree. However, this approach seems to do the job of preserving installed kernels from --depclean
. You only have to
-
emerge @world
-
eclean-kernel --num 3 --write-eclean-kernel-preserved-set
-
emerge --depclean
that is, you should run eclean-kernel
prior --depclean
so that the dynamic user set is generated. Your proposed solution does not have this requirement. But on the other hand, it would require modifications to portage (if I understand your proposal correctly), and, probably overall require more effort.
While I am not absolutely happy with the approach in this PR, it is a relatively small modification. The only thing that I do not like is the dependency on gentoolkit, but it was the only(?) API I could find to query the package owning a file1.
But overall, I like it, and hence would like to continue with this PR. You are, of course, free to reject it on various grounds. I'd like to know where you stand: Is it, as is, an absolute no-go for eclean-kernel?
1: I was quite surprised that I was unable to find a portage API doing the same. But maybe I missed it?
Yes, IMO it's a no-go. It's counterintuitive and it really doesn't belong here.
Let us see if we can find a compromise. Would introducing an eclean-kerne hook, which is passed the preserved and to be removed kernel versions as arguments, be acceptable? Then users, like me, could add something that creates the dynamic portage set in /etc/eclean-kernel/hook.d
.
What kind of hook? How would it work?
What kind of hook? How would it work?
Lines of code say more than a thousands words: Something among the lines of https://github.com/projg2/eclean-kernel/pull/38