All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] kernel-yocto.bbclass: Fixup do_kernel_configcheck usage of KMETA
@ 2022-04-21  3:58 Russ Dill
  2022-04-21 12:31 ` Bruce Ashfield
  0 siblings, 1 reply; 2+ messages in thread
From: Russ Dill @ 2022-04-21  3:58 UTC (permalink / raw)
  To: openembedded-core; +Cc: Bruce Ashfield, Russ Dill

The do_kernel_configcheck task requires a meta directory, normally
set by ${KMETA}. The meta directory is taken as a relative path
from ${S}:

        outfile = "{}/{}/cfg/mismatch.txt".format( s, kmeta )

However, when checking for the presence of ${KMETA} the current
working directory is searched. This will almost always fail and
"kgit --meta" is used instead. If the user does have a path in
their current working directory that matches the ${KMETA}
variable but the path is not present within the kernel source
directory, the build will fail if it tries to write config errors/
warnings to that path.

If ${KMETA} is not set, the same problem exists with the hard-coded
"meta" directory.

Fix these issues by checking for ${KMETA} within ${S} rather than
the current working directory. Additionally, drop the hardcoded
backup directory "meta" as it hasn't been functioning and
probably has no users

Signed-off-by: Russ Dill <russ.dill@nikolamotor.com>
---
 meta/classes/kernel-yocto.bbclass | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 1d5a8cdf29..4cb638864c 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -521,15 +521,15 @@ python do_config_analysis() {
 python do_kernel_configcheck() {
     import re, string, sys, subprocess
 
-    # if KMETA isn't set globally by a recipe using this routine, we need to
-    # set the default to 'meta'. Otherwise, kconf_check is not passed a valid
-    # meta-series for processing
-    kmeta = d.getVar("KMETA") or "meta"
-    if not os.path.exists(kmeta):
-        kmeta = subprocess.check_output(['kgit', '--meta'], cwd=d.getVar('S')).decode('utf-8').rstrip()
-
     s = d.getVar('S')
 
+    # if KMETA isn't set globally by a recipe using this routine, use kgit to
+    # locate or create the meta directory. Otherwise, kconf_check is not
+    # passed a valid meta-series for processing
+    kmeta = d.getVar("KMETA")
+    if not kmeta or not os.path.exists('{}/{}'.format(s,kmeta)):
+        kmeta = subprocess.check_output(['kgit', '--meta'], cwd=d.getVar('S')).decode('utf-8').rstrip()
+
     env = os.environ.copy()
     env['PATH'] = "%s:%s%s" % (d.getVar('PATH'), s, "/scripts/util/")
     env['LD'] = d.getVar('KERNEL_LD')
-- 
2.25.1



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] kernel-yocto.bbclass: Fixup do_kernel_configcheck usage of KMETA
  2022-04-21  3:58 [PATCH] kernel-yocto.bbclass: Fixup do_kernel_configcheck usage of KMETA Russ Dill
@ 2022-04-21 12:31 ` Bruce Ashfield
  0 siblings, 0 replies; 2+ messages in thread
From: Bruce Ashfield @ 2022-04-21 12:31 UTC (permalink / raw)
  To: Russ Dill; +Cc: Patches and discussions about the oe-core layer

On Wed, Apr 20, 2022 at 11:58 PM Russ Dill <russ.dill@nikolamotor.com> wrote:
>
> The do_kernel_configcheck task requires a meta directory, normally
> set by ${KMETA}. The meta directory is taken as a relative path
> from ${S}:
>
>         outfile = "{}/{}/cfg/mismatch.txt".format( s, kmeta )
>
> However, when checking for the presence of ${KMETA} the current
> working directory is searched. This will almost always fail and
> "kgit --meta" is used instead. If the user does have a path in
> their current working directory that matches the ${KMETA}
> variable but the path is not present within the kernel source
> directory, the build will fail if it tries to write config errors/
> warnings to that path.
>
> If ${KMETA} is not set, the same problem exists with the hard-coded
> "meta" directory.
>
> Fix these issues by checking for ${KMETA} within ${S} rather than
> the current working directory. Additionally, drop the hardcoded
> backup directory "meta" as it hasn't been functioning and
> probably has no users

Looks good to me. I continued to poke at this yesterday, and can't
think of any users this will break .. and if it does, I'll be around to
fix any fallout.

Acked-by: Bruce Ashfield <bruce.ashfield@gmail.com>

>
> Signed-off-by: Russ Dill <russ.dill@nikolamotor.com>
> ---
>  meta/classes/kernel-yocto.bbclass | 14 +++++++-------
>  1 file changed, 7 insertions(+), 7 deletions(-)
>
> diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
> index 1d5a8cdf29..4cb638864c 100644
> --- a/meta/classes/kernel-yocto.bbclass
> +++ b/meta/classes/kernel-yocto.bbclass
> @@ -521,15 +521,15 @@ python do_config_analysis() {
>  python do_kernel_configcheck() {
>      import re, string, sys, subprocess
>
> -    # if KMETA isn't set globally by a recipe using this routine, we need to
> -    # set the default to 'meta'. Otherwise, kconf_check is not passed a valid
> -    # meta-series for processing
> -    kmeta = d.getVar("KMETA") or "meta"
> -    if not os.path.exists(kmeta):
> -        kmeta = subprocess.check_output(['kgit', '--meta'], cwd=d.getVar('S')).decode('utf-8').rstrip()
> -
>      s = d.getVar('S')
>
> +    # if KMETA isn't set globally by a recipe using this routine, use kgit to
> +    # locate or create the meta directory. Otherwise, kconf_check is not
> +    # passed a valid meta-series for processing
> +    kmeta = d.getVar("KMETA")
> +    if not kmeta or not os.path.exists('{}/{}'.format(s,kmeta)):
> +        kmeta = subprocess.check_output(['kgit', '--meta'], cwd=d.getVar('S')).decode('utf-8').rstrip()
> +
>      env = os.environ.copy()
>      env['PATH'] = "%s:%s%s" % (d.getVar('PATH'), s, "/scripts/util/")
>      env['LD'] = d.getVar('KERNEL_LD')
> --
> 2.25.1
>


-- 
- Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end
- "Use the force Harry" - Gandalf, Star Trek II


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-21 16:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-21  3:58 [PATCH] kernel-yocto.bbclass: Fixup do_kernel_configcheck usage of KMETA Russ Dill
2022-04-21 12:31 ` Bruce Ashfield

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.