public inbox for gentoo-catalyst@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-catalyst] [PATCH] Fix spec file USE flag parsing
@ 2020-10-14 13:38 Felix Bier
  2020-10-14 17:50 ` Matt Turner
  0 siblings, 1 reply; 2+ messages in thread
From: Felix Bier @ 2020-10-14 13:38 UTC (permalink / raw
  To: gentoo-catalyst@lists.gentoo.org

In stagebase, the set_use function applies .split() to the use flags
passed from the spec file, if the value is a string. However, the
result is immediately overwritten after the if-statement. Therefore the
.split() is ineffectual.

This results in self.settings["use"] holding a string,
which is then regarded as a list of characters in write_make_conf.
This fix ensures that the result of the split is not overwritten
(matching the similar code in set_catalyst_use).

For example, setting "stage4/use: abc" in a spec file results
in USE="a b c ..." in the generated make.conf.
With this fix, the generated make.conf contains the expected
USE="abc ...".
---
 catalyst/base/stagebase.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
index df1cb844..2e313bd8 100644
--- a/catalyst/base/stagebase.py
+++ b/catalyst/base/stagebase.py
@@ -512,7 +512,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
         if use in self.settings:
             if isinstance(self.settings[use], str):
                 self.settings["use"] = self.settings[use].split()
-            self.settings["use"] = self.settings[use]
+            else:
+                self.settings["use"] = self.settings[use]
             del self.settings[use]
         else:
             self.settings["use"] = []
-- 
2.28.0

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

* Re: [gentoo-catalyst] [PATCH] Fix spec file USE flag parsing
  2020-10-14 13:38 [gentoo-catalyst] [PATCH] Fix spec file USE flag parsing Felix Bier
@ 2020-10-14 17:50 ` Matt Turner
  0 siblings, 0 replies; 2+ messages in thread
From: Matt Turner @ 2020-10-14 17:50 UTC (permalink / raw
  To: gentoo-catalyst

On Wed, Oct 14, 2020 at 6:38 AM Felix Bier <Felix.Bier@rohde-schwarz.com> wrote:
>
> In stagebase, the set_use function applies .split() to the use flags
> passed from the spec file, if the value is a string. However, the
> result is immediately overwritten after the if-statement. Therefore the
> .split() is ineffectual.
>
> This results in self.settings["use"] holding a string,
> which is then regarded as a list of characters in write_make_conf.
> This fix ensures that the result of the split is not overwritten
> (matching the similar code in set_catalyst_use).
>
> For example, setting "stage4/use: abc" in a spec file results
> in USE="a b c ..." in the generated make.conf.
> With this fix, the generated make.conf contains the expected
> USE="abc ...".
> ---
>  catalyst/base/stagebase.py | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
> index df1cb844..2e313bd8 100644
> --- a/catalyst/base/stagebase.py
> +++ b/catalyst/base/stagebase.py
> @@ -512,7 +512,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
>          if use in self.settings:
>              if isinstance(self.settings[use], str):
>                  self.settings["use"] = self.settings[use].split()
> -            self.settings["use"] = self.settings[use]
> +            else:
> +                self.settings["use"] = self.settings[use]
>              del self.settings[use]
>          else:
>              self.settings["use"] = []
> --
> 2.28.0

Thanks, this indeed looks broken. It was broken by b30dd97d672d by the
looks of it.

Reviewed-by: Matt Turner <mattst88@gentoo.org>

and committed.


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

end of thread, other threads:[~2020-10-14 17:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-10-14 13:38 [gentoo-catalyst] [PATCH] Fix spec file USE flag parsing Felix Bier
2020-10-14 17:50 ` Matt Turner

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