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 4545315802E for ; Thu, 27 Jun 2024 04:07:56 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 35BFFE29F4; Thu, 27 Jun 2024 04:07:52 +0000 (UTC) Received: from smtp.gentoo.org (dev.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) server-digest SHA256) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id D52D4E29EF for ; Thu, 27 Jun 2024 04:07:51 +0000 (UTC) From: Ulrich Mueller To: Andrew Nowa Ammerlaan Cc: gentoo-dev@lists.gentoo.org Subject: Re: [gentoo-dev] [PATCH 2/5] kernel-install.eclass: move mount-boot check to, dist-kernel-utils.eclass In-Reply-To: (Andrew Nowa Ammerlaan's message of "Wed, 26 Jun 2024 22:07:27 +0200") References: <38ed17cb-950a-4abd-b904-537388dbe612@gentoo.org> <476674df-a57c-4c4d-ad1e-487211a4daf0@gentoo.org> Date: Thu, 27 Jun 2024 06:07:44 +0200 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-dev@lists.gentoo.org Reply-to: gentoo-dev@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" X-Archives-Salt: fa99a5f2-a6fa-4c51-8010-fa86beba0eea X-Archives-Hash: 6477adf86f2412ef042c215271fd7e6b --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable >>>>> On Wed, 26 Jun 2024, Andrew Nowa Ammerlaan wrote: > --- a/eclass/dist-kernel-utils.eclass > +++ b/eclass/dist-kernel-utils.eclass > @@ -26,7 +26,7 @@ case ${EAPI} in > *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; > esac >=20=20 > -inherit toolchain-funcs > +inherit mount-boot-utils toolchain-funcs >=20=20 > # @FUNCTION: dist-kernel_get_image_path > # @DESCRIPTION: > @@ -79,11 +79,40 @@ dist-kernel_install_kernel() { > local image=3D${2} > local map=3D${3} >=20=20 > - ebegin "Installing the kernel via installkernel" > - # note: .config is taken relatively to System.map; > - # initrd relatively to bzImage > - ARCH=3D$(tc-arch-kernel) installkernel "${version}" "${image}" "${map}" > - eend ${?} || die -n "Installing the kernel failed" > + local success=3D > + # not an actual loop but allows error handling with 'break' > + while :; do IMHO "while true" would be better readable. > + nonfatal mount-boot_check_status || break > + > + ebegin "Installing the kernel via installkernel" > + # note: .config is taken relatively to System.map; > + # initrd relatively to bzImage > + ARCH=3D$(tc-arch-kernel) installkernel "${version}" > "${image}" "${map}" || break > + eend ${?} || die -n "Installing the kernel failed" > + > + success=3D1 > + break > + done > + > + if [[ ! ${success} ]]; then > + # Try to read dist-kernel identifier to more accurately instruct users > + local kernel > + local k_id_file=3D${image%$(dist-kernel_get_image_path)}/dist-kernel > + if [[ -f ${k_id_file} ]]; then > + kernel=3D\'\=3D$(<${k_id_file})\' > + else > + # Fallback string if identifier is not found > + kernel=3D":" > + fi > + > + eerror > + eerror "The kernel was not deployed successfully. Inspect the failure" > + eerror "in the logs above and once you resolve the problems please" > + eerror "run the equivalent of the following command to try again:" > + eerror > + eerror " emerge --config ${kernel}" > + die "Kernel install failed, please fix the problems > and run emerge --config" > + fi > } >=20=20 > # @FUNCTION: dist-kernel_reinstall_initramfs > diff --git a/eclass/kernel-install.eclass b/eclass/kernel-install.eclass > index f512d815fe098..a572597bc6fa3 100644 > --- a/eclass/kernel-install.eclass > +++ b/eclass/kernel-install.eclass > @@ -18,8 +18,6 @@ > # location and System.map. > # > # The eclass exports src_test, pkg_postinst and pkg_postrm. > -# Additionally, the inherited mount-boot eclass exports pkg_pretend. > -# It also stubs out pkg_preinst and pkg_prerm defined by mount-boot. >=20=20 > # @ECLASS_VARIABLE: KERNEL_IUSE_GENERIC_UKI > # @PRE_INHERIT > @@ -50,7 +48,7 @@ case ${EAPI} in > *) die "${ECLASS}: EAPI ${EAPI:-0} not supported" ;; > esac >=20=20 > -inherit dist-kernel-utils mount-boot multiprocessing toolchain-funcs > +inherit dist-kernel-utils mount-boot-utils multiprocessing toolchain-fun= cs >=20=20 > SLOT=3D"${PV}" > IUSE=3D"+initramfs test" > @@ -526,6 +524,10 @@ kernel-install_test() { > kernel-install_pkg_pretend() { > debug-print-function ${FUNCNAME} "${@}" >=20=20 > + # Check, but don't die because we can fix the problem and then > + # emerge --config ... to re-run installation. > + nonfatal mount-boot_check_status > + > if ! has_version -d sys-kernel/linux-firmware; then > ewarn "sys-kernel/linux-firmware not found installed on your system." > ewarn "This package provides various firmware files that may be needed" > @@ -665,27 +667,8 @@ kernel-install_install_all() { > fi > fi >=20=20 > - local success=3D > - # not an actual loop but allows error handling with 'break' > - while :; do > - nonfatal mount-boot_check_status || break > - > - nonfatal dist-kernel_install_kernel "${module_ver}" \ > - "${kernel_dir}/${image_path}" "${kernel_dir}/System.map" || break > - > - success=3D1 > - break > - done > - > - if [[ ! ${success} ]]; then > - eerror > - eerror "The kernel files were copied to disk successfully but the kern= el" > - eerror "was not deployed successfully. Once you resolve the problems," > - eerror "please run the equivalent of the following command to try agai= n:" > - eerror > - eerror " emerge --config ${CATEGORY}/${PN}:${SLOT}" > - die "Kernel install failed, please fix the problems > and run emerge --config ${CATEGORY}/${PN}:${SLOT}" > - fi > + dist-kernel_install_kernel "${module_ver}" "${kernel_dir}/${image_path}= " \ > + "${kernel_dir}/System.map" > } >=20=20 > # @FUNCTION: kernel-install_pkg_postinst > @@ -718,15 +701,6 @@ kernel-install_pkg_postinst() { > fi > } >=20=20 > -# @FUNCTION: kernel-install_pkg_prerm > -# @DESCRIPTION: > -# Stub out mount-boot.eclass. > -kernel-install_pkg_prerm() { > - debug-print-function ${FUNCNAME} "${@}" > - > - # (no-op) > -} > - > # @FUNCTION: kernel-install_pkg_postrm > # @DESCRIPTION: > # Clean up the generated initramfs from the removed kernel directory. > @@ -774,5 +748,5 @@ kernel-install_compress_modules() { >=20=20 > fi >=20=20 > -EXPORT_FUNCTIONS src_test pkg_preinst pkg_postinst pkg_prerm pkg_postrm > +EXPORT_FUNCTIONS src_test pkg_preinst pkg_postinst pkg_postrm > EXPORT_FUNCTIONS pkg_config pkg_pretend --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFDBAEBCAAtFiEEtDnZ1O9xIP68rzDbUYgzUIhBXi4FAmZ85ZAPHHVsbUBnZW50 b28ub3JnAAoJEFGIM1CIQV4ukXsH/ip3DGPTMQ0wlB2+u981qGiKg6unA2TJjll7 4qOMFA1/mDBaBW1zgYUAFO8v1Cf0KUWQd4L3APDquLSY9TQRcpoWuCBmYeN4074S Q3S9C4ufNpPQ9+Kr8j48sQFe2O1k391zjy45vtBr2mHEcLQvWVZ/S8VN1NH6e06B g5lC0i39No6hloqFQGIRAdZPYj2m4XAx7gRjAFyXYQx8kfS10pXQxpxAtLFV+0w3 7ZsEeAErHcRw19L+SJSrRI56mkSQNtrEpxROQRoqGK2xg5Sd4nnb4yruGDXeuLmd rj+h9aylW9kE2Q32g4bU9VarQscCWjaVJs2D8RtLKDXkjWDkPQo= =CzcB -----END PGP SIGNATURE----- --=-=-=--