From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id AFDA2158003 for ; Sat, 3 Dec 2022 21:59:38 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 08CE52BC05F; Sat, 3 Dec 2022 21:59:38 +0000 (UTC) Received: from smtp.gentoo.org (mail.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (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 pigeon.gentoo.org (Postfix) with ESMTPS id E8CFE2BC05F for ; Sat, 3 Dec 2022 21:59:37 +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)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2CF9334151F for ; Sat, 3 Dec 2022 21:59:37 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id A7D6D21 for ; Sat, 3 Dec 2022 21:59:35 +0000 (UTC) From: "Georgy Yakovlev" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Georgy Yakovlev" Message-ID: <1670104766.40e35a1b2001aae0741c54595c2ea871274c37be.gyakovlev@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/zfs-kmod-9999.ebuild X-VCS-Directories: sys-fs/zfs-kmod/ X-VCS-Committer: gyakovlev X-VCS-Committer-Name: Georgy Yakovlev X-VCS-Revision: 40e35a1b2001aae0741c54595c2ea871274c37be X-VCS-Branch: master Date: Sat, 3 Dec 2022 21:59:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: fd16db39-a0ec-4f1e-8ddd-83a8d1fd9419 X-Archives-Hash: dbb896566433b8b5442261a21b056f7e commit: 40e35a1b2001aae0741c54595c2ea871274c37be Author: Georgy Yakovlev gentoo org> AuthorDate: Thu Dec 1 23:50:38 2022 +0000 Commit: Georgy Yakovlev gentoo org> CommitDate: Sat Dec 3 21:59:26 2022 +0000 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=40e35a1b sys-fs/zfs-kmod: clean up old modules in live ebuild Signed-off-by: Georgy Yakovlev gentoo.org> sys-fs/zfs-kmod/zfs-kmod-9999.ebuild | 37 ++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild b/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild index b2fa04c9966a..3e4508af22fc 100644 --- a/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild +++ b/sys-fs/zfs-kmod/zfs-kmod-9999.ebuild @@ -174,7 +174,44 @@ src_install() { einstalldocs } +_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. + [[ -f "${EROOT}/lib/modules/${KV_FULL}/extra/zfs.ko" ]] && _old_layout_cleanup + linux-mod_pkg_postinst if [[ -z ${ROOT} ]] && use dist-kernel; then