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: 195863 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:9bc1:b0:106:209c:c626 with SMTP id op1csp429809dyc; Fri, 2 Feb 2024 05:35:55 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcq125ls7m88TX6vEYHIi2ADcJA5q/uQAePgl/oxclvAtlm5Thrh1zq3J32eiwAecXO5SG X-Received: by 2002:a17:906:494a:b0:a36:c276:c3ca with SMTP id f10-20020a170906494a00b00a36c276c3camr3462651ejt.6.1706880955727; Fri, 02 Feb 2024 05:35:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706880955; cv=pass; d=google.com; s=arc-20160816; b=mtDgkGzt4WjgMx/PjJ5QH5sH1nUbGITXsL66z+QuisI15+Ja2HpvVKxNma25AlkjZX VeiiEsv3O+n6SCtgkkXwdssu9f+QuuLN0f9XdKRf4xb8W9O9VwLNTZEfsqm1NDiMSoCu CjnELqlTDgGOOj1PnvToM5nkF2npnc/wiz1FybjlG8rfnBo8M3k4rcOAgfJmmxANSjHe 2UVLjJEGkqy0N/AyU0gP0q0MARC9uNytpEx09X9TJFrGb4DEEhx3pcDxqFotZCK0QcUW kRQ0FoK5e0dNlFLl/wg6z94qWoMhJVI1nPtWXV6mvnRmEqIN9+6oaY357Impuq3ySsfA PkcA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:message-id:date:subject:cc:to :from:dkim-signature; bh=6Rnx9nu+vhOuZfQSLmGIry1m7ALm/JSk9kPP9WdMsPM=; fh=jagLYAb8PgzL5kbgO1cvQ5W2D3qaPeuwD177Nvcl+U4=; b=fSJMjQcaXnsLZA5MzN0dki4OFlZBKllttaV1DSb/yjjpLWmBhU1+EUPpqiQN6jefsB QzR9SKk1NS3hAUS0PGzNumL85ibFeW63bdnhp3sPXoX0TCyQ2hy1acVhXjrQwyWpBcce ztcCT2kuD7xfKIAhnCh5gbQNKopzEC7pQTLtC+VwJkN1hIgEXr1K1RJwZTIIXvgXyESN Jqjd13C4ZVgKtIjUHkZUwrfrAkDog10PUZ/ANuQkRyHGM2aL31NNa5p/qGWUifs5cKtw 6Ki6w3MAvQ+9hPN6fHlxLSuC3ur4ncM3HkeJFhTRc+XH3UVmYEsePnDz66j/xfK4x6a2 7fNg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PmN7xeAD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49904-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49904-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org X-Forwarded-Encrypted: i=1; AJvYcCWwgTdsKgrASTQnepF9ctiG58b2Bwcl1Jr7QzIzI3NCH9tLB4FcXe/9n4HMDH80sDFxYu8GCsng9cmTf8DumgILtIfTwQ== Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id qh8-20020a170906eca800b00a36c46652ebsi825469ejb.502.2024.02.02.05.35.55 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Feb 2024 05:35:55 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-49904-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PmN7xeAD; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-49904-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-49904-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 4B7F81F279B4 for ; Fri, 2 Feb 2024 13:35:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2EDEB5A4C2; Fri, 2 Feb 2024 13:35:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PmN7xeAD" 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 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789794404776361717 X-GMAIL-MSGID: 1789794404776361717 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)