Groups | Search | Server Info | Login | Register


Groups > linux.gentoo.dev > #70498

Re: [gentoo-dev] [PATCH 1/1] kernel-2.eclass: Check to ensure genpatches contains the intended linux patch version

From Sam James <sam@gentoo.org>
Newsgroups linux.gentoo.dev
Subject Re: [gentoo-dev] [PATCH 1/1] kernel-2.eclass: Check to ensure genpatches contains the intended linux patch version
Date 2026-05-04 18:10 +0200
Message-ID <MR41P-2zfX-3@gated-at.bofh.it> (permalink)
References <MR35M-2yEl-9@gated-at.bofh.it>
Organization Gentoo

Show all headers | View raw


[Multipart message — attachments visible in raw view] - view raw

Mike Pagano <mpagano@gentoo.org> writes:

> Iterate through the patch set files names looking for the kernel
> version to be installed. Die on failure.
>
> Signed-off-by: Mike Pagano <mpagano@gentoo.org>

I'd include two Bug tags for
Bug: https://bugs.gentoo.org/972596
and
Bug: https://bugs.gentoo.org/970493

> ---
>  eclass/kernel-2.eclass | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>
> diff --git a/eclass/kernel-2.eclass b/eclass/kernel-2.eclass
> index 9484eab5b..7676e7276 100644
> --- a/eclass/kernel-2.eclass
> +++ b/eclass/kernel-2.eclass
> @@ -1115,6 +1115,28 @@ unipatch() {
>  			fi
>  		fi
>
> +        # If we use genpatches, let's make sure it includes the
> +        # kernel patch for the version we are trying to install
> +        # This is a sanity check to make sure the genpatches version
> +        # in the ebuild is correct
> +        #
> +        # Iterate through patch and look for OKV
> +        if [[ -n "${K_WANT_GENPATCHES}" ]]; then
> +            KV_PATCH_FOUND=
> +            for file in ${KPATCH_DIR}/*; do
> +                filename="${file##*/}"
> +                if [[ "$filename" == *"${OKV}"* ]]; then
> +                    KV_PATCH_FOUND=yes
> +                    break;
> +                fi
> +            done
> +            if [[ -z ${KV_PATCH_FOUND} ]]; then
> +                eerror "GENPATCHES does not contain linux patch ${OKV}"
> +                eerror "Please check your ebuild for the proper
> K_GENPATCHES_VER=N"
> +                die "GENPATCHES appears to be missing Linux patch ${OKV}"
> +            fi
> +        fi

Not tested it but this looks reasonable to me, thank you!

Another check could be done on VERSION/PATCHLEVEL in the Makefile to
compare with PV but I am not sure that adds anything on top of this, and
I think this check would catch the cases we've seen happen, so I
wouldn't worry about that.

> +
>  		# If experimental was not chosen by the user, drop
>                    experimental patches not in K_EXP_GENPATCHES_LIST.
>  		if [[ ${i} == *genpatches-*.experimental.* && -n
>  		${K_EXP_GENPATCHES_PULL} ]]; then
>  			if [[ -z ${K_EXP_GENPATCHES_NOUSE} ]] && use experimental; then

Back to linux.gentoo.dev | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

[gentoo-dev] [PATCH 1/1] kernel-2.eclass: Check to ensure genpatches contains the intended linux patch version Mike Pagano <mpagano@gentoo.org> - 2026-05-04 17:10 +0200
  Re: [gentoo-dev] [PATCH 1/1] kernel-2.eclass: Check to ensure  genpatches contains the intended linux patch version Sam James <sam@gentoo.org> - 2026-05-04 18:10 +0200
    Re: [gentoo-dev] [PATCH 1/1] kernel-2.eclass: Check to ensure  genpatches contains the intended linux patch version Sam James <sam@gentoo.org> - 2026-05-04 18:40 +0200
      Re: [gentoo-dev] [PATCH 1/1] kernel-2.eclass: Check to ensure  genpatches contains the intended linux patch version Mike Pagano <mpagano@gentoo.org> - 2026-05-04 19:00 +0200

csiph-web