Add a 'prebuilt-kernel' USE flag that controls a bound-slot dependency
on virtual/prebuilt-kernel.  If the flag is enabled, it should ensure
that the module will be rebuilt automatically on future kernel upgrades.

TODO: unmask the flag on other architectures

Signed-off-by: Michał Górny <[email protected]>
---
 eclass/linux-mod.eclass             | 13 ++++++++++---
 profiles/arch/amd64/use.mask        |  4 ++++
 profiles/arch/amd64/use.stable.mask |  6 +++++-
 profiles/arch/base/use.mask         |  6 +++++-
 profiles/use.desc                   |  1 +
 5 files changed, 25 insertions(+), 5 deletions(-)

diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass
index f5a5a4276369..e0444eacc61a 100644
--- a/eclass/linux-mod.eclass
+++ b/eclass/linux-mod.eclass
@@ -1,4 +1,4 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # @ECLASS: linux-mod.eclass
@@ -144,9 +144,16 @@ esac
        0) die "EAPI=${EAPI} is not supported with 
MODULES_OPTIONAL_USE_IUSE_DEFAULT due to lack of IUSE defaults" ;;
 esac
 
-IUSE="kernel_linux 
${MODULES_OPTIONAL_USE:+${_modules_optional_use_iuse_default}}${MODULES_OPTIONAL_USE}"
+IUSE="kernel_linux dist-kernel
+       
${MODULES_OPTIONAL_USE:+${_modules_optional_use_iuse_default}}${MODULES_OPTIONAL_USE}"
 SLOT="0"
-RDEPEND="${MODULES_OPTIONAL_USE}${MODULES_OPTIONAL_USE:+? (} kernel_linux? ( 
sys-apps/kmod[tools] ) ${MODULES_OPTIONAL_USE:+)}"
+RDEPEND="
+       ${MODULES_OPTIONAL_USE}${MODULES_OPTIONAL_USE:+? (}
+               kernel_linux? (
+                       sys-apps/kmod[tools]
+                       dist-kernel? ( virtual/dist-kernel:= )
+               )
+       ${MODULES_OPTIONAL_USE:+)}"
 DEPEND="${RDEPEND}
     ${MODULES_OPTIONAL_USE}${MODULES_OPTIONAL_USE:+? (}
        sys-apps/sed
diff --git a/profiles/arch/amd64/use.mask b/profiles/arch/amd64/use.mask
index 2334ab319381..e4f5aa002053 100644
--- a/profiles/arch/amd64/use.mask
+++ b/profiles/arch/amd64/use.mask
@@ -6,6 +6,10 @@
 
 # SECTION: Unmask
 
+# Michał Górny <[email protected]> (2021-01-03)
+# Prebuilt kernels are supported here.
+-dist-kernel
+
 # Andreas Sturmlechner <[email protected]> (2020-06-06)
 # sci-libs/mkl works on amd64
 -mkl
diff --git a/profiles/arch/amd64/use.stable.mask 
b/profiles/arch/amd64/use.stable.mask
index b83b8507d91c..07bd75f7024c 100644
--- a/profiles/arch/amd64/use.stable.mask
+++ b/profiles/arch/amd64/use.stable.mask
@@ -1,9 +1,13 @@
-# Copyright 1999-2019 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
 # This file requires eapi 5 or later. New entries go on top.
 # Please use the same syntax as in use.mask
 
+# Michał Górny <[email protected]> (2021-01-03)
+# Prebuilt kernel rebuilds are supported on stable yet.
+dist-kernel
+
 # Andreas Sturmlechner <[email protected]> (2020-06-06)
 # sci-libs/mkl is not stable, needs online registration to even run pkg_setup
 mkl
diff --git a/profiles/arch/base/use.mask b/profiles/arch/base/use.mask
index ba124ae0487a..704b33512f21 100644
--- a/profiles/arch/base/use.mask
+++ b/profiles/arch/base/use.mask
@@ -1,6 +1,10 @@
-# Copyright 1999-2020 Gentoo Authors
+# Copyright 1999-2021 Gentoo Authors
 # Distributed under the terms of the GNU General Public License v2
 
+# Michał Górny <[email protected]> (2021-01-03)
+# Prebuilt kernels are not supported on all architectures.
+dist-kernel
+
 # Andreas Sturmlechner <[email protected]> (2020-06-06)
 # sci-libs/mkl is only supported on specific architectures
 mkl
diff --git a/profiles/use.desc b/profiles/use.desc
index e51db5982020..a1ea2238b3ee 100644
--- a/profiles/use.desc
+++ b/profiles/use.desc
@@ -62,6 +62,7 @@ dbus - Enable dbus support for anything that needs it (gpsd, 
gnomemeeting, etc)
 debug - Enable extra debug codepaths, like asserts and extra output. If you 
want to get meaningful backtraces see 
https://wiki.gentoo.org/wiki/Project:Quality_Assurance/Backtraces
 dedicated - Add support for dedicated game servers (some packages do not 
provide clients and servers at the same time)
 dga - Add DGA (Direct Graphic Access) support for X
+dist-kernel - Enable subslot rebuilds on Distribution Kernel upgrades
 djvu - Support DjVu, a PDF-like document format esp. suited for scanned 
documents
 doc - Add extra documentation (API, Javadoc, etc). It is recommended to enable 
per package instead of globally
 dri - Enable direct rendering: used for accelerated 3D and some 2D, like DMA
-- 
2.30.0


Reply via email to