public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 1/1] linux-mod.eclass: Store compression ext in variable
@ 2023-05-16 13:25 Mike Pagano
  0 siblings, 0 replies; only message in thread
From: Mike Pagano @ 2023-05-16 13:25 UTC (permalink / raw
  To: gentoo-dev


[-- Attachment #1.1.1: Type: text/plain, Size: 2602 bytes --]

When the kernel configuration contains the setting
CONFIG_MODULE_COMPRESS_{GZIP,XZ,STD} we need to store
the extension for a subsequent call to modinfo.

Bug: https://bugs.gentoo.org/906303

Signed-off-by: Mike Pagano <mpagano@gentoo.org>
---
  eclass/linux-mod.eclass | 11 ++++++++++-
  1 file changed, 10 insertions(+), 1 deletion(-)

diff --git a/eclass/linux-mod.eclass b/eclass/linux-mod.eclass
index 0098dbcfc..0fe8d7da4 100644
--- a/eclass/linux-mod.eclass
+++ b/eclass/linux-mod.eclass
@@ -149,6 +149,12 @@
  # @DESCRIPTION:
  # It's a read-only variable. It contains the extension of the kernel modules.
  
+# @ECLASS_VARIABLE: KV_OBJ_COMPRESS_EXT
+# @INTERNAL
+# @DESCRIPTION:
+# Read-only variable. It contains the compression extension of the kernel
+# modules (.xz, .gz, .zst)
+
  case ${EAPI} in
  	7|8) ;;
  	*) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;;
@@ -385,7 +391,7 @@ generate_modulesd() {
  
  		# OK so now if we have got this far, then we know we want to continue
  		# and generate the modprobe.d file.
-		module_modinfo="$(modinfo -p ${currm_path}.${KV_OBJ})"
+		module_modinfo="$(modinfo -p ${currm_path}.${KV_OBJ}${KV_OBJ_COMPRESS_EXT})"
  		module_config="${T}/modulesd-${currm}"
  
  		ebegin "Preparing file for modprobe.d"
@@ -684,6 +690,7 @@ linux-mod_src_install() {
  		if linux_chkconfig_present MODULE_COMPRESS_XZ; then
  			xz -T$(makeopts_jobs) --memlimit-compress=50% -q ${modulename}.${KV_OBJ} || die "Compressing ${modulename}.${KV_OBJ} with xz failed"
  			doins ${modulename}.${KV_OBJ}.xz
+			KV_OBJ_COMPRESS_EXT=".xz"
  		elif linux_chkconfig_present MODULE_COMPRESS_GZIP; then
  			if type -P pigz &>/dev/null ; then
  				pigz -p$(makeopts_jobs) ${modulename}.${KV_OBJ} || die "Compressing ${modulename}.${KV_OBJ} with pigz failed"
@@ -691,9 +698,11 @@ linux-mod_src_install() {
  				gzip ${modulename}.${KV_OBJ} || die "Compressing ${modulename}.${KV_OBJ} with gzip failed"
  			fi
  			doins ${modulename}.${KV_OBJ}.gz
+			KV_OBJ_COMPRESS_EXT=".gz"
  		elif linux_chkconfig_present MODULE_COMPRESS_ZSTD; then
  			zstd -T$(makeopts_jobs) ${modulename}.${KV_OBJ} || "Compressing ${modulename}.${KV_OBJ} with zstd failed"
  			doins ${modulename}.${KV_OBJ}.zst
+			KV_OBJ_COMPRESS_EXT=".zst"
  		else
  			doins ${modulename}.${KV_OBJ}
  		fi
-- 
2.39.3


-- 
Mike Pagano
Gentoo Developer - Kernel Project
E-Mail     : mpagano@gentoo.org
GnuPG FP   : 52CC A0B0 F631 0B17 0142 F83F 92A6 DBEC 81F2 B137
Public Key : http://pgp.mit.edu/pks/lookup?search=0x92A6DBEC81F2B137&op=index

[-- Attachment #1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 14179 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 840 bytes --]

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2023-05-16 13:25 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-16 13:25 [gentoo-dev] [PATCH 1/1] linux-mod.eclass: Store compression ext in variable Mike Pagano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox