From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-1726542-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 498251582EF
	for <garchives@archives.gentoo.org>; Tue, 11 Mar 2025 02:17:01 +0000 (UTC)
Received: from lists.gentoo.org (bobolink.gentoo.org [140.211.166.189])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	(Authenticated sender: relay-lists.gentoo.org@gentoo.org)
	by smtp.gentoo.org (Postfix) with ESMTPSA id 35AC734312A
	for <garchives@archives.gentoo.org>; Tue, 11 Mar 2025 02:17:01 +0000 (UTC)
Received: from bobolink.gentoo.org (localhost [127.0.0.1])
	by bobolink.gentoo.org (Postfix) with ESMTP id DBC9E1103CB;
	Tue, 11 Mar 2025 02:16:54 +0000 (UTC)
Received: from smtp.gentoo.org (woodpecker.gentoo.org [140.211.166.183])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits))
	(No client certificate requested)
	by bobolink.gentoo.org (Postfix) with ESMTPS id D440D1103CB
	for <gentoo-commits@lists.gentoo.org>; Tue, 11 Mar 2025 02:16:54 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256)
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 83C4934310A
	for <gentoo-commits@lists.gentoo.org>; Tue, 11 Mar 2025 02:16:54 +0000 (UTC)
Received: from localhost.localdomain (localhost [IPv6:::1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id ABF6328B5
	for <gentoo-commits@lists.gentoo.org>; Tue, 11 Mar 2025 02:16:52 +0000 (UTC)
From: "Sam James" <sam@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" <sam@gentoo.org>
Message-ID: <1741659382.224d0cc4876d0e8068358e4c518352e07035cf60.sam@gentoo>
Subject: [gentoo-commits] repo/gentoo:master commit in: sys-fs/zfs-kmod/
X-VCS-Repository: repo/gentoo
X-VCS-Files: sys-fs/zfs-kmod/Manifest sys-fs/zfs-kmod/zfs-kmod-2.3.1.ebuild
X-VCS-Directories: sys-fs/zfs-kmod/
X-VCS-Committer: sam
X-VCS-Committer-Name: Sam James
X-VCS-Revision: 224d0cc4876d0e8068358e4c518352e07035cf60
X-VCS-Branch: master
Date: Tue, 11 Mar 2025 02:16:52 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply
X-Archives-Salt: 6c0fd87c-2d42-4a39-a6fe-bf0a6542fe86
X-Archives-Hash: e406a41810676de1c1bb3c771a49cf78

commit:     224d0cc4876d0e8068358e4c518352e07035cf60
Author:     Matthew C <Matthew.nop.dev <AT> gmail <DOT> com>
AuthorDate: Mon Mar 10 22:33:34 2025 +0000
Commit:     Sam James <sam <AT> gentoo <DOT> org>
CommitDate: Tue Mar 11 02:16:22 2025 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=224d0cc4

sys-fs/zfs-kmod: add 2.3.1

Signed-off-by: Matthew C <Matthew.nop.dev <AT> gmail.com>
Closes: https://github.com/gentoo/gentoo/pull/41005
Signed-off-by: Sam James <sam <AT> gentoo.org>

 sys-fs/zfs-kmod/Manifest              |   2 +
 sys-fs/zfs-kmod/zfs-kmod-2.3.1.ebuild | 207 ++++++++++++++++++++++++++++++++++
 2 files changed, 209 insertions(+)

diff --git a/sys-fs/zfs-kmod/Manifest b/sys-fs/zfs-kmod/Manifest
index e2d6085d8a58..bab084f0e317 100644
--- a/sys-fs/zfs-kmod/Manifest
+++ b/sys-fs/zfs-kmod/Manifest
@@ -8,3 +8,5 @@ DIST zfs-2.2.7.tar.gz 33852602 BLAKE2B 31a066d5d543e3328d1afd065a8da4f9b4c52433d
 DIST zfs-2.2.7.tar.gz.asc 836 BLAKE2B e8fc5e04f5b37a22c741bda46b4573e0cebe85da051c73cf3c5fc267de3c313399b235fc346ca06f4c22d37d2500044a26adb3ea241a65fbcf8760d0ef880039 SHA512 8d22a64c920c2a983429688a340f4ae281decdd30e465591e6b40af9f3016b8f168f4e8ea460600c832a2f46b383ff307986649a645585fb25c34fdfda75ad6e
 DIST zfs-2.3.0.tar.gz 34029599 BLAKE2B b9fb7913f95dd0c8aec703961ecc0413aa51df889f15b1541ff8fcd7146ba485947fab83deb062bdffcdeab17a2465b7551c7eba3ec55c62c21aba58846c0da5 SHA512 f0bb1c6e28b325765be809dbc5d38ba294daa38b54eafd7d129cf6081fb209b200580437019faeed3614bbb0687d6583698a9282f3275905a1f5a8314a66cf0b
 DIST zfs-2.3.0.tar.gz.asc 836 BLAKE2B 9d1bd03dc6e5699236bca4c2b20a0a8b46e88d90ea58f7171d087c555da85d6af88acc5990f828ba455f9fbe24c90800c1edf74cd3f865b528730ffef8a931b8 SHA512 ba9a8e8b248de7383c8d33b84b0d70de026b8f3e6a1c82557b74ac274b28e559435541fbdfe816f6b80ce5098b3cac34af69cd53877f1f50fa6a846fa92a5dd0
+DIST zfs-2.3.1.tar.gz 33316972 BLAKE2B 802e2ff8dcd4fa7b819d535819973f8a586ecff71da9ce47b0ad07dc1f60c4bf5377394c4d673491682e5bc934592bc75c8b3ba715cf13a8fbce64a2749d2696 SHA512 bbc1a9f43fb341fbb40214ea388c52c6acdc4dc60d5658973966a04ae6c18cf2b26b93dd3fd729e561b2dedd43342b7b75778975d9f9183a56c2e98b227aa005
+DIST zfs-2.3.1.tar.gz.asc 836 BLAKE2B a447af5a92a68ea8ac9c9118bd3e0e5f5eb14e6e4621be717c8629df66198509e50b10b3d5f75ebc1670d3bf2cdfb938e559e587faef6d0e244fef01358ab43b SHA512 7f0069bab2320115c17c89c0935891b10a9e58a9cee507172a3dfbe6995bce17bca545b81852225dc82ded6943eaef4fea20b41beb663dc952646082e34f0207

diff --git a/sys-fs/zfs-kmod/zfs-kmod-2.3.1.ebuild b/sys-fs/zfs-kmod/zfs-kmod-2.3.1.ebuild
new file mode 100644
index 000000000000..d8c897facd58
--- /dev/null
+++ b/sys-fs/zfs-kmod/zfs-kmod-2.3.1.ebuild
@@ -0,0 +1,207 @@
+# Copyright 1999-2025 Gentoo Authors
+# Distributed under the terms of the GNU General Public License v2
+
+EAPI=8
+
+MODULES_INITRAMFS_IUSE=+initramfs
+inherit autotools flag-o-matic linux-mod-r1 multiprocessing
+
+DESCRIPTION="Linux ZFS kernel module for sys-fs/zfs"
+HOMEPAGE="https://github.com/openzfs/zfs"
+
+MODULES_KERNEL_MAX=6.13
+MODULES_KERNEL_MIN=4.18
+
+if [[ ${PV} == 9999 ]] ; then
+	EGIT_REPO_URI="https://github.com/openzfs/zfs.git"
+	inherit git-r3
+	unset MODULES_KERNEL_MAX
+else
+	VERIFY_SIG_OPENPGP_KEY_PATH=/usr/share/openpgp-keys/openzfs.asc
+	inherit verify-sig
+
+	MY_PV=${PV/_rc/-rc}
+	SRC_URI="https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz"
+	SRC_URI+=" verify-sig? ( https://github.com/openzfs/zfs/releases/download/zfs-${MY_PV}/zfs-${MY_PV}.tar.gz.asc )"
+	S="${WORKDIR}/zfs-${MY_PV}"
+
+	ZFS_KERNEL_COMPAT="${MODULES_KERNEL_MAX}"
+	# Increments minor eg 5.14 -> 5.15, and still supports override.
+	ZFS_KERNEL_DEP="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
+	ZFS_KERNEL_DEP="${ZFS_KERNEL_DEP%%.*}.$(( ${ZFS_KERNEL_DEP##*.} + 1))"
+
+	if [[ ${PV} != *_rc* ]] ; then
+		KEYWORDS="~amd64 ~arm64 ~loong ~ppc64 ~riscv ~sparc"
+	fi
+fi
+
+LICENSE="CDDL MIT debug? ( GPL-2+ )"
+SLOT="0/${PVR}"
+IUSE="custom-cflags debug +rootfs"
+RESTRICT="test"
+
+BDEPEND="
+	app-alternatives/awk
+	dev-lang/perl
+"
+
+if [[ ${PV} != 9999 ]] ; then
+	BDEPEND+=" verify-sig? ( sec-keys/openpgp-keys-openzfs )"
+
+	IUSE+=" +dist-kernel-cap"
+	RDEPEND="
+		dist-kernel-cap? ( dist-kernel? (
+			<virtual/dist-kernel-${ZFS_KERNEL_DEP}
+		) )
+	"
+fi
+
+# Used to suggest matching USE, but without suggesting to disable
+PDEPEND="dist-kernel? ( ~sys-fs/zfs-${PV}[dist-kernel] )"
+
+PATCHES=(
+	"${FILESDIR}"/${PN}-2.1.11-gentoo.patch
+)
+
+pkg_pretend() {
+	use rootfs || return 0
+}
+
+pkg_setup() {
+	local CONFIG_CHECK="
+		EFI_PARTITION
+		ZLIB_DEFLATE
+		ZLIB_INFLATE
+		!DEBUG_LOCK_ALLOC
+		!PAX_KERNEXEC_PLUGIN_METHOD_OR
+	"
+	use debug && CONFIG_CHECK+="
+		DEBUG_INFO
+		FRAME_POINTER
+		!DEBUG_INFO_REDUCED
+	"
+	use rootfs && CONFIG_CHECK+="
+		BLK_DEV_INITRD
+		DEVTMPFS
+	"
+
+	kernel_is -lt 5 && CONFIG_CHECK+=" IOSCHED_NOOP"
+
+	if [[ ${PV} != 9999 ]] ; then
+		local kv_major_max kv_minor_max zcompat
+		zcompat="${ZFS_KERNEL_COMPAT_OVERRIDE:-${ZFS_KERNEL_COMPAT}}"
+		kv_major_max="${zcompat%%.*}"
+		zcompat="${zcompat#*.}"
+		kv_minor_max="${zcompat%%.*}"
+		kernel_is -le "${kv_major_max}" "${kv_minor_max}" || die \
+			"Linux ${kv_major_max}.${kv_minor_max} is the latest supported version"
+	fi
+
+	linux-mod-r1_pkg_setup
+}
+
+src_prepare() {
+	default
+
+	# Run unconditionally (bug #792627)
+	eautoreconf
+
+	if [[ ${PV} != 9999 ]] ; then
+		# Set module revision number
+		sed -Ei "s/(Release:.*)1/\1${PR}-gentoo/" META || die
+	fi
+}
+
+src_configure() {
+	use custom-cflags || strip-flags
+	filter-ldflags -Wl,*
+
+	local myconf=(
+		--bindir="${EPREFIX}"/bin
+		--sbindir="${EPREFIX}"/sbin
+		--with-config=kernel
+		--with-linux="${KV_DIR}"
+		--with-linux-obj="${KV_OUT_DIR}"
+		$(use_enable debug)
+
+		# See gentoo.patch
+		GENTOO_MAKEARGS_EVAL="${MODULES_MAKEARGS[*]@Q}"
+		TEST_JOBS="$(makeopts_jobs)"
+	)
+
+	econf "${myconf[@]}"
+}
+
+src_compile() {
+	emake "${MODULES_MAKEARGS[@]}"
+}
+
+src_install() {
+	emake "${MODULES_MAKEARGS[@]}" DESTDIR="${ED}" install
+	modules_post_process
+
+	dodoc AUTHORS COPYRIGHT META README.md
+}
+
+_old_layout_cleanup() {
+	# new files are just extra/{spl,zfs}.ko with no subdirs.
+	local olddir=(
+		avl/zavl
+		icp/icp
+		lua/zlua
+		nvpair/znvpair
+		spl/spl
+		unicode/zunicode
+		zcommon/zcommon
+		zfs/zfs
+		zstd/zzstd
+	)
+
+	# kernel/module/Kconfig contains possible compressed extentions.
+	local kext kextfiles
+		for kext in .ko{,.{gz,xz,zst}}; do
+		kextfiles+=( "${olddir[@]/%/${kext}}" )
+	done
+
+	local oldfile oldpath
+	for oldfile in "${kextfiles[@]}"; do
+		oldpath="${EROOT}/lib/modules/${KV_FULL}/extra/${oldfile}"
+		if [[ -f "${oldpath}" ]]; then
+			ewarn "Found obsolete zfs module ${oldfile} for current kernel ${KV_FULL}, removing."
+			rm -rv "${oldpath}" || die
+			# we do not remove non-empty directories just for safety in case there's something else.
+			# also it may fail if there are both compressed and uncompressed modules installed.
+			rmdir -v --ignore-fail-on-non-empty "${oldpath%/*.*}" || die
+		fi
+	done
+}
+
+pkg_postinst() {
+	# Check for old module layout before doing anything else.
+	# only attempt layout cleanup if new .ko location is used.
+	local newko=( "${EROOT}/lib/modules/${KV_FULL}/extra"/{zfs,spl}.ko* )
+	# We check first array member, if glob above did not exand, it will be "zfs.ko*" and -f will return false.
+	# if glob expanded -f will do correct file precense check.
+	[[ -f ${newko[0]} ]] && _old_layout_cleanup
+
+	linux-mod-r1_pkg_postinst
+
+	if use x86 || use arm ; then
+		ewarn "32-bit kernels will likely require increasing vmalloc to"
+		ewarn "at least 256M and decreasing zfs_arc_max to some value less than that."
+	fi
+
+	if has_version sys-boot/grub ; then
+		ewarn "This version of OpenZFS includes support for new feature flags"
+		ewarn "that are incompatible with previous versions. GRUB2 support for"
+		ewarn "/boot with the new feature flags is not yet available."
+		ewarn "Do *NOT* upgrade root pools to use the new feature flags."
+		ewarn "Any new pools will be created with the new feature flags by default"
+		ewarn "and will not be compatible with older versions of OpenZFS. To"
+		ewarn "create a new pool that is backward compatible wih GRUB2, use "
+		ewarn
+		ewarn "zpool create -o compatibility=grub2 ..."
+		ewarn
+		ewarn "Refer to /usr/share/zfs/compatibility.d/grub2 for list of features."
+	fi
+}