Gentoo Archives: gentoo-catalyst

From: Matt Turner <mattst88@g.o>
To: gentoo-catalyst@l.g.o
Subject: Re: [gentoo-catalyst] [PATCH] Fix spec file USE flag parsing
Date: Wed, 14 Oct 2020 17:50:59
Message-Id: CAEdQ38F22EUQCmsBiK_Z=g1L3dF6quNkGDmt1AHATmmib_xctQ@mail.gmail.com
In Reply to: [gentoo-catalyst] [PATCH] Fix spec file USE flag parsing by Felix Bier
1 On Wed, Oct 14, 2020 at 6:38 AM Felix Bier <Felix.Bier@×××××××××××××.com> wrote:
2 >
3 > In stagebase, the set_use function applies .split() to the use flags
4 > passed from the spec file, if the value is a string. However, the
5 > result is immediately overwritten after the if-statement. Therefore the
6 > .split() is ineffectual.
7 >
8 > This results in self.settings["use"] holding a string,
9 > which is then regarded as a list of characters in write_make_conf.
10 > This fix ensures that the result of the split is not overwritten
11 > (matching the similar code in set_catalyst_use).
12 >
13 > For example, setting "stage4/use: abc" in a spec file results
14 > in USE="a b c ..." in the generated make.conf.
15 > With this fix, the generated make.conf contains the expected
16 > USE="abc ...".
17 > ---
18 > catalyst/base/stagebase.py | 3 ++-
19 > 1 file changed, 2 insertions(+), 1 deletion(-)
20 >
21 > diff --git a/catalyst/base/stagebase.py b/catalyst/base/stagebase.py
22 > index df1cb844..2e313bd8 100644
23 > --- a/catalyst/base/stagebase.py
24 > +++ b/catalyst/base/stagebase.py
25 > @@ -512,7 +512,8 @@ class StageBase(TargetBase, ClearBase, GenBase):
26 > if use in self.settings:
27 > if isinstance(self.settings[use], str):
28 > self.settings["use"] = self.settings[use].split()
29 > - self.settings["use"] = self.settings[use]
30 > + else:
31 > + self.settings["use"] = self.settings[use]
32 > del self.settings[use]
33 > else:
34 > self.settings["use"] = []
35 > --
36 > 2.28.0
37
38 Thanks, this indeed looks broken. It was broken by b30dd97d672d by the
39 looks of it.
40
41 Reviewed-by: Matt Turner <mattst88@g.o>
42
43 and committed.