@@ -110,6 +110,22 @@ def desc(self):
110110 return f"{ self .path !r} : unknown USE_EXPAND group{ s } in { self .var !r} : { groups } "
111111
112112
113+ class UnknownProfileUseExpandValue (results .ProfilesResult , results .Warning ):
114+ """Profile defines unknown default values for USE_EXPAND group."""
115+
116+ def __init__ (self , path : str , group : str , values : Iterable [str ]):
117+ super ().__init__ ()
118+ self .path = path
119+ self .group = group
120+ self .values = tuple (values )
121+
122+ @property
123+ def desc (self ):
124+ s = pluralism (self .values )
125+ values = ", " .join (self .values )
126+ return f"{ self .path !r} : unknown value{ s } for { self .group !r} : { values } "
127+
128+
113129class UnknownProfileArch (results .ProfilesResult , results .Warning ):
114130 """Profile includes unknown ARCH."""
115131
@@ -168,6 +184,7 @@ class ProfilesCheck(Check):
168184 UnknownProfileUse ,
169185 UnknownProfilePackageKeywords ,
170186 UnknownProfileUseExpand ,
187+ UnknownProfileUseExpandValue ,
171188 UnknownProfileArch ,
172189 ProfileWarning ,
173190 ProfileError ,
@@ -313,6 +330,21 @@ def _make_defaults(self, filename: str, node: sources.ProfileNode, vals: dict[st
313330 yield UnknownProfileUseExpand (
314331 pjoin (node .name , filename ), use_group , sorted (unknown )
315332 )
333+ for key , val in vals .items ():
334+ if key .startswith ("USE_EXPAND_VALUES_" ):
335+ use_group = key [18 :]
336+ if use_group in implicit_use_expands :
337+ continue
338+ elif allowed_values := self .use_expand_groups .get (use_group , None ):
339+ if unknown := set (val .split ()) - allowed_values :
340+ yield UnknownProfileUseExpandValue (
341+ pjoin (node .name , filename ), key , sorted (unknown )
342+ )
343+ else :
344+ yield UnknownProfileUseExpand (pjoin (node .name , filename ), key , [use_group ])
345+ for key in vals .keys () & self .use_expand_groups .keys ():
346+ if unknown := set (vals .get (key , "" ).split ()) - self .use_expand_groups [key ]:
347+ yield UnknownProfileUseExpandValue (pjoin (node .name , filename ), key , sorted (unknown ))
316348 if arch := vals .get ("ARCH" , None ):
317349 if arch not in self .keywords .arches :
318350 yield UnknownProfileArch (pjoin (node .name , filename ), arch )
0 commit comments