From patchwork Fri Feb 2 13:35:17 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 13542904 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 74F924655F; Fri, 2 Feb 2024 13:35:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706880927; cv=none; b=u9j2wXOdveH6hkU8um7zbewkXwNxLNIXHXY+WmN06mlCooLCGCePI13jyj/HtSn8sIUh6I421Hp1+qrEgJFKmJlUSu8uyNCqAL0zCpT9pn9u58Ybj8lgLUdtlRWYhDExQ1iHNsj08R7f9z68VVXNdiJH8yNS6qMgfoinpweApLk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706880927; c=relaxed/simple; bh=RKMOk0rYR3IGINlpmA2Z8cdwjH0dlA8ns+BK0/KqDhQ=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=Qkb/qemZcN2jPAYHgKsmGGNtRyXJQ+LH5lcv4ro+0DskQEx1WyNKlfs/xue0IlldpvW+lBEqo10AY/2K4Ky+jls+nIHeHiTzUuEpV+0Nqwnx7+TfpP/8cBfyLtigNQ/vU+0eF9RhNHiEkoMUvHagh+pW4Zt6Q3HQUohZiEOty44= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PmN7xeAD; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PmN7xeAD" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 151F8C433C7; Fri, 2 Feb 2024 13:35:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1706880927; bh=RKMOk0rYR3IGINlpmA2Z8cdwjH0dlA8ns+BK0/KqDhQ=; h=From:To:Cc:Subject:Date:From; b=PmN7xeADdgyThbN7l4XKfqTgeB5HRIhIwfK6MGIj/wMB2Gzx8p4vd6jPX50FtHTjk 3gXfTRHzFrUEGlX61XMOKZRHol/iKQX9KIz6LL+8UQ9Ixv88/iCOqln2zDa8ijfjQR saGUs8jNuaA03bFRDUuw/NuuLSm3J/kzXg2fFEyR65SuPeSPRUZEQi1NdY3fw+Q+ce 1cscWfbqheiBklAi2zFpfruIrYoY+LApEe0rmKwEnfmz3WdnseHZrbRmroWvz+f7k4 Sa0hKmese3nNXWu3+r28Oz6AzCLtKO1Z6D82itcIO3yC/HG8BrE4EK+I2WlanjNXVf TlKnuFhDLChww== From: Masahiro Yamada To: linux-kbuild@vger.kernel.org Cc: Masahiro Yamada , Nathan Chancellor , Nicolas Schier , linux-kernel@vger.kernel.org Subject: [PATCH 1/4] kbuild: rpm-pkg: do not include depmod-generated files Date: Fri, 2 Feb 2024 22:35:17 +0900 Message-Id: <20240202133520.302738-1-masahiroy@kernel.org> X-Mailer: git-send-email 2.40.1 Precedence: bulk X-Mailing-List: linux-kbuild@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Installing the kernel package is fine, but when uninstalling it, the following warnings are shown: warning: file modules.symbols.bin: remove failed: No such file or directory warning: file modules.symbols: remove failed: No such file or directory warning: file modules.softdep: remove failed: No such file or directory warning: file modules.devname: remove failed: No such file or directory warning: file modules.dep.bin: remove failed: No such file or directory warning: file modules.dep: remove failed: No such file or directory warning: file modules.builtin.bin: remove failed: No such file or directory warning: file modules.builtin.alias.bin: remove failed: No such file or directory warning: file modules.alias.bin: remove failed: No such file or directory warning: file modules.alias: remove failed: No such file or directory The %preun scriptlet runs 'kernel-install remove', which in turn invokes /usr/lib/kernel/install.d/50-depmod.install to remove those files before the actual package removal. RPM-based distributions do not ship files generated by depmod. Mark them as %ghost in order to exclude them from the package, but still claim the ownership on them. Signed-off-by: Masahiro Yamada Tested-by: Nathan Chancellor --- scripts/package/kernel.spec | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/scripts/package/kernel.spec b/scripts/package/kernel.spec index f58726671fb3..aaedb6d1b26f 100644 --- a/scripts/package/kernel.spec +++ b/scripts/package/kernel.spec @@ -66,6 +66,20 @@ ln -fns /usr/src/kernels/%{KERNELRELEASE} %{buildroot}/lib/modules/%{KERNELRELEA %{make} %{makeflags} run-command KBUILD_RUN_COMMAND='${srctree}/scripts/package/install-extmod-build %{buildroot}/usr/src/kernels/%{KERNELRELEASE}' %endif +{ + for x in System.map config kernel modules.builtin \ + modules.builtin.modinfo modules.order vmlinuz; do + echo "/lib/modules/%{KERNELRELEASE}/${x}" + done + + for x in alias alias.bin builtin.alias.bin builtin.bin dep dep.bin \ + devname softdep symbols symbols.bin; do + echo "%ghost /lib/modules/%{KERNELRELEASE}/modules.${x}" + done + + echo "%exclude /lib/modules/%{KERNELRELEASE}/build" +} > %{buildroot}/kernel.list + %clean rm -rf %{buildroot} @@ -78,6 +92,9 @@ for file in vmlinuz System.map config; do cp "/lib/modules/%{KERNELRELEASE}/${file}" "/boot/${file}-%{KERNELRELEASE}" fi done +if [ ! -e "/lib/modules/%{KERNELRELEASE}/modules.dep" ]; then + /usr/sbin/depmod %{KERNELRELEASE} +fi %preun if [ -x /sbin/new-kernel-pkg ]; then @@ -91,10 +108,9 @@ if [ -x /sbin/update-bootloader ]; then /sbin/update-bootloader --remove %{KERNELRELEASE} fi -%files +%files -f %{buildroot}/kernel.list %defattr (-, root, root) -/lib/modules/%{KERNELRELEASE} -%exclude /lib/modules/%{KERNELRELEASE}/build +%exclude /kernel.list %files headers %defattr (-, root, root)