@@ -51,15 +51,15 @@ def __init__(self, cname, arch=None, commit_hash=None, version=None):
5151 self ._commit_id = None
5252 self ._feature_elements_cached = None
5353 self ._feature_flags_cached = None
54- self ._feature_platforms_cached = None
54+ self ._feature_platform_cached = None
5555 self ._feature_set_cached = None
5656 self ._flavor = None
5757 self ._version = None
5858
5959 commit_id_or_hash = None
6060
6161 re_match = re .match (
62- "([a-zA-Z0-9]+([\\ _\\ -][a-zA-Z0-9]+)*?)(-([a-z0-9]+)(-([a-z0-9. ]+)-([a-z0-9]+))*)?$" ,
62+ "([a-zA-Z0-9]+([\\ _\\ -][a-zA-Z0-9]+)*?)(-([a-z0-9]+)(-([a-z0-9\\ . \\ +~ ]+)-([a-z0-9]+))*)?$" ,
6363 cname ,
6464 )
6565
@@ -83,7 +83,7 @@ def __init__(self, cname, arch=None, commit_hash=None, version=None):
8383 if self ._version is None and version is not None :
8484 # Support version values formatted as <version>-<commit_hash>
8585 if commit_hash is None :
86- re_match = re .match ("([a-z0-9. ]+)(-([a-z0-9]+))?$" , version )
86+ re_match = re .match ("([a-z0-9\\ . \\ +~ ]+)(-([a-z0-9]+))?$" , version )
8787 assert re_match , f"Not a valid version { version } "
8888
8989 commit_id_or_hash = re_match [3 ]
@@ -117,7 +117,7 @@ def cname(self) -> str:
117117 :return: (str) CName
118118 :since: 0.7.0
119119 """
120- assert self . _flavor is not None , "CName flavor is not set!"
120+
121121 cname = self ._flavor
122122
123123 if self ._arch is not None :
@@ -233,10 +233,13 @@ def feature_set_platform(self) -> str:
233233 :since: 0.11.0
234234 """
235235
236- if self ._feature_platforms_cached is not None :
237- return "," .join (self ._feature_platforms_cached )
236+ if self ._feature_platform_cached is not None :
237+ return self ._feature_platform_cached
238+
239+ platforms = Parser ().filter_as_dict (self .flavor )["platform" ]
240+ assert len (platforms ) < 2 , "Only one platform is supported"
238241
239- return "," . join ( Parser (). filter_as_dict ( self . flavor )[ "platform" ])
242+ return platforms [ 0 ]
240243
241244 @property
242245 def release_metadata_string (self ) -> str :
@@ -248,10 +251,11 @@ def release_metadata_string(self) -> str:
248251 """
249252
250253 features = Parser ().filter_as_dict (self .flavor )
254+ assert len (features ["platform" ]) == 1 , "Only one platform is supported"
251255
252256 elements = "," .join (features ["element" ])
253257 flags = "," .join (features ["flag" ])
254- platforms = "," . join ( features ["platform" ])
258+ platform = features ["platform" ][ 0 ]
255259
256260 metadata = f"""
257261ID={ GL_RELEASE_ID }
@@ -264,7 +268,7 @@ def release_metadata_string(self) -> str:
264268BUG_REPORT_URL="{ GL_BUG_REPORT_URL } "
265269GARDENLINUX_CNAME="{ self .cname } "
266270GARDENLINUX_FEATURES="{ self .feature_set } "
267- GARDENLINUX_FEATURES_PLATFORMS="{ platforms } "
271+ GARDENLINUX_FEATURES_PLATFORMS="{ platform } "
268272GARDENLINUX_FEATURES_ELEMENTS="{ elements } "
269273GARDENLINUX_FEATURES_FLAGS="{ flags } "
270274GARDENLINUX_VERSION="{ self .version } "
@@ -282,24 +286,9 @@ def platform(self) -> str:
282286 :return: (str) Feature set platforms
283287 :since: 0.7.0
284288 """
285- assert self ._flavor is not None , "Flavor not set!"
286289
287290 return self .feature_set_platform
288291
289- @property
290- def platforms (self ) -> List [str ]:
291- """
292- Returns the platforms for the cname parsed.
293-
294- :return: (str) Platforms
295- :since: 0.11.0
296- """
297-
298- if self ._feature_platforms_cached is not None :
299- return self ._feature_platforms_cached
300-
301- return Parser ().filter_as_dict (self .flavor )["platform" ]
302-
303292 @property
304293 def version (self ) -> Optional [str ]:
305294 """
@@ -395,9 +384,10 @@ def load_from_release_file(self, release_file: PathLike | str) -> None:
395384 UNNAMED_SECTION , "GARDENLINUX_FEATURES_FLAGS"
396385 ).split ("," )
397386
398- self ._feature_platforms_cached = release_config .get (
399- UNNAMED_SECTION , "GARDENLINUX_FEATURES_PLATFORMS"
400- ).split ("," )
387+ platforms = release_config .get (UNNAMED_SECTION , "GARDENLINUX_FEATURES_PLATFORMS" ).split ("," )
388+ assert len (platforms ) < 2 , "Only one platform is supported"
389+
390+ self ._feature_platform_cached = platforms [0 ]
401391
402392 def save_to_release_file (
403393 self , release_file : PathLike | str , overwrite : Optional [bool ] = False
0 commit comments