DistroKit Mailinglist
 help / color / mirror / Atom feed
* [DistroKit] [PATCH] targets: yocto: do not fail when optee-os is not found
@ 2024-03-15  7:35 Leonard Göhrs
  2024-03-15  8:02 ` Leonard Göhrs
  0 siblings, 1 reply; 2+ messages in thread
From: Leonard Göhrs @ 2024-03-15  7:35 UTC (permalink / raw)
  To: distrokit; +Cc: Leonard Göhrs

This fixes commit 7e16f18 ("targets: yocto: try finding and generating
optee-os conf.mk"), which failed with a TargetError when optee-os is
not found instead of just trying to find it.

Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
---
 reason/targets/yocto.py | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/reason/targets/yocto.py b/reason/targets/yocto.py
index 87220c8..0c21e49 100644
--- a/reason/targets/yocto.py
+++ b/reason/targets/yocto.py
@@ -1,5 +1,6 @@
 #!/usr/bin/python3
 
+import contextlib
 from logging import LogRecord
 import os
 
@@ -52,14 +53,14 @@ class YoctoTarget(Target):
         except bb.providers.NoProvider:
             raise TargetError("No busybox recipe found")
 
-        try:
+        with contextlib.suppress(bb.providers.NoProvider):
+            # tinfoil.parse_recipe() may raise bb.providers.NoProvider,
+            # in this case we leave self.aliases[b'OPTEECONFIG'] unset.
             rd = self.tinfoil.parse_recipe('optee-os')
 
             builddir = rd.getVar('B')
             if builddir:
                 self.aliases[b'OPTEECONFIG'] = os.path.join(builddir.encode(), b'conf.mk')
-        except bb.providers.NoProvider:
-            raise TargetError("No optee-os recipe found")
 
         # generate .config files if those do not exist, yet.
         if b'KERNELCONFIG' in self.aliases and not os.path.exists(self.aliases[b'KERNELCONFIG']):

base-commit: a46729ec6ffd1c11fc94da2c6f3f4caba86581db
-- 
2.39.2




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

* Re: [DistroKit] [PATCH] targets: yocto: do not fail when optee-os is not found
  2024-03-15  7:35 [DistroKit] [PATCH] targets: yocto: do not fail when optee-os is not found Leonard Göhrs
@ 2024-03-15  8:02 ` Leonard Göhrs
  0 siblings, 0 replies; 2+ messages in thread
From: Leonard Göhrs @ 2024-03-15  8:02 UTC (permalink / raw)
  To: distrokit

Hi,

sorry for the noise. This patch was meant for another mailing list,
but the git send-email --to distrokit@pengutronix.de command was the most
recent one in my shell history and I sent it here by accident.

On 15.03.24 08:35, Leonard Göhrs wrote:
> This fixes commit 7e16f18 ("targets: yocto: try finding and generating
> optee-os conf.mk"), which failed with a TargetError when optee-os is
> not found instead of just trying to find it.
> 
> Signed-off-by: Leonard Göhrs <l.goehrs@pengutronix.de>
> ---
>   reason/targets/yocto.py | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)
> 
> diff --git a/reason/targets/yocto.py b/reason/targets/yocto.py
> index 87220c8..0c21e49 100644
> --- a/reason/targets/yocto.py
> +++ b/reason/targets/yocto.py
> @@ -1,5 +1,6 @@
>   #!/usr/bin/python3
>   
> +import contextlib
>   from logging import LogRecord
>   import os
>   
> @@ -52,14 +53,14 @@ class YoctoTarget(Target):
>           except bb.providers.NoProvider:
>               raise TargetError("No busybox recipe found")
>   
> -        try:
> +        with contextlib.suppress(bb.providers.NoProvider):
> +            # tinfoil.parse_recipe() may raise bb.providers.NoProvider,
> +            # in this case we leave self.aliases[b'OPTEECONFIG'] unset.
>               rd = self.tinfoil.parse_recipe('optee-os')
>   
>               builddir = rd.getVar('B')
>               if builddir:
>                   self.aliases[b'OPTEECONFIG'] = os.path.join(builddir.encode(), b'conf.mk')
> -        except bb.providers.NoProvider:
> -            raise TargetError("No optee-os recipe found")
>   
>           # generate .config files if those do not exist, yet.
>           if b'KERNELCONFIG' in self.aliases and not os.path.exists(self.aliases[b'KERNELCONFIG']):
> 
> base-commit: a46729ec6ffd1c11fc94da2c6f3f4caba86581db



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

end of thread, other threads:[~2024-03-15  8:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-15  7:35 [DistroKit] [PATCH] targets: yocto: do not fail when optee-os is not found Leonard Göhrs
2024-03-15  8:02 ` Leonard Göhrs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox